[NUI] Add public theme TCs
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.TCT / testcase / public / Theme / TSExternalThemeKeyList.cs
1 using NUnit.Framework;
2 using System;
3 using Tizen.NUI.BaseComponents;
4 using Tizen.NUI.Components;
5
6 namespace Tizen.NUI.Devel.Tests
7 {
8     using tlog = Tizen.Log;
9
10     [TestFixture]
11     [Description("public/Theme/ExternalThemeKeyList")]
12     internal class PublicExternalThemeKeyListTest
13     {
14         private const string tag = "NUITEST";
15         private readonly object viewStyle;
16
17         [SetUp]
18         public void Init()
19         {
20             tlog.Info(tag, "Init() is called!");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             tlog.Info(tag, "Destroy() is called!");
27         }
28
29         [Test]
30         [Category("P1")]
31         [Description("Create a ExternalThemeKeyList object.")]
32         [Property("SPEC", "Tizen.NUI.ExternalThemeKeyList.ExternalThemeKeyList C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("COVPARAM", "")]
36         public void ExternalThemeKeyListConstructor()
37         {
38             tlog.Debug(tag, $"ExternalThemeKeyListConstructor START");
39
40             Type componentType = typeof(string);
41             Type styleType = typeof(string);
42             ExternalThemeKeyList a1 = new ExternalThemeKeyList(componentType, styleType);
43
44             tlog.Debug(tag, $"ExternalThemeKeyListConstructor END (OK)");
45             Assert.Pass("ExternalThemeKeyListConstructor");
46         }
47
48         [Test]
49         [Category("P1")]
50         [Description("ExternalThemeKeyList add")]
51         [Property("SPEC", "Tizen.NUI.ExternalThemeKeyList.add M")]
52         [Property("SPEC_URL", "-")]
53         [Property("CRITERIA", "MR")]
54         public void ExternalThemeKeyListadd()
55         {
56             tlog.Debug(tag, $"ExternalThemeKeyListadd START");
57
58             ExternalThemeKeyList keyList = new ExternalThemeKeyList(typeof(Button), typeof(ButtonStyle));
59
60             keyList.Add<Size>("/Size", (ViewStyle style, Size value) => style.Size = value);
61             tlog.Debug(tag, $"ExternalThemeKeyListadd END (OK)");
62             Assert.Pass("ExternalThemeKeyListadd");
63         }
64
65         [Test]
66         [Category("P1")]
67         [Description("ExternalThemeKeyList AddSelector")]
68         [Property("SPEC", "Tizen.NUI.ExternalThemeKeyList.AddSelector M")]
69         [Property("SPEC_URL", "-")]
70         [Property("CRITERIA", "MR")]
71         public void ExternalThemeKeyListAddSelector()
72         {
73             tlog.Debug(tag, $"ExternalThemeKeyListAddSelector START");
74
75             ExternalThemeKeyList keyList = new ExternalThemeKeyList(typeof(Button), typeof(ButtonStyle));
76
77             keyList.AddSelector<Color>("/Pickers/ItemTextLabel/TextColor", (ViewStyle style, Selector<Color> value) => ((TimePickerStyle)style).Pickers.ItemTextLabel.TextColor = value, ControlState.Selected);
78
79             tlog.Debug(tag, $"ExternalThemeKeyListAddSelector END (OK)");
80             Assert.Pass("ExternalThemeKeyListAddSelector");
81         }
82
83         [Test]
84         [Category("P1")]
85         [Description("ExternalThemeKeyList AddBackgroundSelector")]
86         [Property("SPEC", "Tizen.NUI.ExternalThemeKeyList.AddBackgroundSelector M")]
87         [Property("SPEC_URL", "-")]
88         [Property("CRITERIA", "MR")]
89         public void ExternalThemeKeyListAddBackgroundSelector()
90         {
91             tlog.Debug(tag, $"ExternalThemeKeyListAddBackgroundSelector START");
92
93             ExternalThemeKeyList keyList = new ExternalThemeKeyList(typeof(Button), typeof(ButtonStyle));
94
95             keyList.AddBackgroundSelector("/Background", mySetBackgroundColor, mySetBackgroundImage);
96
97             tlog.Debug(tag, $"ExternalThemeKeyListAddBackgroundSelector END (OK)");
98             Assert.Pass("ExternalThemeKeyListAddBackgroundSelector");
99         }
100
101         private static void mySetBackgroundColor(ViewStyle style, Selector<Color> value)
102         {
103             style.BackgroundColor = value;
104         }
105
106         private static void mySetBackgroundImage(ViewStyle style, Selector<string> value)
107         {
108             style.BackgroundImage = value;
109         }
110
111         //[Test]
112         //[Category("P1")]
113         //[Description("ExternalThemeKeyList ApplyKeyActions")]
114         //[Property("SPEC", "Tizen.NUI.ExternalThemeKeyList.ApplyKeyActions M")]
115         //[Property("SPEC_URL", "-")]
116         //[Property("CRITERIA", "MR")]
117         //public void ExternalThemeKeyListApplyKeyActions()
118         //{
119         //    tlog.Debug(tag, $"ExternalThemeKeyListApplyKeyActions START");
120
121         //    ExternalThemeKeyList keyList = new ExternalThemeKeyList(typeof(Button), typeof(ButtonStyle));
122
123         //    Tizen.Applications.ThemeManager.Theme theme();
124         //    TizenExternalTheme externalTheme = new TizenExternalTheme();
125         //    Theme theme = new Theme();
126         //    keyList.ApplyKeyActions(externalTheme, theme);
127
128         //    tlog.Debug(tag, $"ExternalThemeKeyListApplyKeyActions END (OK)");
129         //    Assert.Pass("ExternalThemeKeyListApplyKeyActions");
130         //}
131     }
132 }
133