[NUI] Make PrimaryCursorPosition property public
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / BaseComponents / TSTextEditor.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
7 using System.Threading.Tasks;
8
9 namespace Tizen.NUI.Devel.Tests
10 {
11     using tlog = Tizen.Log;
12
13     [TestFixture]
14     [Description("public/BaseComponents/TextEditor")]
15     public class PublicTextEditorTest
16     {
17         private const string tag = "NUITEST";
18
19         [SetUp]
20         public void Init()
21         {
22             tlog.Info(tag, "Init() is called!");
23         }
24
25         [TearDown]
26         public void Destroy()
27         {
28             tlog.Info(tag, "Destroy() is called!");
29         }
30
31         public bool CheckColor(Color colorSrc, Color colorDst)
32         {
33             if (colorSrc.R == colorDst.R && colorSrc.G == colorDst.G && colorSrc.B == colorDst.B && colorSrc.A == colorDst.A)
34                 return true;
35
36             return false;
37         }
38
39         public bool CheckColor(Vector4 colorSrc, Vector4 colorDst)
40         {
41             if (colorSrc.X == colorDst.X && colorSrc.Y == colorDst.Y && colorSrc.Z == colorDst.Z && colorSrc.W == colorDst.W)
42                 return true;
43
44             return false;
45         }
46
47         public bool CheckVector2(Vector2 vectorSrc, Vector2 vectorDst)
48         {
49             if (vectorSrc.X == vectorDst.X && vectorSrc.Y == vectorDst.Y)
50                 return true;
51
52             return false;
53         }
54
55         [Test]
56         [Category("P1")]
57         [Description("TextEditor constructor. With status of Shown.")]
58         [Property("SPEC", "Tizen.NUI.TextEditor.TextEditor C")]
59         [Property("SPEC_URL", "-")]
60         [Property("CRITERIA", "CONSTR")]
61         [Property("AUTHOR", "guowei.wang@samsung.com")]
62         [Obsolete]
63         public void TextEditorConstructorWithStatusOfShown()
64         {
65             tlog.Debug(tag, $"TextEditorConstructorWithStatusOfShown START");
66
67             var testingTarget = new TextEditor(false);
68             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
69             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
70
71             testingTarget.Dispose();
72             tlog.Debug(tag, $"TextEditorConstructorWithStatusOfShown END (OK)");
73         }
74
75         [Test]
76         [Category("P1")]
77         [Description("TextEditor TranslatableText.")]
78         [Property("SPEC", "Tizen.NUI.TextEditor.TranslatableText A")]
79         [Property("SPEC_URL", "-")]
80         [Property("CRITERIA", "PRW")]
81         [Property("AUTHOR", "guowei.wang@samsung.com")]
82         [Obsolete]
83         public void TextEditorTranslatableText()
84         {
85             tlog.Debug(tag, $"TextEditorTranslatableText START");
86
87             var testingTarget = new TextEditor();
88             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
89             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
90
91             tlog.Debug(tag, "TranslatableText : " + testingTarget.TranslatableText);
92
93             if (Tizen.NUI.NUIApplication.MultilingualResourceManager != null)
94             {
95                 testingTarget.TranslatableText = "textEditorTextSid";
96                 Assert.AreEqual("textEditorTextSid", testingTarget.TranslatableText, "Should be equal!");
97             }
98
99             testingTarget.Dispose();
100             tlog.Debug(tag, $"TextEditorTranslatableText END (OK)");
101         }
102
103         [Test]
104         [Category("P1")]
105         [Description("TextEditor TranslatablePlaceholderText.")]
106         [Property("SPEC", "Tizen.NUI.TextEditor.TranslatablePlaceholderText A")]
107         [Property("SPEC_URL", "-")]
108         [Property("CRITERIA", "PRW")]
109         [Property("AUTHOR", "guowei.wang@samsung.com")]
110         [Obsolete]
111         public void TextEditorTranslatablePlaceholderText()
112         {
113             tlog.Debug(tag, $"TextEditorTranslatablePlaceholderText START");
114
115             var testingTarget = new TextEditor();
116             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
117             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
118
119             tlog.Debug(tag, "TranslatablePlaceholderText : " + testingTarget.TranslatablePlaceholderText);
120
121             if (Tizen.NUI.NUIApplication.MultilingualResourceManager != null)
122             {
123                 testingTarget.TranslatablePlaceholderText = "textEditorTextSid";
124                 Assert.AreEqual("textEditorTextSid", testingTarget.TranslatablePlaceholderText, "Should be equal!");
125             }
126
127             testingTarget.Dispose();
128             tlog.Debug(tag, $"TextEditorTranslatablePlaceholderText END (OK)");
129         }
130
131         [Test]
132         [Category("P1")]
133         [Description("TextEditor FontSizeScale.")]
134         [Property("SPEC", "Tizen.NUI.TextEditor.FontSizeScale A")]
135         [Property("SPEC_URL", "-")]
136         [Property("CRITERIA", "CONSTR")]
137         [Property("AUTHOR", "bowon.ryu@samsung.com")]
138         public void TextEditorFontSizeScale()
139         {
140             tlog.Debug(tag, $"TextEditorFontSizeScale START");
141
142             var testingTarget = new TextEditor(true);
143             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
144             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
145
146             testingTarget.FontSizeScale = 2.0f;
147             Assert.AreEqual(2.0f, testingTarget.FontSizeScale, "Should be equal!");
148
149             testingTarget.FontSizeScale = Tizen.NUI.FontSizeScale.UseSystemSetting;
150             Assert.AreEqual(Tizen.NUI.FontSizeScale.UseSystemSetting, testingTarget.FontSizeScale, "Should be equal!");
151
152             testingTarget.Dispose();
153             tlog.Debug(tag, $"TextEditorFontSizeScale END (OK)");
154         }
155
156         [Test]
157         [Category("P1")]
158         [Description("TextEditor EnableFontSizeScale.")]
159         [Property("SPEC", "Tizen.NUI.TextEditor.EnableFontSizeScale A")]
160         [Property("SPEC_URL", "-")]
161         [Property("CRITERIA", "CONSTR")]
162         [Property("AUTHOR", "bowon.ryu@samsung.com")]
163         public void TextEditorEnableFontSizeScale()
164         {
165             tlog.Debug(tag, $"TextEditorEnableFontSizeScale START");
166
167             var testingTarget = new TextEditor(true);
168             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
169             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
170
171             testingTarget.EnableFontSizeScale = false;
172             Assert.AreEqual(false, testingTarget.EnableFontSizeScale, "Should be equal!");
173
174             testingTarget.EnableFontSizeScale = true;
175             Assert.AreEqual(true, testingTarget.EnableFontSizeScale, "Should be equal!");
176
177             testingTarget.Dispose();
178             tlog.Debug(tag, $"TextEditorEnableFontSizeScale END (OK)");
179         }
180
181         [Test]
182         [Category("P1")]
183         [Description("TextEditor Strikethrough.")]
184         [Property("SPEC", "Tizen.NUI.TextEditor.GetStrikethrough M")]
185         [Property("SPEC_URL", "-")]
186         [Property("CRITERIA", "MR")]
187         [Property("AUTHOR", "s.sabah@samsung.com")]
188         public void TextEditorStrikethrough()
189         {
190             tlog.Debug(tag, $"TextEditorStrikethrough START");
191
192             var testingTarget = new TextEditor(true);
193             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
194             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
195
196             var setStrikethrough = new Tizen.NUI.Text.Strikethrough()
197             {
198                 Enable = true,
199                 Color = new Color("#3498DB"),
200                 Height = 2.0f
201             };
202
203             testingTarget.SetStrikethrough(setStrikethrough);
204
205             var getStrikethrough = testingTarget.GetStrikethrough();
206             Assert.AreEqual(getStrikethrough.Enable, setStrikethrough.Enable, "Should be equal!");
207             Assert.AreEqual(true, CheckColor(getStrikethrough.Color, setStrikethrough.Color), "Should be true!");
208             Assert.AreEqual(getStrikethrough.Height, setStrikethrough.Height, "Should be equal!");
209
210             testingTarget.Dispose();
211             tlog.Debug(tag, $"TextEditorStrikethrough END (OK)");
212         }
213
214
215         [Test]
216         [Category("P1")]
217         [Description("TextEditor CharacterSpacing.")]
218         [Property("SPEC", "Tizen.NUI.TextEditor.CharacterSpacing A")]
219         [Property("SPEC_URL", "-")]
220         [Property("CRITERIA", "CONSTR")]
221         [Property("AUTHOR", "s.sabah@samsung.com")]
222         public void TextEditorCharacterSpacing()
223         {
224             tlog.Debug(tag, $"TextEditorCharacterSpacing START");
225
226             var testingTarget = new TextEditor(true);
227             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
228             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
229
230             float expandedValue = 1.5f;
231             testingTarget.CharacterSpacing = expandedValue;
232             Assert.AreEqual(expandedValue, testingTarget.CharacterSpacing, "Should be equal!");
233
234             float condensedValue = -1.5f;
235             testingTarget.CharacterSpacing = condensedValue;
236             Assert.AreEqual(condensedValue, testingTarget.CharacterSpacing, "Should be equal!");
237
238             testingTarget.Dispose();
239             tlog.Debug(tag, $"TextEditorCharacterSpacing END (OK)");
240         }
241
242         [Test]
243         [Category("P1")]
244         [Description("TextEditor VerticalAlignment.")]
245         [Property("SPEC", "Tizen.NUI.TextEditor.VerticalAlignment A")]
246         [Property("SPEC_URL", "-")]
247         [Property("CRITERIA", "CONSTR")]
248         [Property("AUTHOR", "bowon.ryu@samsung.com")]
249         public void TextEditorVerticalAlignment()
250         {
251             tlog.Debug(tag, $"TextEditorVerticalAlignment START");
252
253             var testingTarget = new TextEditor(true);
254             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
255             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
256
257             testingTarget.VerticalAlignment = VerticalAlignment.Bottom;
258             Assert.AreEqual(VerticalAlignment.Bottom, testingTarget.VerticalAlignment, "Should be equal!");
259
260             testingTarget.VerticalAlignment = VerticalAlignment.Top;
261             Assert.AreEqual(VerticalAlignment.Top, testingTarget.VerticalAlignment, "Should be equal!");
262
263             testingTarget.VerticalAlignment = VerticalAlignment.Center;
264             Assert.AreEqual(VerticalAlignment.Center, testingTarget.VerticalAlignment, "Should be equal!");
265
266             testingTarget.Dispose();
267             tlog.Debug(tag, $"TextEditorVerticalAlignment END (OK)");
268         }
269
270         [Test]
271         [Category("P1")]
272         [Description("TextEditor GetFontStyle.")]
273         [Property("SPEC", "Tizen.NUI.TextEditor.GetFontStyle M")]
274         [Property("SPEC_URL", "-")]
275         [Property("CRITERIA", "MR")]
276         [Property("AUTHOR", "bowon.ryu@samsung.com")]
277         public void TextEditorGetFontStyle()
278         {
279             tlog.Debug(tag, $"TextEditorGetFontStyle START");
280
281             var testingTarget = new TextEditor(true);
282             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
283             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
284
285             var setFontStyle = new Tizen.NUI.Text.FontStyle()
286             {
287                 Width = FontWidthType.Condensed,
288                 Weight = FontWeightType.Light,
289                 Slant = FontSlantType.Italic,
290             };
291
292             testingTarget.SetFontStyle(setFontStyle);
293
294             var getFontStyle = testingTarget.GetFontStyle();
295             Assert.AreEqual(getFontStyle.Width, setFontStyle.Width, "Should be equal!");
296             Assert.AreEqual(getFontStyle.Weight, setFontStyle.Weight, "Should be equal!");
297             Assert.AreEqual(getFontStyle.Slant, setFontStyle.Slant, "Should be equal!");
298
299             testingTarget.Dispose();
300             tlog.Debug(tag, $"TextEditorGetFontStyle END (OK)");
301         }
302
303         [Test]
304         [Category("P1")]
305         [Description("TextEditor GetUnderline.")]
306         [Property("SPEC", "Tizen.NUI.TextEditor.GetUnderline M")]
307         [Property("SPEC_URL", "-")]
308         [Property("CRITERIA", "MR")]
309         [Property("AUTHOR", "bowon.ryu@samsung.com")]
310         public void TextEditorGetUnderline()
311         {
312             tlog.Debug(tag, $"TextEditorGetUnderline START");
313
314             var testingTarget = new TextEditor(true);
315             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
316             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
317
318             var setUnderline = new Tizen.NUI.Text.Underline()
319             {
320                 Enable = true,
321                 Color = new Color("#3498DB"),
322                 Height = 2.0f,
323                 Type = UnderlineType.Dashed,
324                 DashWidth = 4.0f,
325                 DashGap = 6.0f,
326             };
327
328             testingTarget.SetUnderline(setUnderline);
329
330             var getUnderline = testingTarget.GetUnderline();
331             Assert.AreEqual(getUnderline.Enable, setUnderline.Enable, "Should be equal!");
332             Assert.AreEqual(true, CheckColor(getUnderline.Color, setUnderline.Color), "Should be true!");
333             Assert.AreEqual(getUnderline.Height, setUnderline.Height, "Should be equal!");
334             Assert.AreEqual(getUnderline.Type, setUnderline.Type, "Should be equal!");
335             Assert.AreEqual(getUnderline.DashWidth, setUnderline.DashWidth, "Should be equal!");
336             Assert.AreEqual(getUnderline.DashGap, setUnderline.DashGap, "Should be equal!");
337
338             testingTarget.Dispose();
339             tlog.Debug(tag, $"TextEditorGetUnderline END (OK)");
340         }
341
342         [Test]
343         [Category("P1")]
344         [Description("TextEditor GetShadow.")]
345         [Property("SPEC", "Tizen.NUI.TextEditor.GetShadow M")]
346         [Property("SPEC_URL", "-")]
347         [Property("CRITERIA", "MR")]
348         [Property("AUTHOR", "bowon.ryu@samsung.com")]
349         public void TextEditorGetShadow()
350         {
351             tlog.Debug(tag, $"TextEditorGetShadow START");
352
353             var testingTarget = new TextEditor(true);
354             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
355             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
356
357             var setShadow = new Tizen.NUI.Text.Shadow()
358             {
359                 BlurRadius = 5.0f,
360                 Color = Color.Red,
361                 Offset = new Vector2(3, 3),
362             };
363
364             testingTarget.SetShadow(setShadow);
365
366             var getShadow = testingTarget.GetShadow();
367             Assert.AreEqual(getShadow.BlurRadius, setShadow.BlurRadius, "Should be equal!");
368             Assert.AreEqual(true, CheckColor(getShadow.Color, setShadow.Color), "Should be true!");
369             Assert.AreEqual(true, CheckVector2(getShadow.Offset, setShadow.Offset), "Should be true!");
370
371             testingTarget.Dispose();
372             tlog.Debug(tag, $"TextEditorGetShadow END (OK)");
373         }
374
375         [Test]
376         [Category("P1")]
377         [Description("TextEditor GetOutline.")]
378         [Property("SPEC", "Tizen.NUI.TextEditor.GetOutline M")]
379         [Property("SPEC_URL", "-")]
380         [Property("CRITERIA", "MR")]
381         [Property("AUTHOR", "bowon.ryu@samsung.com")]
382         public void TextEditorGetOutline()
383         {
384             tlog.Debug(tag, $"TextEditorGetOutline START");
385
386             var testingTarget = new TextEditor(true);
387             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
388             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
389
390             var setOutline = new Tizen.NUI.Text.Outline()
391             {
392                 Width = 2.0f,
393                 Color = Color.Red,
394             };
395
396             testingTarget.SetOutline(setOutline);
397
398             var getOutline = testingTarget.GetOutline();
399             Assert.AreEqual(getOutline.Width, setOutline.Width, "Should be equal!");
400             Assert.AreEqual(true, CheckColor(getOutline.Color, setOutline.Color), "Should be true!");
401
402             testingTarget.Dispose();
403             tlog.Debug(tag, $"TextEditorGetOutline END (OK)");
404         }
405
406         [Test]
407         [Category("P1")]
408         [Description("TextEditor GetSelectionHandleImage.")]
409         [Property("SPEC", "Tizen.NUI.TextEditor.GetSelectionHandleImage M")]
410         [Property("SPEC_URL", "-")]
411         [Property("CRITERIA", "MR")]
412         [Property("AUTHOR", "bowon.ryu@samsung.com")]
413         public void TextEditorGetSelectionHandleImage()
414         {
415             tlog.Debug(tag, $"TextEditorGetSelectionHandleImage START");
416
417             var testingTarget = new TextEditor(true);
418             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
419             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
420
421             var setSelectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage()
422             {
423                 LeftImageUrl = "leftImage",
424                 RightImageUrl = "rightImage",
425             };
426
427             testingTarget.SetSelectionHandleImage(setSelectionHandleImage);
428
429             var getSelectionHandleImage = testingTarget.GetSelectionHandleImage();
430             Assert.AreEqual(getSelectionHandleImage.LeftImageUrl, setSelectionHandleImage.LeftImageUrl, "Should be equal!");
431             Assert.AreEqual(getSelectionHandleImage.RightImageUrl, setSelectionHandleImage.RightImageUrl, "Should be equal!");
432
433             testingTarget.Dispose();
434             tlog.Debug(tag, $"TextEditorGetSelectionHandleImage END (OK)");
435         }
436
437         [Test]
438         [Category("P1")]
439         [Description("TextEditor GetSelectionHandlePressedImage.")]
440         [Property("SPEC", "Tizen.NUI.TextEditor.GetSelectionHandlePressedImage M")]
441         [Property("SPEC_URL", "-")]
442         [Property("CRITERIA", "MR")]
443         [Property("AUTHOR", "bowon.ryu@samsung.com")]
444         public void TextEditorGetSelectionHandlePressedImage()
445         {
446             tlog.Debug(tag, $"TextEditorGetSelectionHandlePressedImage START");
447
448             var testingTarget = new TextEditor(true);
449             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
450             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
451
452             var setSelectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage()
453             {
454                 LeftImageUrl = "leftImage",
455                 RightImageUrl = "rightImage",
456             };
457
458             testingTarget.SetSelectionHandlePressedImage(setSelectionHandleImage);
459
460             var getSelectionHandleImage = testingTarget.GetSelectionHandlePressedImage();
461             Assert.AreEqual(getSelectionHandleImage.LeftImageUrl, setSelectionHandleImage.LeftImageUrl, "Should be equal!");
462             Assert.AreEqual(getSelectionHandleImage.RightImageUrl, setSelectionHandleImage.RightImageUrl, "Should be equal!");
463
464             testingTarget.Dispose();
465             tlog.Debug(tag, $"TextEditorGetSelectionHandlePressedImage END (OK)");
466         }
467
468         [Test]
469         [Category("P1")]
470         [Description("TextEditor GetSelectionHandleMarkerImage.")]
471         [Property("SPEC", "Tizen.NUI.TextEditor.GetSelectionHandleMarkerImage M")]
472         [Property("SPEC_URL", "-")]
473         [Property("CRITERIA", "MR")]
474         [Property("AUTHOR", "bowon.ryu@samsung.com")]
475         public void TextEditorGetSelectionHandleMarkerImage()
476         {
477             tlog.Debug(tag, $"TextEditorGetSelectionHandleMarkerImage START");
478
479             var testingTarget = new TextEditor(true);
480             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
481             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
482
483             var setSelectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage()
484             {
485                 LeftImageUrl = "leftImage",
486                 RightImageUrl = "rightImage",
487             };
488
489             testingTarget.SetSelectionHandleMarkerImage(setSelectionHandleImage);
490
491             var getSelectionHandleImage = testingTarget.GetSelectionHandleMarkerImage();
492             Assert.AreEqual(getSelectionHandleImage.LeftImageUrl, setSelectionHandleImage.LeftImageUrl, "Should be equal!");
493             Assert.AreEqual(getSelectionHandleImage.RightImageUrl, setSelectionHandleImage.RightImageUrl, "Should be equal!");
494
495             testingTarget.Dispose();
496             tlog.Debug(tag, $"TextEditorGetSelectionHandleMarkerImage END (OK)");
497         }
498
499         [Test]
500         [Category("P1")]
501         [Description("TextEditor GetInputFilter.")]
502         [Property("SPEC", "Tizen.NUI.TextEditor.GetInputFilter M")]
503         [Property("SPEC_URL", "-")]
504         [Property("CRITERIA", "MR")]
505         [Property("AUTHOR", "bowon.ryu@samsung.com")]
506         public void TextEditorGetInputFilter()
507         {
508             tlog.Debug(tag, $"TextEditorGetInputFilter START");
509
510             var testingTarget = new TextEditor(true);
511             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
512             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
513
514             var setInputFilter = new Tizen.NUI.Text.InputFilter()
515             {
516                 Accepted = @"[\d]",
517                 Rejected = "[0-3]",
518             };
519
520             testingTarget.SetInputFilter(setInputFilter);
521
522             var getInputFilter = testingTarget.GetInputFilter();
523             Assert.AreEqual(getInputFilter.Accepted, setInputFilter.Accepted, "Should be equal!");
524             Assert.AreEqual(getInputFilter.Rejected, setInputFilter.Rejected, "Should be equal!");
525
526             testingTarget.Dispose();
527             tlog.Debug(tag, $"TextEditorGetInputFilter END (OK)");
528         }
529
530         [Test]
531         [Category("P1")]
532         [Description("TextEditor GetPlaceholder.")]
533         [Property("SPEC", "Tizen.NUI.TextEditor.GetPlaceholder M")]
534         [Property("SPEC_URL", "-")]
535         [Property("CRITERIA", "MR")]
536         [Property("AUTHOR", "bowon.ryu@samsung.com")]
537         public void TextEditorGetPlaceholder()
538         {
539             tlog.Debug(tag, $"TextEditorGetPlaceholder START");
540
541             var testingTarget = new TextEditor(true);
542             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
543             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
544
545             var setPlaceholder = new Tizen.NUI.Text.Placeholder()
546             {
547                 Text = "placeholder text",
548                 TextFocused = "placeholder TextFocused",
549                 Color = Color.Red,
550                 FontFamily = "BreezeSans",
551                 FontStyle = new Tizen.NUI.Text.FontStyle()
552                 {
553                     Width = FontWidthType.Expanded,
554                     Weight = FontWeightType.ExtraLight,
555                     Slant = FontSlantType.Italic,
556                 },
557                 PointSize = 15.0f,
558                 Ellipsis = true,
559             };
560
561             testingTarget.SetPlaceholder(setPlaceholder);
562
563             var getPlaceholder = testingTarget.GetPlaceholder();
564             Assert.AreEqual(getPlaceholder.Text, setPlaceholder.Text, "Should be equal!");
565             Assert.AreEqual(getPlaceholder.TextFocused, setPlaceholder.TextFocused, "Should be equal!");
566             Assert.AreEqual(true, CheckColor(getPlaceholder.Color, setPlaceholder.Color), "Should be true!");
567             Assert.AreEqual(getPlaceholder.FontFamily, setPlaceholder.FontFamily, "Should be equal!");
568             Assert.AreEqual(true, getPlaceholder.FontStyle == setPlaceholder.FontStyle, "Should be true!");
569             Assert.AreEqual(getPlaceholder.PointSize, setPlaceholder.PointSize, "Should be equal!");
570             Assert.AreEqual(getPlaceholder.Ellipsis, setPlaceholder.Ellipsis, "Should be equal!");
571
572             testingTarget.Dispose();
573             tlog.Debug(tag, $"TextEditorGetPlaceholder END (OK)");
574         }
575
576         [Test]
577         [Category("P1")]
578         [Description("TextEditor MinLineSize.")]
579         [Property("SPEC", "Tizen.NUI.TextEditor.MinLineSize A")]
580         [Property("SPEC_URL", "-")]
581         [Property("CRITERIA", "CONSTR")]
582         [Property("AUTHOR", "bowon.ryu@samsung.com")]
583         public void TextEditorMinLineSize()
584         {
585             tlog.Debug(tag, $"TextEditorMinLineSize START");
586
587             var testingTarget = new TextEditor(true);
588             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
589             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
590
591             testingTarget.MinLineSize = 20;
592             Assert.AreEqual(20, testingTarget.MinLineSize, "Should be equal!");
593
594             testingTarget.Dispose();
595             tlog.Debug(tag, $"TextEditorMinLineSize END (OK)");
596         }
597
598         [Test]
599         [Category("P1")]
600         [Description("TextEditor EnableEditing.")]
601         [Property("SPEC", "Tizen.NUI.TextEditor.EnableEditing A")]
602         [Property("SPEC_URL", "-")]
603         [Property("CRITERIA", "CONSTR")]
604         [Property("AUTHOR", "bowon.ryu@samsung.com")]
605         public void TextEditorEnableEditing()
606         {
607             tlog.Debug(tag, $"TextEditorEnableEditing START");
608
609             var testingTarget = new TextEditor(true);
610             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
611             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
612
613             testingTarget.EnableEditing = false;
614             Assert.AreEqual(false, testingTarget.EnableEditing, "Should be equal!");
615
616             testingTarget.EnableEditing = true;
617             Assert.AreEqual(true, testingTarget.EnableEditing, "Should be equal!");
618
619             testingTarget.Dispose();
620             tlog.Debug(tag, $"TextEditorEnableEditing END (OK)");
621         }
622
623         [Test]
624         [Category("P1")]
625         [Description("TextEditor PrimaryCursorPosition.")]
626         [Property("SPEC", "Tizen.NUI.TextEditor.PrimaryCursorPosition A")]
627         [Property("SPEC_URL", "-")]
628         [Property("CRITERIA", "CONSTR")]
629         [Property("AUTHOR", "s.sabah@samsung.com")]
630         public void TextEditorPrimaryCursorPosition()
631         {
632             tlog.Debug(tag, $"TextEditorPrimaryCursorPosition START");
633
634             var testingTarget = new TextEditor(true);
635             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
636             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
637
638             testingTarget.Text ="Hello World!";
639             int textLen = testingTarget.Text.Length;
640
641             int expectedValue = textLen;
642             Assert.AreEqual(expectedValue, testingTarget.PrimaryCursorPosition, "Should be equal!");
643
644             expectedValue = 5;
645             testingTarget.PrimaryCursorPosition = expectedValue;
646             Assert.AreEqual(expectedValue, testingTarget.PrimaryCursorPosition, "Should be equal!");
647
648             expectedValue = 0;
649             testingTarget.PrimaryCursorPosition = expectedValue;
650             Assert.AreEqual(expectedValue, testingTarget.PrimaryCursorPosition, "Should be equal!");
651
652             expectedValue = textLen ;
653             testingTarget.PrimaryCursorPosition = textLen + 1;
654             Assert.AreEqual(expectedValue, testingTarget.PrimaryCursorPosition, "Should be equal!");
655
656             expectedValue = 6;
657             testingTarget.PrimaryCursorPosition = expectedValue;
658             Assert.AreEqual(expectedValue, testingTarget.PrimaryCursorPosition, "Should be equal!");
659
660             expectedValue = textLen ;
661             testingTarget.PrimaryCursorPosition = -1;
662             Assert.AreEqual(expectedValue, testingTarget.PrimaryCursorPosition, "Should be equal!");
663
664             testingTarget.Dispose();
665             tlog.Debug(tag, $"TextEditorPrimaryCursorPosition END (OK)");
666         }
667
668
669         [Test]
670         [Category("P1")]
671         [Description("TextEditor EnableSelection.")]
672         [Property("SPEC", "Tizen.NUI.TextEditor.EnableSelection A")]
673         [Property("SPEC_URL", "-")]
674         [Property("CRITERIA", "CONSTR")]
675         [Property("AUTHOR", "bowon.ryu@samsung.com")]
676         public void TextEditorEnableSelection()
677         {
678             tlog.Debug(tag, $"TextEditorEnableSelection START");
679
680             var testingTarget = new TextEditor(true);
681             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
682             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
683
684             testingTarget.EnableSelection = true;
685             Assert.AreEqual(true, testingTarget.EnableSelection, "Should be equal!");
686
687             testingTarget.EnableSelection = false;
688             Assert.AreEqual(false, testingTarget.EnableSelection, "Should be equal!");
689
690             testingTarget.Dispose();
691             tlog.Debug(tag, $"TextEditorEnableSelection END (OK)");
692         }
693
694         [Test]
695         [Category("P1")]
696         [Description("TextEditor EnableGrabHandle.")]
697         [Property("SPEC", "Tizen.NUI.TextEditor.EnableGrabHandle A")]
698         [Property("SPEC_URL", "-")]
699         [Property("CRITERIA", "CONSTR")]
700         [Property("AUTHOR", "bowon.ryu@samsung.com")]
701         public void TextEditorEnableGrabHandle()
702         {
703             tlog.Debug(tag, $"TextEditorEnableGrabHandle START");
704
705             var testingTarget = new TextEditor(true);
706             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
707             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
708
709             testingTarget.EnableGrabHandle = true;
710             Assert.AreEqual(true, testingTarget.EnableGrabHandle, "Should be equal!");
711
712             testingTarget.EnableGrabHandle = false;
713             Assert.AreEqual(false, testingTarget.EnableGrabHandle, "Should be equal!");
714
715             testingTarget.Dispose();
716             tlog.Debug(tag, $"TextEditorEnableGrabHandle END (OK)");
717         }
718
719         [Test]
720         [Category("P1")]
721         [Description("TextEditor EnableGrabHandlePopup.")]
722         [Property("SPEC", "Tizen.NUI.TextEditor.EnableGrabHandlePopup A")]
723         [Property("SPEC_URL", "-")]
724         [Property("CRITERIA", "CONSTR")]
725         [Property("AUTHOR", "bowon.ryu@samsung.com")]
726         public void TextEditorEnableGrabHandlePopup()
727         {
728             tlog.Debug(tag, $"TextEditorEnableGrabHandlePopup START");
729
730             var testingTarget = new TextEditor(true);
731             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
732             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
733
734             testingTarget.EnableGrabHandlePopup = true;
735             Assert.AreEqual(true, testingTarget.EnableGrabHandlePopup, "Should be equal!");
736
737             testingTarget.EnableGrabHandlePopup = false;
738             Assert.AreEqual(false, testingTarget.EnableGrabHandlePopup, "Should be equal!");
739
740             testingTarget.Dispose();
741             tlog.Debug(tag, $"TextEditorEnableGrabHandlePopup END (OK)");
742         }
743
744         [Test]
745         [Category("P1")]
746         [Description("TextEditor GrabHandleColor.")]
747         [Property("SPEC", "Tizen.NUI.TextEditor.GrabHandleColor A")]
748         [Property("SPEC_URL", "-")]
749         [Property("CRITERIA", "CONSTR")]
750         [Property("AUTHOR", "bowon.ryu@samsung.com")]
751         public void TextEditorGrabHandleColor()
752         {
753             tlog.Debug(tag, $"TextEditorGrabHandleColor START");
754
755             var testingTarget = new TextEditor(true);
756             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
757             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
758
759             testingTarget.GrabHandleColor = new Color(1.0f, 1.0f, 0.8f, 0.0f);
760             var color = new Color(1.0f, 1.0f, 0.8f, 0.0f);
761             Assert.AreEqual(true, CheckColor(color, testingTarget.GrabHandleColor), "Should be true!");
762
763             color.Dispose();
764             testingTarget.Dispose();
765             tlog.Debug(tag, $"TextEditorGrabHandleColor END (OK)");
766         }
767
768         [Test]
769         [Category("P1")]
770         [Description("TextEditor SelectText.")]
771         [Property("SPEC", "Tizen.NUI.TextEditor.SelectText M")]
772         [Property("SPEC_URL", "-")]
773         [Property("CRITERIA", "MR")]
774         [Property("AUTHOR", "bowon.ryu@samsung.com")]
775         public async Task TextEditorSelectText()
776         {
777             tlog.Debug(tag, $"TextEditorSelectText START");
778
779             var testingTarget = new TextEditor();
780             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
781             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
782
783             testingTarget.Text = "0123456789";
784             testingTarget.EnableSelection = true;
785             Window.Instance.GetDefaultLayer().Add(testingTarget);
786
787             testingTarget.SelectText(2, 6);
788             await Task.Delay(500);
789             Assert.AreEqual(testingTarget.SelectedText, "2345", "Should be equal!");
790             Assert.AreEqual(testingTarget.SelectedTextStart, 2, "Should be equal!");
791             Assert.AreEqual(testingTarget.SelectedTextEnd, 6, "Should be equal!");
792
793             tlog.Debug(tag, $"TextEditorSelectText END (OK)");
794         }
795
796         [Test]
797         [Category("P1")]
798         [Description("TextEditor SelectText.StartIndexException")]
799         [Property("SPEC", "Tizen.NUI.TextEditor.SelectText M")]
800         [Property("SPEC_URL", "-")]
801         [Property("CRITERIA", "MR")]
802         [Property("AUTHOR", "bowon.ryu@samsung.com")]
803         public async Task TextEditorSelectTextStartIndexException()
804         {
805             tlog.Debug(tag, $"TextEditorSelectTextStartIndexException START");
806
807             var testingTarget = new TextEditor();
808             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
809             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
810
811             testingTarget.Text = "0123456789";
812             testingTarget.EnableSelection = true;
813             Window.Instance.GetDefaultLayer().Add(testingTarget);
814
815             try
816             {
817                 testingTarget.SelectText(-1, 6);
818             }
819             catch (ArgumentOutOfRangeException e)
820             {
821                 tlog.Debug(tag, e.Message.ToString());
822                 Assert.Pass("Caught ArgumentOutOfRangeException: Passed!");
823                 tlog.Debug(tag, $"TextEditorSelectTextStartIndexException END (OK)");
824             }
825         }
826
827         [Test]
828         [Category("P1")]
829         [Description("TextEditor SelectText.EndIndexException")]
830         [Property("SPEC", "Tizen.NUI.TextEditor.SelectText M")]
831         [Property("SPEC_URL", "-")]
832         [Property("CRITERIA", "MR")]
833         [Property("AUTHOR", "bowon.ryu@samsung.com")]
834         public async Task TextEditorSelectTextEndIndexException()
835         {
836             tlog.Debug(tag, $"TextEditorSelectTextEndIndexException START");
837
838             var testingTarget = new TextEditor();
839             Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
840             Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
841
842             testingTarget.Text = "0123456789";
843             testingTarget.EnableSelection = true;
844             Window.Instance.GetDefaultLayer().Add(testingTarget);
845
846             try
847             {
848                 testingTarget.SelectText(1, -1);
849             }
850             catch (ArgumentOutOfRangeException e)
851             {
852                 tlog.Debug(tag, e.Message.ToString());
853                 Assert.Pass("Caught ArgumentOutOfRangeException: Passed!");
854                 tlog.Debug(tag, $"TextEditorSelectTextEndIndexException END (OK)");
855             }
856         }
857     }
858 }