[NUI][ACR-482] Add PrimaryCursorPosition Property TCs 92/272392/10
authorssabah <s.sabah@samsung.com>
Tue, 15 Mar 2022 15:43:39 +0000 (18:43 +0300)
committershrouq Sabah <s.sabah@samsung.com>
Thu, 28 Jul 2022 15:39:12 +0000 (15:39 +0000)
Add test-cases read/write property for:
PrimaryCursorPosition Property in TextField and TextEditor

Change-Id: Ic3a93e66ce4819ded62df2f1868bd51a1d822961

tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextEditor.cs
tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextField.cs

index 813ccd9..e3a1496 100755 (executable)
@@ -1357,5 +1357,43 @@ namespace Tizen.NUI.Tests
             textEditor.LineWrapMode = LineWrapMode.Mixed;
             Assert.AreEqual(LineWrapMode.Mixed, textEditor.LineWrapMode, "LineWrapMode is not equal to Mixed!");
         }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test PrimaryCursorPosition. Check default value of PrimaryCursorPosition is length of text.")]
+        [Property("SPEC", "Tizen.NUI.BaseComponents.TextEditor.PrimaryCursorPosition A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PDV")]
+        [Property("AUTHOR", "Shrouq Sabah, s.sabah@samsung.com")]
+        public void PrimaryCursorPosition_DEFAULT_VALUE()
+        {
+            /* TEST CODE */
+            var textEditor = new TextEditor();
+            int textLen = textEditor.Text.Length;
+            Assert.AreEqual(textLen, textEditor.PrimaryCursorPosition,"Retrieved PrimaryCursorPosition value (Default) should be equal to (0))");
+
+            textEditor.Text ="Hello World!";
+            textLen = textEditor.Text.Length;
+            Assert.AreEqual(textLen, textEditor.PrimaryCursorPosition,"Retrieved PrimaryCursorPosition value (Default) should be equal to (Text.Length))");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test PrimaryCursorPosition. Check whether PrimaryCursorPosition is readable and writable.")]
+        [Property("SPEC", "Tizen.NUI.BaseComponents.TextEditor.PrimaryCursorPosition A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Shrouq Sabah, s.sabah@samsung.com")]
+        public void PrimaryCursorPosition_SET_GET_VALUE()
+        {
+            /* TEST CODE */
+            var textEditor = new TextEditor();
+            textEditor.Text ="Hello World!";
+            int textLen = textEditor.Text.Length;
+
+            int expectedValue = 5;
+            textEditor.PrimaryCursorPosition = expectedValue;
+            Assert.AreEqual(expectedValue, textEditor.PrimaryCursorPosition,"Retrieved PrimaryCursorPosition value should be equal to the set value");
+        }
     }
 }
index 00b1dbd..235a6a0 100755 (executable)
@@ -1361,5 +1361,44 @@ namespace Tizen.NUI.Tests
             Assert.IsTrue(flag, "CursorPositionChanged is not be called");
             textField.CursorPositionChanged -= handler;
         }
+
+
+        [Test]
+        [Category("P1")]
+        [Description("Test PrimaryCursorPosition. Check default value of PrimaryCursorPosition is length of text.")]
+        [Property("SPEC", "Tizen.NUI.BaseComponents.TextField.PrimaryCursorPosition A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PDV")]
+        [Property("AUTHOR", "Shrouq Sabah, s.sabah@samsung.com")]
+        public void PrimaryCursorPosition_DEFAULT_VALUE()
+        {
+            /* TEST CODE */
+            var textField = new TextField();
+            int textLen = textField.Text.Length;
+            Assert.AreEqual(textLen, textField.PrimaryCursorPosition,"Retrieved PrimaryCursorPosition value (Default) should be equal to (0))");
+
+            textField.Text ="Hello World!";
+            textLen = textField.Text.Length;
+            Assert.AreEqual(textLen, textField.PrimaryCursorPosition,"Retrieved PrimaryCursorPosition value (Default) should be equal to (Text.Length))");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test PrimaryCursorPosition. Check whether PrimaryCursorPosition is readable and writable.")]
+        [Property("SPEC", "Tizen.NUI.BaseComponents.TextField.PrimaryCursorPosition A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Shrouq Sabah, s.sabah@samsung.com")]
+        public void PrimaryCursorPosition_SET_GET_VALUE()
+        {
+            /* TEST CODE */
+            var textField = new TextField();
+            textField.Text ="Hello World!";
+            int textLen = textField.Text.Length;
+
+            int expectedValue = 5;
+            textField.PrimaryCursorPosition = expectedValue;
+            Assert.AreEqual(expectedValue, textField.PrimaryCursorPosition,"Retrieved PrimaryCursorPosition value should be equal to the set value");
+        }
     }
 }