[WidgetControl.Manual][Non-ACR] Fix WidgetViewerApp 99/290999/2
authorChanggyu Choi <changyu.choi@samsung.com>
Thu, 6 Apr 2023 07:33:35 +0000 (16:33 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Thu, 6 Apr 2023 08:22:23 +0000 (17:22 +0900)
Due to the discontinuation of EFL support in Tizen 7.0,
the EFL-based WidgetViewer that worked properly in previous versions was not functioning correctly.
This patch resolves the issue by redeveloping the WidgetViewer app using NUI.
Note that WidgetBaseApp is still implemented based on EFL, which may cause UI update issues.
When testing on a TV, please connect a mouse to perform the test.

Change-Id: Iff9a38783929e55faaf91b12563c60dc43ac1783
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
tct-suite-vs/Resource/Tizen.WidgetControl.Manual.Tests/WidgetViewerApp.Tizen.tpk
tct-suite-vs/Resource/Tizen.WidgetControl.Manual.Tests/WidgetViewerApp/WidgetViewerApp/WidgetViewerApp_App.cs
tct-suite-vs/Tizen.WidgetControl.Manual.Tests/testcase/TSWidgetControl.Instance.cs
tct-suite-vs/Tizen.WidgetControl.Manual.Tests/testcase/TSWidgetControl.cs

index 684dfdc..0e27da9 100755 (executable)
Binary files a/tct-suite-vs/Resource/Tizen.WidgetControl.Manual.Tests/WidgetViewerApp.Tizen.tpk and b/tct-suite-vs/Resource/Tizen.WidgetControl.Manual.Tests/WidgetViewerApp.Tizen.tpk differ
index 27a43ad..eb3fe5f 100755 (executable)
@@ -1,13 +1,16 @@
 using System;
 using Tizen;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
 using Tizen.Applications;
-using ElmSharp;
+using Tizen.Internals.Errors;
 
 namespace WidgetViewerApp
 {
-    class MyApp : CoreUIApplication
+    class MyApp : NUIApplication
     {
-        private RemoteView _view;
+        private WidgetViewManager _viewManager;
+        private WidgetView _widgetView = null;
         public const string LogTag = "WidgetViewerApp";
         public const string WidgetAppiD = "org.tizen.example.WidgetBaseApp.Tizen";
         private static Window _win;
@@ -33,26 +36,9 @@ namespace WidgetViewerApp
             Log.Warn(LogTag, "@@@ OnResumed");
         }
 
-        private void Exit_Clicked(object sender, EventArgs e)
-        {
-            try
-            {
-                _view.Layout.Unrealize();
-            }
-            catch (Exception ex)
-            {
-                Log.Warn(LogTag, "exception " + ex);
-            }
-        }
-
         protected override void OnCreate()
         {
             base.OnCreate();
-
-            Elementary.Initialize();
-            Elementary.ThemeOverlay();
-            EcoreSynchronizationContext.Initialize();
-
             try
             {
                 _control = new WidgetControl(WidgetAppiD);
@@ -60,57 +46,37 @@ namespace WidgetViewerApp
                 _control.Resumed += OnResumed;
                 _control.Paused += OnPaused;
                 _control.Destroyed += OnDestroyed;
-
-                _win = new Window("test");
-                _win.Show();
-
-                Conformant conformant = new Conformant(_win);
-                conformant.Show();
-
-                _win.KeyGrab(EvasKeyEventArgs.PlatformBackButtonName, false);
-                _win.KeyUp += (s, e) =>
+                
+                _win = Window.Instance;
+                _win.KeyEvent += (object source, Window.KeyEventArgs e) =>
                 {
-                    if (e.KeyName == EvasKeyEventArgs.PlatformBackButtonName)
+                    if (e.Key.State == Key.StateType.Down)
                     {
-                        Exit();
+                        Tizen.Log.Info("Key", e.Key.KeyPressedName);
+                        if (e.Key.KeyPressedName == "XF86Back")
+                        {
+                            this.Exit();
+                        }
                     }
                 };
 
-                Layout layout = new Layout(_win);
-                layout.Show();
+                Bundle bundle = new Bundle();
+                bundle.AddItem("ImageIdx", "1");
 
-                Layout layout2 = new Layout(_win);
-                layout2.Show();
-
-                Scroller scroller = new Scroller(conformant)
-                {
-                    AlignmentX = -1,
-                    AlignmentY = -1,
-                    WeightX = 1,
-                    WeightY = 1,
-                    ScrollBlock = ScrollBlock.None,
+                _viewManager = new WidgetViewManager(this, ApplicationInfo.ApplicationId);
+                _widgetView = _viewManager.AddWidget(WidgetAppiD, bundle.Encode(), _win.WindowSize.Width, _win.WindowSize.Height, 0);
+                _widgetView.BackgroundColor = Color.Black;
+                _widgetView.WidgetDeleted += (src, arg) =>
+                {\r
+                    Log.Warn(LogTag, "@@@ Widget app has been terminated");\r
+                    this.Exit();\r
                 };
-                scroller.Show();
-
-                Box box = new Box(scroller)
-                {
-                    AlignmentX = -1,
-                    AlignmentY = -1,
-                    WeightX = 1,
-                    WeightY = 1,
+                _widgetView.WidgetFaulted += (src, arg) =>
+                {\r
+                    Log.Warn(LogTag, "@@@ Widget app has been faulted");\r
+                    this.Exit();\r
                 };
-                box.Show();
-                box.SetAlignment(0.0, 0.0);
-
-                scroller.SetContent(box);
-                conformant.SetContent(scroller);
-
-                RemoteViewFactory.Init(_win);
-                _view = RemoteViewFactory.Create(_win, WidgetAppiD, null, 0, true, true, true);
-                _view.Layout.Resize(_win.ScreenSize.Width, _win.ScreenSize.Height);
-                _view.Layout.Show();
-                layout.SetContent(_view.Layout);
-                box.PackEnd(layout);
+                _win.Add(_widgetView);
             }
             catch (Exception e)
             {
@@ -122,15 +88,6 @@ namespace WidgetViewerApp
         {
             Log.Warn(LogTag, "Term");
             base.OnTerminate();
-            try
-            {
-                RemoteViewFactory.Shutdown();
-                Elementary.Shutdown();
-            }
-            catch (Exception e)
-            {
-                Log.Warn(LogTag, "Exception " + e);
-            }
         }
 
         protected override void OnPause()
@@ -138,16 +95,11 @@ namespace WidgetViewerApp
             Log.Warn(LogTag, "OnPause");
 
             // For WidgetApplication OnResize event check.
-            _view.Layout.Resize(_win.ScreenSize.Width, _win.ScreenSize.Height - 100);
+            _widgetView.Size2D = new Size2D(_win.WindowSize.Width, _win.WindowSize.Height - 100);
             base.OnPause();
-            try
-            {
-                _view?.Pause();
-            }
-            catch (Exception e)
-            {
-                Log.Warn(LogTag, "Exception " + e);
-            }
+            bool ret = _widgetView.PauseWidget();
+            if (!ret)
+                Log.Error(LogTag, "Pause Failed.");
         }
 
         protected override void OnResume()
@@ -155,16 +107,11 @@ namespace WidgetViewerApp
             Log.Warn(LogTag, "OnResume");
 
             // Restore size
-            _view.Layout.Resize(_win.ScreenSize.Width, _win.ScreenSize.Height);
+            _widgetView.Size2D = new Size2D(_win.WindowSize.Width, _win.WindowSize.Height);
             base.OnResume();
-            try
-            {
-                _view?.Resume();
-            }
-            catch (Exception e)
-            {
-                Log.Warn(LogTag, "Exception " + e);
-            }
+            bool ret = _widgetView.ResumeWidget();
+            if (!ret)
+                Log.Error(LogTag, "Resume Failed.");
         }
 
     }
index 42d6ada..00dfa6e 100755 (executable)
@@ -48,6 +48,7 @@ namespace Tizen.Applications.Tests
         [Precondition(2, "Open terminal to view logs.")]
         [Precondition(3, "Enter command \"sdb dlog -c\" to clear log")]
         [Precondition(4, "Enter command \"sdb dlog WidgetBaseApp\" to terminal")]
+        [Precondition(5, "If you are testing the TV platform, please use a mouse.")]
         [Step(1, "Click run TC")]
         [Step(2, "Launch WidgetViewerApp.Tizen(Enter command \"app_launcher -s org.tizen.example.WidgetViewerApp.Tizen\" to terminal) application -> Click ChangeContent Test Button -> return to app test")]
         [Step(2, "Check if log show \"WidgetBaseApp.Tizen.cs: ChangeContent_Clicked > ChangeContent done\".")]
index dc22079..e46af06 100755 (executable)
@@ -48,6 +48,7 @@ namespace Tizen.Applications.Tests
         [Precondition(2, "Open terminal to view logs.")]
         [Precondition(3, "Enter command \"sdb dlog -c\" to clear log")]
         [Precondition(4, "Enter command \"sdb dlog WidgetBaseApp\" to terminal")]
+        [Precondition(5, "If you are testing the TV platform, please use a mouse.")]
         [Step(1, "Click run TC")]
         [Step(2, "Launch WidgetViewerApp.Tizen(Enter command \"app_launcher -s org.tizen.example.WidgetViewerApp.Tizen\" to terminal) application -> Click GetInstances Test Button -> return to app test")]
         [Step(2, "Check if log show \"WidgetBaseApp.Tizen.cs: GetInstances_Clicked > GetInstances done\".")]