[Non-ACR][NUI][Fix TC fails] 82/230682/4
authorDongsug Song <dongsug.song@samsung.com>
Mon, 13 Apr 2020 10:33:24 +0000 (19:33 +0900)
committerDongsug Song <dongsug.song@samsung.com>
Tue, 14 Apr 2020 04:45:04 +0000 (13:45 +0900)
Change-Id: I22038f35bbba74e901cb5f63f6e148e6ae387971

tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButtonStyle.cs [changed mode: 0644->0755]
tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPopupStyle.cs [changed mode: 0644->0755]
tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStyleManager.cs [changed mode: 0644->0755]
tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.cs
tct-suite-vs/Tizen.NUI.Tests/testcase/TSTTSPlayer.cs

old mode 100644 (file)
new mode 100755 (executable)
index 0a10a00..28abd6a
@@ -148,9 +148,11 @@ namespace Tizen.NUI.Components.Tests
             var style = new ButtonStyle();
             Assert.IsNotNull(style, "Should be not null");
             Assert.IsInstanceOf<ButtonStyle>(style, "Should be equal!");
+            //IsSelectable needs be set true to change IsSelected\r
+            style.IsSelectable = true;
             style.IsSelected = true;
             Assert.AreEqual(true, style.IsSelected, "Should be equals to the set value");
-            style.IsSelected = false;
+            style.IsSelected = false;\r
             Assert.AreEqual(false, style.IsSelected, "Should be equals to the set value");
         }
 
old mode 100644 (file)
new mode 100755 (executable)
index 294a048..1a74c0b
@@ -77,8 +77,12 @@ namespace Tizen.NUI.Components.Tests
             /* TEST CODE */
             var style = new PopupStyle();
             Assert.IsNotNull(style, "Should be not null");
-            Assert.IsInstanceOf<PopupStyle>(style, "Should be equal!");
-            style.Buttons = new ButtonStyle() {IsSelected = true};
+            Assert.IsInstanceOf<PopupStyle>(style, "Should be equal!");\r
+            //IsSelectable needs be set true to change IsSelected\r
+            style.Buttons = new ButtonStyle() {
+                IsSelectable = true,
+                IsSelected = true,
+            };
             Assert.AreEqual(true, style.Buttons.IsSelected, "Should be equals to the set value");
         }
 
old mode 100644 (file)
new mode 100755 (executable)
index ef3ef31..2eef4e3
@@ -89,8 +89,9 @@ namespace Tizen.NUI.Components.Tests
         public void Theme_SET_GET_VALUE()
         {
             /* TEST CODE */
-            StyleManager.Instance.Theme = "Family";
-            Assert.AreEqual("Family", StyleManager.Instance.Theme, "Should be equals to the set value");
+            StyleManager.Instance.Theme = "family";
+            // Theme name does not distinguish capital character. All the capital character is changed into small character.
+            Assert.AreEqual("family", StyleManager.Instance.Theme, "Should be equals to the set value");
         }
 
         [Test]
