3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
8 namespace Tizen.NUI.Devel.Tests
10 using tlog = Tizen.Log;
13 [Description("public/Theme/ThemeManager")]
14 internal class PublicThemeManagerTest
16 private const string tag = "NUITEST";
17 private string path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Test_Theme.xaml";
22 tlog.Info(tag, "Init() is called!");
28 tlog.Info(tag, "Destroy() is called!");
33 [Description("ThemeManager CurrentTheme.")]
34 [Property("SPEC", "Tizen.NUI.ThemeManager.CurrentTheme A")]
35 [Property("SPEC_URL", "-")]
36 [Property("CRITERIA", "PRW")]
37 [Property("COVPARAM", "")]
38 public void ThemeManagerCurrentTheme()
40 tlog.Debug(tag, $"ThemeManagerCurrentTheme START");
42 Theme theme = new Theme(path);
43 ThemeManager.CurrentTheme = theme;
44 tlog.Debug(tag, "CurrentTheme : " + ThemeManager.CurrentTheme);
46 tlog.Debug(tag, "ThemeId : " + ThemeManager.ThemeId);
47 tlog.Debug(tag, "BaseTheme : " + ThemeManager.BaseTheme);
49 tlog.Debug(tag, $"ThemeManagerCurrentTheme END (OK)");
54 [Description("ThemeManager PlatformThemeEnabled.")]
55 [Property("SPEC", "Tizen.NUI.ThemeManager.PlatformThemeEnabled A")]
56 [Property("SPEC_URL", "-")]
57 [Property("CRITERIA", "PRW")]
58 [Property("COVPARAM", "")]
59 public void ThemeManagerplatformThemeEnabled()
61 tlog.Debug(tag, $"ThemeManagerplatformThemeEnabled START");
63 ThemeManager.PlatformThemeEnabled = true;
64 tlog.Debug(tag, "PlatformThemeEnabled : " + ThemeManager.PlatformThemeEnabled);
66 var result = ThemeManager.ApplyPlatformTheme("Tizen.NUI.Theme.Common");
67 tlog.Debug(tag, "ApplyPlatformTheme : " + result);
68 tlog.Debug(tag, "GetPlatformStyle : " + ThemeManager.GetPlatformStyle("style"));
69 tlog.Debug(tag, "GetPlatformStyle : " + ThemeManager.GetPlatformStyle(typeof(ViewStyle)));
71 tlog.Debug(tag, $"ThemeManagerplatformThemeEnabled END (OK)");
76 [Description("Test ThemeManager ApplyTheme.")]
77 [Property("SPEC", "Tizen.NUI.ThemeManager.ApplyTheme M")]
78 [Property("SPEC_URL", "-")]
79 [Property("CRITERIA", "MR")]
80 [Property("COVPARAM", "")]
81 public void ThemeManagerApplyTheme()
83 tlog.Debug(tag, $"ThemeManagerApplyTheme START");
85 var testingTarget = new Theme(path);
86 Assert.IsNotNull(testingTarget, "should be not null");
87 Assert.IsInstanceOf<Theme>(testingTarget, "should be an instance of testing target class!");
91 ThemeManager.ApplyTheme(testingTarget);
95 tlog.Debug(tag, e.Message.ToString());
96 Assert.Fail("Caught Exception : Failed!");
99 tlog.Debug(tag, $"ThemeManagerApplyTheme END (OK)");
104 [Description("Test ThemeManager ApplyTheme.")]
105 [Property("SPEC", "Tizen.NUI.ThemeManager.ApplyTheme M")]
106 [Property("SPEC_URL", "-")]
107 [Property("CRITERIA", "MR")]
108 [Property("COVPARAM", "")]
109 public void ThemeManagerApplyThemeNullThemeId()
111 tlog.Debug(tag, $"ThemeManagerApplyThemeNullThemeId START");
113 var testingTarget = new Theme();
114 Assert.IsNotNull(testingTarget, "should be not null");
115 Assert.IsInstanceOf<Theme>(testingTarget, "should be an instance of testing target class!");
119 ThemeManager.ApplyTheme(testingTarget);
123 tlog.Debug(tag, e.Message.ToString());
124 Assert.Fail("Caught Exception : Failed!");
127 tlog.Debug(tag, $"ThemeManagerApplyThemeNullThemeId END (OK)");
132 [Description("Test ThemeManager GetStyle.")]
133 [Property("SPEC", "Tizen.NUI.ThemeManager.GetStyle M")]
134 [Property("SPEC_URL", "-")]
135 [Property("CRITERIA", "MR")]
136 [Property("COVPARAM", "")]
137 public void ThemeManagerGetStyle()
139 tlog.Debug(tag, $"ThemeManagerGetStyle START");
141 var testingTarget = new Theme(path);
142 Assert.IsNotNull(testingTarget, "should be not null");
143 Assert.IsInstanceOf<Theme>(testingTarget, "should be an instance of testing target class!");
145 ViewStyle style = new ViewStyle()
149 testingTarget.AddStyle("style", style);
150 ThemeManager.CurrentTheme = testingTarget;
152 tlog.Debug(tag, "GetStyle : " + ThemeManager.GetStyle("style"));
153 tlog.Debug(tag, "GetStyle : " + ThemeManager.GetStyle(typeof(View)));
154 tlog.Debug(tag, "GetUpdateStyleWithoutClone : " + ThemeManager.GetUpdateStyleWithoutClone("style"));
155 tlog.Debug(tag, "GetUpdateStyleWithoutClone : " + ThemeManager.GetUpdateStyleWithoutClone(typeof(ViewStyle)));
157 tlog.Debug(tag, $"ThemeManagerGetStyle END (OK)");
162 [Description("Test ThemeManager ApplyFallbackTheme.")]
163 [Property("SPEC", "Tizen.NUI.ThemeManager.ApplyFallbackTheme M")]
164 [Property("SPEC_URL", "-")]
165 [Property("CRITERIA", "MR")]
166 [Property("COVPARAM", "")]
167 public void ThemeManagerApplyFallbackTheme()
169 tlog.Debug(tag, $"ThemeManagerApplyFallbackTheme START");
171 var testingTarget = new Theme(path);
172 Assert.IsNotNull(testingTarget, "should be not null");
173 Assert.IsInstanceOf<Theme>(testingTarget, "should be an instance of testing target class!");
177 ThemeManager.ApplyFallbackTheme(testingTarget);
181 tlog.Debug(tag, e.Message.ToString());
182 Assert.Fail("Caught Exception : Failed!");
185 tlog.Debug(tag, $"ThemeManagerApplyFallbackTheme END (OK)");