[NUI.Manual][TCSACR-415] Add AnchorClicked event to TextLabel, TextField and TextEditor 00/257800/5
authorBowon Ryu <bowon.ryu@samsung.com>
Mon, 3 May 2021 06:26:39 +0000 (15:26 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Fri, 4 Jun 2021 04:44:16 +0000 (13:44 +0900)
https://code.sec.samsung.net/jira/browse/TCSACR-415

Change-Id: I706783f5abf637d83e2962a14e272f9da489dc4c
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSTextEditor.cs [new file with mode: 0755]
tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSTextField.cs [new file with mode: 0755]
tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSTextLabel.cs [new file with mode: 0755]
tct-suite-vs/Tizen.NUI.Tests/testcase/TSAnchorClickedEventArgs.cs [new file with mode: 0644]

diff --git a/tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSTextEditor.cs b/tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSTextEditor.cs
new file mode 100755 (executable)
index 0000000..2364daf
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ *  Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Tests
+{
+    [TestFixture]
+    [Description("Tizen.NUI.TextEditor test")]
+    public class TextEditorTests
+    {
+        private ManualTestNUI _testPage;
+        private WearableManualTestNUI _wearTestPage;
+        private Window _window;
+        private Button _button;
+        private float _pointSize = 20.0f;
+        private TextLabel _label;
+        private TextEditor _textEditor;
+
+        [SetUp]
+        public void Init()
+        {
+            LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST");
+            _window = Window.Instance;
+            if (ManualTest.IsWearable())
+            {
+                _pointSize = 2.0f;
+                _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!");
+                _wearTestPage = WearableManualTestNUI.GetInstance();
+            }
+            else
+            {
+                _pointSize = ManualTest.GetPointSize();
+                _testPage = ManualTestNUI.GetInstance();
+            }
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST");
+        }
+
+        private void CreateView(string information)
+        {
+            _button = new Button();
+            _button.Text = information;
+            _button.PointSize = _pointSize;
+            _button.BackgroundColor = Color.Cyan;
+            _button.Size = new Size(Window.Instance.Size.Width * 0.1f, Window.Instance.Size.Height * 0.0462f);
+            _button.Focusable = true;
+            _testPage.ExecuteTC(_button);
+        }
+
+        public void OnTextEditorAnchorClicked(object sender, AnchorClickedEventArgs e)
+        {
+            Tizen.Log.Fatal("NUI", "TextEditor AnchorClicked ! href : " + e.Href);
+            if (e.Href.Equals("www.tizen.org"))
+            {
+                ManualTest.Confirm();
+                _window.Remove(_textEditor);
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test: Handle event TextEditor AnchorClicked.")]
+        [Property("SPEC", "Tizen.NUI.Tizen.NUI.BaseComponents.TextEditor.AnchorClicked E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EVL")]
+        [Property("AUTHOR", "Bowon Ryu, bowon.ryu@samsung.com")]
+        [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
+        [Step(1, "Click run button to run TC")]
+        [Step(2, "Click anchor(\"TIZEN\") on TextEditor which shown after clicking run button.")]
+        [Step(3, "TC will pass after touch or click anchor.")]
+        [Postcondition(1, "NA")]
+        public async Task AnchorClicked_CB()
+        {
+            if (ManualTest.IsWearable())
+            {
+                _wearTestPage.ExecuteTC(_label);
+                await ManualTest.WaitForConfirm();
+                _wearTestPage.ClearTestCase(_label);
+            }
+            else
+            {
+                CreateView("Click on the Anchor");
+                _textEditor = new TextEditor()
+                {
+                    Text = "<a href='www.tizen.org'>TIZEN</a>",
+                    EnableMarkup = true,
+                    Size2D = new Size2D(500, 300),
+                    Position2D = new Position2D(610, 150),
+                    BackgroundColor = Color.Magenta,
+                    Focusable = true,
+                };
+                _textEditor.AnchorClicked += OnTextEditorAnchorClicked;
+                _window.Add(_textEditor);
+                FocusManager.Instance.SetCurrentFocusView(_textEditor);
+
+                // Waits for user confirmation.
+                await ManualTest.WaitForConfirm();
+                _textEditor.AnchorClicked -= OnTextEditorAnchorClicked;
+                _testPage.ClearTestCase(_button);
+            }
+        }
+
+    }
+}
+
+
+
diff --git a/tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSTextField.cs b/tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSTextField.cs
new file mode 100755 (executable)
index 0000000..66483de
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ *  Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Tests
+{
+    [TestFixture]
+    [Description("Tizen.NUI.TextField test")]
+    public class TextFieldTests
+    {
+        private ManualTestNUI _testPage;
+        private WearableManualTestNUI _wearTestPage;
+        private Window _window;
+        private Button _button;
+        private float _pointSize = 20.0f;
+        private TextLabel _label;
+        private TextField _textField;
+
+        [SetUp]
+        public void Init()
+        {
+            LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST");
+            _window = Window.Instance;
+            if (ManualTest.IsWearable())
+            {
+                _pointSize = 2.0f;
+                _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!");
+                _wearTestPage = WearableManualTestNUI.GetInstance();
+            }
+            else
+            {
+                _pointSize = ManualTest.GetPointSize();
+                _testPage = ManualTestNUI.GetInstance();
+            }
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST");
+        }
+
+        private void CreateView(string information)
+        {
+            _button = new Button();
+            _button.Text = information;
+            _button.PointSize = _pointSize;
+            _button.BackgroundColor = Color.Cyan;
+            _button.Size = new Size(Window.Instance.Size.Width * 0.1f, Window.Instance.Size.Height * 0.0462f);
+            _button.Focusable = true;
+            _testPage.ExecuteTC(_button);
+        }
+
+        public void OnTextFieldAnchorClicked(object sender, AnchorClickedEventArgs e)
+        {
+            Tizen.Log.Fatal("NUI", "TextField AnchorClicked ! href : " + e.Href);
+            if (e.Href.Equals("www.tizen.org"))
+            {
+                ManualTest.Confirm();
+                _window.Remove(_textField);
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test: Handle event TextField AnchorClicked.")]
+        [Property("SPEC", "Tizen.NUI.Tizen.NUI.BaseComponents.TextField.AnchorClicked E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EVL")]
+        [Property("AUTHOR", "Bowon Ryu, bowon.ryu@samsung.com")]
+        [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
+        [Step(1, "Click run button to run TC")]
+        [Step(2, "Click anchor(\"TIZEN\") on TextField which shown after clicking run button.")]
+        [Step(3, "TC will pass after touch or click anchor.")]
+        [Postcondition(1, "NA")]
+        public async Task AnchorClicked_CB()
+        {
+            if (ManualTest.IsWearable())
+            {
+                _wearTestPage.ExecuteTC(_label);
+                await ManualTest.WaitForConfirm();
+                _wearTestPage.ClearTestCase(_label);
+            }
+            else
+            {
+                CreateView("Click on the Anchor");
+                _textField = new TextField()
+                {
+                    Text = "<a href='www.tizen.org'>TIZEN</a>",
+                    EnableMarkup = true,
+                    Size2D = new Size2D(500, 300),
+                    Position2D = new Position2D(610, 150),
+                    BackgroundColor = Color.Magenta,
+                    Focusable = true,
+                };
+                _textField.AnchorClicked += OnTextFieldAnchorClicked;
+                _window.Add(_textField);
+                FocusManager.Instance.SetCurrentFocusView(_textField);
+
+                // Waits for user confirmation.
+                await ManualTest.WaitForConfirm();
+                _textField.AnchorClicked -= OnTextFieldAnchorClicked;
+                _testPage.ClearTestCase(_button);
+            }
+        }
+
+    }
+}
diff --git a/tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSTextLabel.cs b/tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSTextLabel.cs
new file mode 100755 (executable)
index 0000000..31d6cee
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ *  Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Tests
+{
+    [TestFixture]
+    [Description("Tizen.NUI.TextLabel test")]
+    public class TextLabelTests
+    {
+        private ManualTestNUI _testPage;
+        private WearableManualTestNUI _wearTestPage;
+        private Window _window;
+        private Button _button;
+        private float _pointSize = 20.0f;
+        private TextLabel _label;
+        private TextLabel _textLabel;
+
+        [SetUp]
+        public void Init()
+        {
+            LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST");
+            _window = Window.Instance;
+            if (ManualTest.IsWearable())
+            {
+                _pointSize = 2.0f;
+                _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!");
+                _wearTestPage = WearableManualTestNUI.GetInstance();
+            }
+            else
+            {
+                _pointSize = ManualTest.GetPointSize();
+                _testPage = ManualTestNUI.GetInstance();
+            }
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST");
+        }
+
+        private void CreateView(string information)
+        {
+            _button = new Button();
+            _button.Text = information;
+            _button.PointSize = _pointSize;
+            _button.BackgroundColor = Color.Cyan;
+            _button.Size = new Size(Window.Instance.Size.Width * 0.1f, Window.Instance.Size.Height * 0.0462f);
+            _button.Focusable = true;
+            _testPage.ExecuteTC(_button);
+        }
+
+        public void OnTextLabelAnchorClicked(object sender, AnchorClickedEventArgs e)
+        {
+            Tizen.Log.Fatal("NUI", "TextLabel AnchorClicked ! href : " + e.Href);
+            if (e.Href.Equals("www.tizen.org"))
+            {
+                ManualTest.Confirm();
+                _window.Remove(_textLabel);
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test: Handle event TextLabel AnchorClicked.")]
+        [Property("SPEC", "Tizen.NUI.Tizen.NUI.BaseComponents.TextLabel.AnchorClicked E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EVL")]
+        [Property("AUTHOR", "Bowon Ryu, bowon.ryu@samsung.com")]
+        [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
+        [Step(1, "Click run button to run TC")]
+        [Step(2, "Click anchor(\"TIZEN\") on TextLabel which shown after clicking run button.")]
+        [Step(3, "TC will pass after touch or click anchor.")]
+        [Postcondition(1, "NA")]
+        public async Task AnchorClicked_CB()
+        {
+            if (ManualTest.IsWearable())
+            {
+                _wearTestPage.ExecuteTC(_label);
+                await ManualTest.WaitForConfirm();
+                _wearTestPage.ClearTestCase(_label);
+            }
+            else
+            {
+                CreateView("Click on the Anchor");
+                _textLabel = new TextLabel()
+                {
+                    Text = "<a href='www.tizen.org'>TIZEN</a>",
+                    EnableMarkup = true,
+                    Size2D = new Size2D(500, 300),
+                    Position2D = new Position2D(610, 150),
+                    BackgroundColor = Color.Magenta,
+                };
+                _textLabel.AnchorClicked += OnTextLabelAnchorClicked;
+                _window.Add(_textLabel);
+
+                // Waits for user confirmation.
+                await ManualTest.WaitForConfirm();
+                _textLabel.AnchorClicked -= OnTextLabelAnchorClicked;
+                _testPage.ClearTestCase(_button);
+            }
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSAnchorClickedEventArgs.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSAnchorClickedEventArgs.cs
new file mode 100644 (file)
index 0000000..fa31a7d
--- /dev/null
@@ -0,0 +1,61 @@
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Test;
+
+namespace Tizen.NUI.Tests
+{
+    [TestFixture]
+    [Description("Tizen.NUI.BaseComponents.AnchorClickedEventArgs Tests")]
+    public class AnchorClickedEventArgsTests
+    {
+        private string TAG = "NUI";
+
+        [SetUp]
+        public void Init()
+        {
+            Tizen.Log.Info(TAG, "Init() is called!");
+            App.MainTitleChangeText("AnchorClickedEventArgsTests");
+            App.MainTitleChangeBackgroundColor(null);
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            Tizen.Log.Info(TAG, "Destroy() is called!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Create a AnchorClickedEventArgs object. Check whether AnchorClickedEventArgs is successfully created or not.")]
+        [Property("SPEC", "Tizen.NUI.BaseComponents.AnchorClickedEventArgs.AnchorClickedEventArgs C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("AUTHOR", "Bowon Ryu, bowon.ryu@samsung.com")]
+        public void AnchorClickedEventArgs_INIT()
+        {
+            /* TEST CODE */
+            var anchorClickedEventArgs = new AnchorClickedEventArgs();
+            Assert.IsNotNull(anchorClickedEventArgs, "Can't create success object AnchorClickedEventArgs");
+            Assert.IsInstanceOf<AnchorClickedEventArgs>(anchorClickedEventArgs, "Should be an instance of AnchorClickedEventArgs type.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test TextEditor. Check whether TextEditor is readable and writable.")]
+        [Property("SPEC", "Tizen.NUI.BaseComponents.AnchorClickedEventArgs.Href A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA","PRW")]
+        [Property("AUTHOR", "Bowon Ryu, bowon.ryu@samsung.com")]
+        public void Href_SET_GET_VALUE()
+        {
+            /* TEST CODE */
+            AnchorClickedEventArgs anchorClickedEventArgs = new AnchorClickedEventArgs();
+            string href = "href";
+            anchorClickedEventArgs.Href = href;
+            Assert.AreEqual(href, anchorClickedEventArgs.Href, "Retrieved TextEditor should be equal to set value");
+        }
+    }
+}