index 2c3b3ca..45e4f0f 100755 (executable)
@@ -626,30 +626,34 @@ namespace Tizen.NUI.Tests
         [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
         public async Task EventReceived_EVENT()
         {
-            _editor = new TextEditor()
+            TextEditor editor = new TextEditor()
             {
                 Size2D = new Size2D(500, 300),
                 Position2D = new Position2D(10, 550),
                 BackgroundColor = Color.Magenta,
                 Focusable = true,
             };
-            Window.Instance.GetDefaultLayer().Add(_editor);
-            var inputMethodContext = _editor.GetInputMethodContext();
+            NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(editor);
+            var inputMethodContext = editor.GetInputMethodContext();
             if (inputMethodContext)
             {
                 _temp = 0;
                 inputMethodContext.EventReceived += OnEventReceived;
                 inputMethodContext.Deactivate();
                 inputMethodContext.HideInputPanel();
-                await Task.Delay(20);
+                await Task.Delay(500);
                 inputMethodContext.Activate();
                 inputMethodContext.ShowInputPanel();
-                await Task.Delay(20);
+                await Task.Delay(500);\r
+
+                tlog.Debug(TAG, "EventReceived_EVENT Add 500ms delay");
+
                 Assert.AreEqual(10, _temp, "Should be 10");
                 inputMethodContext.EventReceived -= OnEventReceived;
             }
-
-            Window.Instance.GetDefaultLayer().Remove(_editor);
+            editor.Unparent();
+            editor.Dispose();
+            editor = null;
         }
 
         [Test]
@@ -661,34 +665,32 @@ namespace Tizen.NUI.Tests
         [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
         public async Task StatusChanged_EVENT()
         {
-            _editor = new TextEditor()
+            TextEditor editor = new TextEditor()
             {
                 Size2D = new Size2D(500, 300),
                 Position2D = new Position2D(10, 550),
                 BackgroundColor = Color.Magenta,
                 Focusable = true,
-            };
-            Window.Instance.GetDefaultLayer().Add(_editor);
-            var inputMethodContext = _editor.GetInputMethodContext();
+            };\r
+            NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(editor);
+            var inputMethodContext = editor.GetInputMethodContext();
             if (inputMethodContext)
             {
                 _temp = 0;
                 inputMethodContext.StatusChanged += OnInputMethodContextEvent;
-
                 inputMethodContext.Deactivate();
                 inputMethodContext.HideInputPanel();
-                await Task.Delay(200);
+                await Task.Delay(500);
                 inputMethodContext.Activate();
                 inputMethodContext.ShowInputPanel();
-                await Task.Delay(200);
-
-                tlog.Debug(TAG, "StatusChanged_EVENT Add 200ms delay");
-
+                await Task.Delay(500);
+                tlog.Debug(TAG, "StatusChanged_EVENT Add 500ms delay");
                 Assert.AreEqual(10, _temp, "Should be 10");
                 inputMethodContext.StatusChanged -= OnInputMethodContextEvent;
             }
-
-            Window.Instance.GetDefaultLayer().Remove(_editor);
+            editor.Unparent();
+            editor.Dispose();
+            editor = null;
         }
 
         [Test]
@@ -700,31 +702,32 @@ namespace Tizen.NUI.Tests
         [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
         public async Task Resized_EVENT()
         {
-            _editor = new TextEditor()
+            TextEditor editor = new TextEditor()
             {
                 Size2D = new Size2D(500, 300),
                 Position2D = new Position2D(10, 550),
                 BackgroundColor = Color.Magenta,
                 Focusable = true,
-            };
-            Window.Instance.GetDefaultLayer().Add(_editor);
-            var inputMethodContext = _editor.GetInputMethodContext();
+            };\r
+            NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(editor);
+            var inputMethodContext = editor.GetInputMethodContext();
             if (inputMethodContext)
             {
                 _temp = 0;
                 inputMethodContext.Resized += OnInputMethodContextEvent;
                 inputMethodContext.Activate();
                 inputMethodContext.ShowInputPanel();
-                await Task.Delay(200);
+                await Task.Delay(500);
                 inputMethodContext.Deactivate();
                 inputMethodContext.HideInputPanel();
-                await Task.Delay(200);
-
+                await Task.Delay(500);\r
+                tlog.Debug(TAG, "Resized_EVENT Add 500ms delay");
                 Assert.AreEqual(10, _temp, "Should be 10");
                 inputMethodContext.Resized -= OnInputMethodContextEvent;
-            }
-
-            Window.Instance.GetDefaultLayer().Remove(_editor);
+            }\r
+            editor.Unparent();
+            editor.Dispose();
+            editor = null;
         }
 
         [Test]
index e49950b..5120c39 100755 (executable)
@@ -15,6 +15,7 @@ namespace Tizen.NUI.Tests
     {
         private string TAG = "NUI";
         private string image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
+        private bool _flagStateChanged = false;
 
         [SetUp]
         public void Init()
@@ -196,23 +197,30 @@ namespace Tizen.NUI.Tests
                 }
             }
 
-            bool flag = false;
             if (stat == TTSPlayer.TTSState.Unavailable)
             {
-                Tizen.Log.Fatal(TAG, "TTS Player is NOT available in this target! Need to Check!");
-                flag = true;
+                Tizen.Log.Fatal(TAG, "TTS Player is NOT available in this target! Need to Check! This case is rarely happened");
+                Assert.Pass("TTS Player is not available. It is not under control of NUI.(out of scope in NUI) This is NUI test, so just to be passed.");
             }
+            _flagStateChanged = false;
 
-            player.StateChanged += (obj, e) =>
-            {
-                flag = true;
-            };
+            player.StateChanged += Player_StateChanged;
 
             player.Play("test");
             player.Pause();
             await Task.Delay(20);
 
-            Assert.IsTrue(flag, "StateChanged is not be called");
+            Assert.IsTrue(_flagStateChanged, "StateChanged is not be called");
+
+            player.StateChanged -= Player_StateChanged;
+            player.Dispose();
+            player = null;
+        }
+
+        private void Player_StateChanged(object sender, TTSPlayer.StateChangedEventArgs e)
+        {
+            _flagStateChanged = true;
         }
+
     }
 }
\ No newline at end of file