[NUI] Reinforce NUI Sample for window
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Samples / Tizen.NUI.Samples / Samples / WindowTest.cs
1
2 using global::System;
3 using Tizen.NUI;
4 using Tizen.NUI.BaseComponents;
5 using Tizen.NUI.Components;
6 using Tizen.System;
7 using System.Collections.Generic;
8 using NUnit.Framework;
9
10 namespace Tizen.NUI.Samples
11 {
12     using log = Tizen.Log;
13     public class WindowTest : IExample
14     {
15         string tag = "NUITEST";
16         Window mainWin;
17         int screenWidth;
18         int screenHeight;
19
20         int addingInput;
21         Timer tm;
22         bool manualRotation;
23         int rotationCount;
24         private Window subWindow = null;
25
26         private const string KEY_NUM_1 = "1";
27         private const string KEY_NUM_2 = "2";
28         private const string KEY_NUM_3 = "3";
29         private const string KEY_NUM_4 = "4";
30         private const string KEY_NUM_5 = "5";
31         private const string KEY_NUM_6 = "6";
32         private const string KEY_NUM_7 = "7";
33         private const string KEY_NUM_8 = "8";
34         private const string KEY_NUM_9 = "9";
35         private const string KEY_NUM_0 = "0";
36
37         private static readonly string ImagePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/Dali/CubeTransitionEffect/";
38
39         class CustomBorder : DefaultBorder
40         {
41             private static readonly string ResourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
42             private static readonly string MinimalizeIcon = ResourcePath + "/images/minimalize.png";
43             private static readonly string MaximalizeIcon = ResourcePath + "/images/maximalize.png";
44             private static readonly string RestoreIcon = ResourcePath + "/images/smallwindow.png";
45             private static readonly string CloseIcon = ResourcePath + "/images/close.png";
46             private static readonly string LeftCornerIcon = ResourcePath + "/images/leftCorner.png";
47             private static readonly string RightCornerIcon = ResourcePath + "/images/rightCorner.png";
48
49             private int width = 500;
50             private bool hide = false;
51             private View borderView;
52             private TextLabel title;
53
54             private ImageView minimalizeIcon;
55             private ImageView maximalizeIcon;
56             private ImageView closeIcon;
57             private ImageView leftCornerIcon;
58             private ImageView rightCornerIcon;
59
60             private Rectangle preWinPositonSize;
61
62             public CustomBorder() : base()
63             {
64                 BorderHeight = 50;
65                 OverlayMode = true;
66                 BorderLineThickness = 0;
67             }
68
69             public override bool CreateTopBorderView(View topView)
70             {
71                 if (topView == null)
72                 {
73                     return false;
74                 }
75                 topView.Layout = new LinearLayout()
76                 {
77                     LinearOrientation = LinearLayout.Orientation.Horizontal,
78                     VerticalAlignment = VerticalAlignment.Center,
79                     CellPadding = new Size2D(20, 20),
80                 };
81                 title = new TextLabel()
82                 {
83                     Text = "CustomBorder",
84                 };
85
86                 var button = new Button()
87                 {
88                     Text = "AlwaysOnTop",
89                 };
90                 button.Clicked += (s, e) =>
91                 {
92                     BorderWindow.EnableFloatingMode(true);
93                 };
94                 topView.Add(title);
95                 topView.Add(button);
96                 return true;
97             }
98
99             public override bool CreateBottomBorderView(View bottomView)
100             {
101                 if (bottomView == null)
102                 {
103                     return false;
104                 }
105                 bottomView.Layout = new RelativeLayout();
106
107                 minimalizeIcon = new ImageView()
108                 {
109                     ResourceUrl = MinimalizeIcon,
110                     AccessibilityHighlightable = true,
111                 };
112
113                 maximalizeIcon = new ImageView()
114                 {
115                     ResourceUrl = MaximalizeIcon,
116                     AccessibilityHighlightable = true,
117                 };
118
119                 closeIcon = new ImageView()
120                 {
121                     ResourceUrl = CloseIcon,
122                     AccessibilityHighlightable = true,
123                 };
124
125                 leftCornerIcon = new ImageView()
126                 {
127                     ResourceUrl = LeftCornerIcon,
128                     AccessibilityHighlightable = true,
129                 };
130
131                 rightCornerIcon = new ImageView()
132                 {
133                     ResourceUrl = RightCornerIcon,
134                     AccessibilityHighlightable = true,
135                 };
136
137                 RelativeLayout.SetRightTarget(minimalizeIcon, maximalizeIcon);
138                 RelativeLayout.SetRightRelativeOffset(minimalizeIcon, 0.0f);
139                 RelativeLayout.SetHorizontalAlignment(minimalizeIcon, RelativeLayout.Alignment.End);
140                 RelativeLayout.SetRightTarget(maximalizeIcon, closeIcon);
141                 RelativeLayout.SetRightRelativeOffset(maximalizeIcon, 0.0f);
142                 RelativeLayout.SetHorizontalAlignment(maximalizeIcon, RelativeLayout.Alignment.End);
143                 RelativeLayout.SetRightTarget(closeIcon, rightCornerIcon);
144                 RelativeLayout.SetRightRelativeOffset(closeIcon, 0.0f);
145                 RelativeLayout.SetHorizontalAlignment(closeIcon, RelativeLayout.Alignment.End);
146                 RelativeLayout.SetRightRelativeOffset(rightCornerIcon, 1.0f);
147                 RelativeLayout.SetHorizontalAlignment(rightCornerIcon, RelativeLayout.Alignment.End);
148                 bottomView.Add(leftCornerIcon);
149                 bottomView.Add(minimalizeIcon);
150                 bottomView.Add(maximalizeIcon);
151                 bottomView.Add(closeIcon);
152                 bottomView.Add(rightCornerIcon);
153
154
155                 minimalizeIcon.TouchEvent += OnMinimizeIconTouched;
156                 maximalizeIcon.TouchEvent += OnMaximizeIconTouched;
157                 closeIcon.TouchEvent += OnCloseIconTouched;
158                 leftCornerIcon.TouchEvent += OnLeftBottomCornerIconTouched;
159                 rightCornerIcon.TouchEvent += OnRightBottomCornerIconTouched;
160
161                 minimalizeIcon.AccessibilityActivated += (s, e) =>
162                 {
163                     MinimizeBorderWindow();
164                 };
165                 maximalizeIcon.AccessibilityActivated += (s, e) =>
166                 {
167                     MaximizeBorderWindow();
168                 };
169                 closeIcon.AccessibilityActivated += (s, e) =>
170                 {
171                     CloseBorderWindow();
172                 };
173
174                 minimalizeIcon.AccessibilityNameRequested += (s, e) =>
175                 {
176                     e.Name = "Minimize";
177                 };
178                 maximalizeIcon.AccessibilityNameRequested += (s, e) =>
179                 {
180                     e.Name = "Maximize";
181                 };
182                 closeIcon.AccessibilityNameRequested += (s, e) =>
183                 {
184                     e.Name = "Close";
185                 };
186                 leftCornerIcon.AccessibilityNameRequested += (s, e) =>
187                 {
188                     e.Name = "Resize";
189                 };
190                 rightCornerIcon.AccessibilityNameRequested += (s, e) =>
191                 {
192                     e.Name = "Resize";
193                 };
194
195                 minimalizeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
196                 maximalizeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
197                 closeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
198                 leftCornerIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
199                 rightCornerIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
200
201                 return true;
202             }
203
204             public override void CreateBorderView(View borderView)
205             {
206                 this.borderView = borderView;
207                 borderView.CornerRadius = new Vector4(0.03f, 0.03f, 0.03f, 0.03f);
208                 borderView.CornerRadiusPolicy = VisualTransformPolicyType.Relative;
209                 borderView.BackgroundColor = new Color(1, 1, 1, 0.3f);
210             }
211
212             public override void OnCreated(View borderView)
213             {
214                 base.OnCreated(borderView);
215                 UpdateIcons();
216             }
217
218             public override bool OnCloseIconTouched(object sender, View.TouchEventArgs e)
219             {
220                 base.OnCloseIconTouched(sender, e);
221                 return true;
222             }
223
224             public override bool OnMinimizeIconTouched(object sender, View.TouchEventArgs e)
225             {
226                 if (e.Touch.GetState(0) == PointStateType.Up)
227                 {
228                     if (BorderWindow.IsMaximized() == true)
229                     {
230                         BorderWindow.Maximize(false);
231                     }
232                     preWinPositonSize = BorderWindow.WindowPositionSize;
233                     BorderWindow.WindowPositionSize = new Rectangle(preWinPositonSize.X, preWinPositonSize.Y, 500, 0);
234                 }
235                 return true;
236             }
237
238             public override void OnRequestResize()
239             {
240                 if (borderView != null)
241                 {
242                     borderView.BackgroundColor = new Color(0, 1, 0, 0.3f); // 보더의 배경을 변경할 수 있습니다.
243                 }
244             }
245
246             public override void OnResized(int width, int height)
247             {
248                 if (borderView != null)
249                 {
250                     if (this.width > width && hide == false)
251                     {
252                         title.Hide();
253                         hide = true;
254                     }
255                     else if (this.width < width && hide == true)
256                     {
257                         title.Show();
258                         hide = false;
259                     }
260                     borderView.BackgroundColor = new Color(1, 1, 1, 0.3f); //  리사이즈가 끝나면 보더의 색깔은 원래대로 돌려놓습니다.
261                     base.OnResized(width, height);
262                     UpdateIcons();
263                 }
264             }
265
266             private void UpdateIcons()
267             {
268                 if (BorderWindow != null && borderView != null)
269                 {
270                     if (BorderWindow.IsMaximized() == true)
271                     {
272                         if (maximalizeIcon != null)
273                         {
274                             maximalizeIcon.ResourceUrl = RestoreIcon;
275                         }
276                     }
277                     else
278                     {
279                         if (maximalizeIcon != null)
280                         {
281                             maximalizeIcon.ResourceUrl = MaximalizeIcon;
282                         }
283                     }
284                 }
285             }
286
287         }
288
289
290
291
292         void Initialize()
293         {
294             mainWin = NUIApplication.GetDefaultWindow();
295             mainWin.KeyEvent += OnKeyEvent;
296             mainWin.TouchEvent += WinTouchEvent;
297             mainWin.BackgroundColor = Color.Cyan;
298
299             Information.TryGetValue<int>("http://tizen.org/feature/screen.width", out screenWidth);
300             Information.TryGetValue<int>("http://tizen.org/feature/screen.height", out screenHeight);
301             log.Fatal(tag, $"Initialize= screenWidth {screenWidth}, screenHeight {screenHeight} ");
302             Rectangle inputRegion = new Rectangle(0, 0, screenWidth, screenHeight / 2);
303             mainWin.IncludeInputRegion(inputRegion);
304
305             addingInput = 0;
306
307             TextLabel text = new TextLabel("NUI Window Test");
308             text.HorizontalAlignment = HorizontalAlignment.Center;
309             text.VerticalAlignment = VerticalAlignment.Center;
310             text.TextColor = Color.Blue;
311             text.PointSize = 12.0f;
312             text.HeightResizePolicy = ResizePolicyType.FillToParent;
313             text.WidthResizePolicy = ResizePolicyType.FillToParent;
314             mainWin.Add(text);
315
316             List<Window.WindowOrientation> list = new List<Window.WindowOrientation>();
317
318             list.Add(Window.WindowOrientation.Landscape);
319             list.Add(Window.WindowOrientation.LandscapeInverse);
320             list.Add(Window.WindowOrientation.NoOrientationPreference);
321             list.Add(Window.WindowOrientation.Portrait);
322             list.Add(Window.WindowOrientation.PortraitInverse);
323
324             mainWin.SetAvailableOrientations(list);
325
326             Animation animation = new Animation(2000);
327             animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500);
328             animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000);
329             animation.Looping = true;
330             animation.Play();
331
332             manualRotation = false;
333             rotationCount = 0;
334         }
335
336         private bool Tm_Tick(object source, Timer.TickEventArgs e)
337         {
338             bool rotating = mainWin.IsWindowRotating();
339             log.Fatal(tag, $"window is Rotating: {rotating}");
340             if (rotating && manualRotation)
341             {
342                 rotationCount++;
343                 if (rotationCount > 100)
344                 {
345                     log.Fatal(tag, $"call SendRotationCompletedAcknowledgement");
346                     mainWin.SendRotationCompletedAcknowledgement();
347                     rotationCount = 0;
348                 }
349             }
350             return true;
351         }
352
353         private void WinTouchEvent(object sender, Window.TouchEventArgs e)
354         {
355             if (e.Touch.GetState(0) == PointStateType.Down)
356             {
357                 Vector2 touchpoint = e.Touch.GetScreenPosition(0);
358                 log.Fatal(tag, $"WinTouchEvent={touchpoint.X}, {touchpoint.Y}");
359                 int xPosition = 0;
360                 if (addingInput == 0)
361                 {
362                     if (touchpoint.Y > (screenHeight / 2 - 50))
363                     {
364                         int yPostion = screenHeight / 2 + 1;
365                         int height = screenHeight / 2;
366                         log.Fatal(tag, $"WinTouchEvent= Include {xPosition},{yPostion} {screenWidth}x{height} ");
367                         mainWin.IncludeInputRegion(new Rectangle(xPosition, yPostion, screenWidth, height));
368                         addingInput = 1;
369                     }
370                 }
371                 else
372                 {
373                     if (touchpoint.Y > (screenHeight - 50))
374                     {
375                         int yPostion = screenHeight / 2 + 1;
376                         int height = screenHeight / 2;
377                         log.Fatal(tag, $"WinTouchEvent= Exclude {xPosition},{yPostion} {screenWidth}x{height} ");
378                         mainWin.ExcludeInputRegion(new Rectangle(xPosition, yPostion, screenWidth, height));
379                         addingInput = 0;
380                     }
381                 }
382             }
383         }
384
385         public void OnKeyEvent(object sender, Window.KeyEventArgs e)
386         {
387             if (e.Key.State == Key.StateType.Down)
388             {
389                 log.Fatal(tag, $"key down! key={e.Key.KeyPressedName}");
390
391                 switch (e.Key.KeyPressedName)
392                 {
393                     case "XF86Back":
394                     case "Escape":
395                         //Exit();
396                         break;
397
398                     case KEY_NUM_0:
399                         CreateSubWindow();
400                         break;
401
402                     case KEY_NUM_1:
403                         log.Fatal(tag, $"SetClass test");
404                         mainWin.SetClass("windowTitle", "windowClass");
405                         break;
406
407                     case KEY_NUM_2:
408                         log.Fatal(tag, $"Maximize test");
409                         if (mainWin.IsMaximized())
410                         {
411                             log.Fatal(tag, $"Unset Maximize");
412                             mainWin.Maximize(false);
413                         }
414                         else
415                         {
416                             log.Fatal(tag, $"Set Maximize");
417                             mainWin.Maximize(true);
418                         }
419                         break;
420
421                     case KEY_NUM_3:
422                         log.Fatal(tag, $"Set MaximumSize test");
423                         mainWin.SetMaximumSize(new Size2D(700, 700));
424                         break;
425
426                     case KEY_NUM_4:
427                         log.Fatal(tag, $"Set MimimumSize test");
428                         mainWin.SetMimimumSize(new Size2D(100, 100));
429                         break;
430
431                     case KEY_NUM_5:
432                         log.Fatal(tag, $"manual rotation test");
433                         if (manualRotation == false)
434                         {
435                             manualRotation = true;
436                             tm = new Timer(100);
437                             tm.Tick += Tm_Tick;
438                             tm.Start();
439                             log.Fatal(tag, $"Enable manual rotation");
440                         }
441                         else
442                         {
443                             manualRotation = false;
444                             log.Fatal(tag, $"Disable manual rotation");
445                         }
446                         mainWin.SetNeedsRotationCompletedAcknowledgement(manualRotation);
447                         break;
448
449                     case KEY_NUM_6:
450                         log.Fatal(tag, $"Fullscreen Test");
451                         if (mainWin.GetFullScreen() == false)
452                         {
453                             mainWin.SetFullScreen(true);
454                         }
455                         else
456                         {
457                             mainWin.SetFullScreen(false);
458                         }
459                         break;
460
461                     case KEY_NUM_7:
462                         log.Fatal(tag, $"Raise Test");
463                         mainWin.Raise();
464                         break;
465
466                     case KEY_NUM_8:
467                         log.Fatal(tag, $"Lower Test");
468                         mainWin.Lower();
469                         break;
470
471                     case KEY_NUM_9:
472                         log.Fatal(tag, $"Activate Test");
473                         mainWin.Activate();
474                         break;
475
476                     default:
477                         log.Fatal(tag, $"no test!");
478                         break;
479                 }
480             }
481         }
482
483         void CreateSubWindow()
484         {
485             if (subWindow == null)
486             {
487                 CustomBorder customBorder = new CustomBorder();
488                 subWindow = new Window("subwin", customBorder, new Rectangle(60, 20, 800, 800), false);
489                 subWindow.InterceptTouchEvent += (s, e) =>
490                 {
491                     Tizen.Log.Error("NUI", $"subWindow.InterceptTouchEvent\n");
492                     if (e.Touch.GetState(0) == PointStateType.Down)
493                     {
494                         customBorder.OverlayBorderShow();
495                     }
496                     return false;
497                 };
498
499                 var root = new View()
500                 {
501                     Layout = new LinearLayout()
502                     {
503                         HorizontalAlignment = HorizontalAlignment.Center,
504                     },
505                     WidthResizePolicy = ResizePolicyType.FillToParent,
506                     HeightResizePolicy = ResizePolicyType.FillToParent,
507                     BackgroundColor = Color.Brown,
508                 };
509
510                 var image = new ImageView()
511                 {
512                     Size = new Size(300, 300),
513                     ResourceUrl = ImagePath + "gallery-large-5.jpg",
514                     CornerRadius = new Vector4(0.03f, 0.03f, 0, 0),
515                     CornerRadiusPolicy = VisualTransformPolicyType.Relative,
516                 };
517                 root.Add(image);
518                 subWindow.GetDefaultLayer().Add(root);
519
520                 List<Window.WindowOrientation> list = new List<Window.WindowOrientation>();
521
522                 list.Add(Window.WindowOrientation.Landscape);
523                 list.Add(Window.WindowOrientation.LandscapeInverse);
524                 list.Add(Window.WindowOrientation.NoOrientationPreference);
525                 list.Add(Window.WindowOrientation.Portrait);
526                 list.Add(Window.WindowOrientation.PortraitInverse);
527
528                 subWindow.SetAvailableOrientations(list);
529
530                 subWindow.Moved += OnSubWindowMoved;
531                 subWindow.KeyEvent += OnSubWindowKeyEvent;
532                 subWindow.MoveCompleted += OnSubWindowMoveCompleted;
533                 subWindow.ResizeCompleted += OnSubWindowResizeCompleted;
534             }
535             else
536             {
537                 subWindow.Minimize(false);
538             }
539         }
540
541         private void OnSubWindowMoved(object sender, WindowMovedEventArgs e)
542         {
543             Position2D position = e.WindowPosition;
544             log.Fatal(tag, $"OnSubWindowMoved() called!, x:{position.X}, y:{position.Y}");
545         }
546
547         private void OnSubWindowMoveCompleted(object sender, WindowMoveCompletedEventArgs e)
548         {
549             Position2D position = e.WindowCompletedPosition;
550             log.Fatal(tag, $"OnSubWindowMoveCompleted() called!, x:{position.X}, y:{position.Y}");
551         }
552
553         private void OnSubWindowResizeCompleted(object sender, WindowResizeCompletedEventArgs e)
554         {
555             Size2D size = e.WindowCompletedSize;
556             log.Fatal(tag, $"OnSubWindowResizeCompleted() called!, width:{size.Width}, height:{size.Height}");
557         }
558
559
560         public void OnSubWindowKeyEvent(object sender, Window.KeyEventArgs e)
561         {
562             if (e.Key.State == Key.StateType.Down)
563             {
564                 log.Fatal(tag, $"key down! key={e.Key.KeyPressedName}");
565
566                 switch (e.Key.KeyPressedName)
567                 {
568                     case "XF86Back":
569                     case "Escape":
570                         log.Fatal(tag, $"sub window dispose test!!!");
571                         subWindow.Dispose();
572                         break;
573
574                     case KEY_NUM_0:
575                         log.Fatal(tag, $"Remove Available Orientation test");
576                         subWindow.RemoveAvailableOrientation(Window.WindowOrientation.Portrait);
577                         break;
578
579                     case KEY_NUM_1:
580                         log.Fatal(tag, $"Set/Get Orientation test");
581                         subWindow.SetPreferredOrientation(Window.WindowOrientation.Portrait);
582                         Window.WindowOrientation currentPreferredOrientation = subWindow.GetPreferredOrientation();
583                         log.Fatal(tag, $"current Preferred Orientation: {currentPreferredOrientation}");
584                         Window.WindowOrientation currentOrientation = subWindow.GetCurrentOrientation();
585                         log.Fatal(tag, $"current Orientation: {currentOrientation}");
586                         break;
587
588                     case KEY_NUM_2:
589                         log.Fatal(tag, $"Set Accept Focus test");
590                         subWindow.SetAcceptFocus(true);
591                         if (subWindow.IsFocusAcceptable())
592                         {
593                             log.Fatal(tag, $"focus is acceptable");
594                         }
595                         else
596                         {
597                             log.Fatal(tag, $"focus is not acceptable");
598                         }
599                         break;
600
601                     case KEY_NUM_3:
602                         log.Fatal(tag, $"visible/show/hide test");
603                         if (subWindow.IsVisible())
604                         {
605                             log.Fatal(tag, $"subwindow is hideing");
606                             subWindow.Hide();
607                         }
608                         else
609                         {
610                             log.Fatal(tag, $"subwindow is showing");
611                             subWindow.Show();
612                         }
613                         break;
614
615                     case KEY_NUM_4:
616                         log.Fatal(tag, $"Get/Set, Notification Level test");
617                         if (subWindow.Type != WindowType.Notification)
618                         {
619                             log.Fatal(tag, $"Set notification window type");
620                             subWindow.Type = WindowType.Notification;
621                             log.Fatal(tag, $"Set notification level with high");
622                             subWindow.SetNotificationLevel(NotificationLevel.High);
623                             if (subWindow.GetNotificationLevel() == NotificationLevel.High)
624                             {
625                                 log.Fatal(tag, $"Current notificaiton level is high");
626                             }
627                             else
628                             {
629                                 log.Fatal(tag, $"Current notificaiton level is not high");
630                             }
631                         }
632                         break;
633
634                     case KEY_NUM_5:
635                         log.Fatal(tag, $"opaque test");
636                         if (subWindow.IsOpaqueState())
637                         {
638                             log.Fatal(tag, $"Set opaque state with false");
639                             subWindow.SetOpaqueState(false);
640                         }
641                         else
642                         {
643                             log.Fatal(tag, $"Set opaque state with true");
644                             subWindow.SetOpaqueState(true);
645                         }
646                         break;
647
648                     case KEY_NUM_6:
649                         log.Fatal(tag, $"Set/Get ScreenOffMode test");
650                         if (subWindow.GetScreenOffMode() == ScreenOffMode.Timout)
651                         {
652                             log.Fatal(tag, $"SetScreenOffMode with ScreenOffMode.Never");
653                             subWindow.SetScreenOffMode(ScreenOffMode.Never);
654                         }
655                         else
656                         {
657                             log.Fatal(tag, $"SetScreenOffMode with ScreenOffMode.Timout");
658                             subWindow.SetScreenOffMode(ScreenOffMode.Timout);
659                         }
660
661                         break;
662
663                     case KEY_NUM_7:
664                         log.Fatal(tag, $"Set/Get Brightness test");
665                         subWindow.SetBrightness(95);
666                         int currentBrightness = subWindow.GetBrightness();
667                         log.Fatal(tag, $"Current Brightness: {currentBrightness}");
668                         break;
669
670                     case KEY_NUM_8:
671                         log.Fatal(tag, $"Get/Set WindowPosition Test");
672                         subWindow.WindowPosition = new Position2D(10, 10);
673                         log.Fatal(tag, $"subWindow x: {subWindow.WindowPosition.X}, y: {subWindow.WindowPosition.Y}");
674                         //log.Fatal(tag, $"WindowPosition : " + subWindow.WindowPosition);
675                         break;
676
677                     case KEY_NUM_9:
678                         log.Fatal(tag, $"Get/Set WindowPositionSize Test");
679                         Rectangle rec = new Rectangle(20, 10, 100, 200);
680                         subWindow.WindowPositionSize = rec;
681                         log.Fatal(tag, $"WindowPositionSize : " + subWindow.WindowPositionSize);
682                         break;
683
684                     default:
685                         log.Fatal(tag, $"no test!");
686                         break;
687                 }
688             }
689         }
690         public void Activate() { Initialize(); }
691         public void Deactivate() { }
692     }
693 }