3 using NUnit.Framework.TUnit;
5 using Tizen.NUI.Components;
6 using Tizen.NUI.BaseComponents;
8 namespace Tizen.NUI.Components.Devel.Tests
10 using static Tizen.NUI.Components.Tab;
11 using tlog = Tizen.Log;
14 [Description("Controls/Tab")]
17 private const string tag = "NUITEST";
20 internal class MyTab : Tab
22 public MyTab() : base()
25 public void MyOnUpdate()
34 tlog.Info(tag, "Init() is called!");
40 tlog.Info(tag, "Destroy() is called!");
45 [Description("Tab contructor.")]
46 [Property("SPEC", "Tizen.NUI.Components.Tab.Tab C")]
47 [Property("SPEC_URL", "-")]
48 [Property("CRITERIA", "CONSTR")]
49 [Property("COVPARAM", "")]
50 [Property("AUTHOR", "guowei.wang@samsung.com")]
52 public void TabContructor()
54 tlog.Debug(tag, $"TabContructor START");
56 var testingTarget = new Tab();
57 Assert.IsNotNull(testingTarget, "null handle");
58 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
60 testingTarget.Dispose();
61 tlog.Debug(tag, $"TabContructor END (OK)");
66 [Description("Tab contructor.")]
67 [Property("SPEC", "Tizen.NUI.Components.Tab.Tab C")]
68 [Property("SPEC_URL", "-")]
69 [Property("CRITERIA", "CONSTR")]
70 [Property("COVPARAM", "")]
71 [Property("AUTHOR", "guowei.wang@samsung.com")]
73 public void TabContructorWithTabStyle()
75 tlog.Debug(tag, $"TabContructorWithTabStyle START");
77 TabStyle style = new TabStyle()
79 Size = new Size(100, 200),
82 var testingTarget = new Tab(style);
83 Assert.IsNotNull(testingTarget, "null handle");
84 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
86 testingTarget.Dispose();
87 tlog.Debug(tag, $"TabContructorWithTabStyle END (OK)");
92 [Description("Tab Underline.")]
93 [Property("SPEC", "Tizen.NUI.Components.Tab.Underline A")]
94 [Property("SPEC_URL", "-")]
95 [Property("CRITERIA", "PRW")]
96 [Property("COVPARAM", "")]
97 [Property("AUTHOR", "guowei.wang@samsung.com")]
99 public void TabUnderline()
101 tlog.Debug(tag, $"TabUnderline START");
103 using (View view = new View() { Size = new Size(2, 20) })
105 var testingTarget = new Tab();
106 Assert.IsNotNull(testingTarget, "null handle");
107 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
109 testingTarget.Underline = view;
110 tlog.Debug(tag, "Underline : " + testingTarget.Underline);
112 testingTarget.Dispose();
115 tlog.Debug(tag, $"TabUnderline END (OK)");
120 [Description("Tab SelectedItemIndex.")]
121 [Property("SPEC", "Tizen.NUI.Components.Tab.SelectedItemIndex A")]
122 [Property("SPEC_URL", "-")]
123 [Property("CRITERIA", "PRW")]
124 [Property("COVPARAM", "")]
125 [Property("AUTHOR", "guowei.wang@samsung.com")]
127 public void TabSelectedItemIndex()
129 tlog.Debug(tag, $"TabSelectedItemIndex START");
131 var testingTarget = new Tab();
132 Assert.IsNotNull(testingTarget, "null handle");
133 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
135 testingTarget.SelectedItemIndex = 1;
136 tlog.Debug(tag, "SelectedItemIndex : " + testingTarget.SelectedItemIndex);
138 testingTarget.Dispose();
139 tlog.Debug(tag, $"TabSelectedItemIndex END (OK)");
144 [Description("Tab UseTextNaturalSize.")]
145 [Property("SPEC", "Tizen.NUI.Components.Tab.UseTextNaturalSize A")]
146 [Property("SPEC_URL", "-")]
147 [Property("CRITERIA", "PRW")]
148 [Property("COVPARAM", "")]
149 [Property("AUTHOR", "guowei.wang@samsung.com")]
151 public void TabUseTextNaturalSize()
153 tlog.Debug(tag, $"TabUseTextNaturalSize START");
155 var testingTarget = new Tab();
156 Assert.IsNotNull(testingTarget, "null handle");
157 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
159 testingTarget.UseTextNaturalSize = true;
160 tlog.Debug(tag, "UseTextNaturalSize : " + testingTarget.UseTextNaturalSize);
162 testingTarget.UseTextNaturalSize = false;
163 tlog.Debug(tag, "UseTextNaturalSize : " + testingTarget.UseTextNaturalSize);
165 testingTarget.Dispose();
166 tlog.Debug(tag, $"TabUseTextNaturalSize END (OK)");
171 [Description("Tab ItemSpace.")]
172 [Property("SPEC", "Tizen.NUI.Components.Tab.ItemSpace A")]
173 [Property("SPEC_URL", "-")]
174 [Property("CRITERIA", "PRW")]
175 [Property("COVPARAM", "")]
176 [Property("AUTHOR", "guowei.wang@samsung.com")]
178 public void TabItemSpace()
180 tlog.Debug(tag, $"TabItemSpace START");
182 var testingTarget = new Tab();
183 Assert.IsNotNull(testingTarget, "null handle");
184 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
186 testingTarget.ItemSpace = 10;
187 tlog.Debug(tag, "ItemSpace : " + testingTarget.ItemSpace);
189 testingTarget.Dispose();
190 tlog.Debug(tag, $"TabItemSpace END (OK)");
195 [Description("Tab Space.")]
196 [Property("SPEC", "Tizen.NUI.Components.Tab.Space A")]
197 [Property("SPEC_URL", "-")]
198 [Property("CRITERIA", "PRW")]
199 [Property("COVPARAM", "")]
200 [Property("AUTHOR", "guowei.wang@samsung.com")]
202 public void TabSpace()
204 tlog.Debug(tag, $"TabSpace START");
206 var testingTarget = new Tab();
207 Assert.IsNotNull(testingTarget, "null handle");
208 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
210 testingTarget.Space = new Extents(4, 4, 4, 4);
211 tlog.Debug(tag, "Space : " + testingTarget.Space);
213 testingTarget.Dispose();
214 tlog.Debug(tag, $"TabSpace END (OK)");
219 [Description("Tab ItemPadding.")]
220 [Property("SPEC", "Tizen.NUI.Components.Tab.ItemPadding A")]
221 [Property("SPEC_URL", "-")]
222 [Property("CRITERIA", "PRW")]
223 [Property("COVPARAM", "")]
224 [Property("AUTHOR", "guowei.wang@samsung.com")]
226 public void TabItemPadding()
228 tlog.Debug(tag, $"TabItemPadding START");
230 var testingTarget = new Tab();
231 Assert.IsNotNull(testingTarget, "null handle");
232 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
234 testingTarget.ItemPadding = new Extents(4, 4, 4, 4);
235 tlog.Debug(tag, "ItemPadding : " + testingTarget.ItemPadding);
237 testingTarget.Dispose();
238 tlog.Debug(tag, $"TabItemPadding END (OK)");
243 [Description("Tab UnderLineSize.")]
244 [Property("SPEC", "Tizen.NUI.Components.Tab.UnderLineSize A")]
245 [Property("SPEC_URL", "-")]
246 [Property("CRITERIA", "PRW")]
247 [Property("COVPARAM", "")]
248 [Property("AUTHOR", "guowei.wang@samsung.com")]
250 public void TabUnderLineSize()
252 tlog.Debug(tag, $"TabUnderLineSize START");
254 var testingTarget = new Tab();
255 Assert.IsNotNull(testingTarget, "null handle");
256 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
258 testingTarget.UnderLineSize = new Size(10, 20);
259 tlog.Debug(tag, "UnderLineSize : " + testingTarget.UnderLineSize);
261 testingTarget.Dispose();
262 tlog.Debug(tag, $"TabUnderLineSize END (OK)");
267 [Description("Tab UnderLineBackgroundColor.")]
268 [Property("SPEC", "Tizen.NUI.Components.Tab.UnderLineBackgroundColor A")]
269 [Property("SPEC_URL", "-")]
270 [Property("CRITERIA", "PRW")]
271 [Property("COVPARAM", "")]
272 [Property("AUTHOR", "guowei.wang@samsung.com")]
274 public void TabUnderLineBackgroundColor()
276 tlog.Debug(tag, $"TabUnderLineBackgroundColor START");
278 var testingTarget = new Tab();
279 Assert.IsNotNull(testingTarget, "null handle");
280 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
282 testingTarget.UnderLineBackgroundColor = Color.Red;
283 tlog.Debug(tag, "UnderLineBackgroundColor : " + testingTarget.UnderLineBackgroundColor);
285 testingTarget.Dispose();
286 tlog.Debug(tag, $"TabUnderLineBackgroundColor END (OK)");
291 [Description("Tab PointSize.")]
292 [Property("SPEC", "Tizen.NUI.Components.Tab.PointSize A")]
293 [Property("SPEC_URL", "-")]
294 [Property("CRITERIA", "PRW")]
295 [Property("COVPARAM", "")]
296 [Property("AUTHOR", "guowei.wang@samsung.com")]
298 public void TabPointSize()
300 tlog.Debug(tag, $"TabPointSize START");
302 var testingTarget = new Tab();
303 Assert.IsNotNull(testingTarget, "null handle");
304 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
306 testingTarget.PointSize = 0.3f;
307 tlog.Debug(tag, "PointSize : " + testingTarget.PointSize);
309 testingTarget.Dispose();
310 tlog.Debug(tag, $"TabPointSize END (OK)");
315 [Description("Tab FontFamily.")]
316 [Property("SPEC", "Tizen.NUI.Components.Tab.FontFamily A")]
317 [Property("SPEC_URL", "-")]
318 [Property("CRITERIA", "PRW")]
319 [Property("COVPARAM", "")]
320 [Property("AUTHOR", "guowei.wang@samsung.com")]
322 public void TabFontFamily()
324 tlog.Debug(tag, $"TabFontFamily START");
326 var testingTarget = new Tab();
327 Assert.IsNotNull(testingTarget, "null handle");
328 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
330 testingTarget.FontFamily = "BreezeSans";
331 tlog.Debug(tag, "FontFamily : " + testingTarget.FontFamily);
333 testingTarget.Dispose();
334 tlog.Debug(tag, $"TabFontFamily END (OK)");
339 [Description("Tab TextColor.")]
340 [Property("SPEC", "Tizen.NUI.Components.Tab.TextColor A")]
341 [Property("SPEC_URL", "-")]
342 [Property("CRITERIA", "PRW")]
343 [Property("COVPARAM", "")]
344 [Property("AUTHOR", "guowei.wang@samsung.com")]
346 public void TabTextColor()
348 tlog.Debug(tag, $"TabTextColor START");
350 var testingTarget = new Tab();
351 Assert.IsNotNull(testingTarget, "null handle");
352 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
354 testingTarget.TextColor = Color.Green;
355 tlog.Debug(tag, "TextColor : " + testingTarget.TextColor);
357 testingTarget.Dispose();
358 tlog.Debug(tag, $"TabTextColor END (OK)");
363 [Description("Tab TextColorSelector.")]
364 [Property("SPEC", "Tizen.NUI.Components.Tab.TextColorSelector A")]
365 [Property("SPEC_URL", "-")]
366 [Property("CRITERIA", "PRW")]
367 [Property("COVPARAM", "")]
368 [Property("AUTHOR", "guowei.wang@samsung.com")]
370 public void TabTextColorSelector()
372 tlog.Debug(tag, $"TabTextColorSelector START");
374 var testingTarget = new Tab();
375 Assert.IsNotNull(testingTarget, "null handle");
376 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
378 var textColorSelector = new ColorSelector();
379 textColorSelector.Add(ControlState.All, Color.Cyan);
380 testingTarget.TextColorSelector = textColorSelector;
381 tlog.Debug(tag, "TextColorSelector : " + testingTarget.TextColorSelector);
383 testingTarget.Dispose();
384 tlog.Debug(tag, $"TabTextColorSelector END (OK)");
389 [Description("Tab TextColorSelector.")]
390 [Property("SPEC", "Tizen.NUI.Components.Tab.TextColorSelector A")]
391 [Property("SPEC_URL", "-")]
392 [Property("CRITERIA", "PRW")]
393 [Property("COVPARAM", "")]
394 [Property("AUTHOR", "guowei.wang@samsung.com")]
396 public void TabTextColorSelectorNullReferenceException()
398 tlog.Debug(tag, $"TabTextColorSelectorNullReferenceException START");
400 var testingTarget = new Tab();
401 Assert.IsNotNull(testingTarget, "null handle");
402 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
406 ColorSelector textColorSelector = null;
407 testingTarget.TextColorSelector = textColorSelector;
409 catch (NullReferenceException)
411 testingTarget.Dispose();
412 tlog.Debug(tag, $"TabTextColorSelectorNullReferenceException END (OK)");
413 Assert.Pass("Caught NullReferenceException : Passed!");
419 [Description("Tab AddItem.")]
420 [Property("SPEC", "Tizen.NUI.Components.Tab.AddItem M")]
421 [Property("SPEC_URL", "-")]
422 [Property("CRITERIA", "MR")]
423 [Property("COVPARAM", "")]
424 [Property("AUTHOR", "guowei.wang@samsung.com")]
426 public void TabAddItem()
428 tlog.Debug(tag, $"TabAddItem START");
430 var testingTarget = new Tab();
431 Assert.IsNotNull(testingTarget, "null handle");
432 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
436 TabItemData item1 = new TabItemData();
437 testingTarget.AddItem(item1);
438 TabItemData item2 = new TabItemData();
439 testingTarget.InsertItem(item2, 1);
441 testingTarget.SelectedItemIndex = 1;
445 testingTarget.DeleteItem(0);
449 tlog.Debug(tag, e.Message.ToString());
450 Assert.Fail("Caught Exception : Failed!");
455 tlog.Debug(tag, e.Message.ToString());
456 Assert.Fail("Caught Exception : Failed!");
459 testingTarget.Dispose();
460 tlog.Debug(tag, $"TabAddItem END (OK)");
465 [Description("Tab Style.")]
466 [Property("SPEC", "Tizen.NUI.Components.Tab.Style M")]
467 [Property("SPEC_URL", "-")]
468 [Property("CRITERIA", "MR")]
469 [Property("COVPARAM", "")]
470 [Property("AUTHOR", "guowei.wang@samsung.com")]
472 public void TabStyle()
474 tlog.Debug(tag, $"TabStyle START");
476 var testingTarget = new Tab();
477 Assert.IsNotNull(testingTarget, "null handle");
478 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
480 var result = testingTarget.Style;
481 tlog.Debug(tag, "Style : " + result);
483 testingTarget.Dispose();
484 tlog.Debug(tag, $"TabStyle END (OK)");
489 [Description("Tab OnUpdate.")]
490 [Property("SPEC", "Tizen.NUI.Components.Tab.OnUpdate M")]
491 [Property("SPEC_URL", "-")]
492 [Property("CRITERIA", "MR")]
493 [Property("COVPARAM", "")]
494 [Property("AUTHOR", "guowei.wang@samsung.com")]
496 public void TabOnUpdate()
498 tlog.Debug(tag, $"TabOnUpdate START");
500 var testingTarget = new MyTab()
502 LayoutDirection = ViewLayoutDirectionType.RTL,
503 UseTextNaturalSize = true,
505 Assert.IsNotNull(testingTarget, "null handle");
506 Assert.IsInstanceOf<Tab>(testingTarget, "Should return Tab instance.");
510 testingTarget.MyOnUpdate();
514 tlog.Debug(tag, e.Message.ToString());
515 Assert.Fail("Caught Exception : Failed!");
518 testingTarget.Dispose();
519 tlog.Debug(tag, $"TabOnUpdate END (OK)");