1 using System.Threading.Tasks;
5 string format = string.Format("Current Tizen.System.SystemSettings.FontSize : {0}", (int)Tizen.System.SystemSettings.FontSize);
6 Tizen.Log.Debug("CS-SYSTEM-SETTING", format);
9 namespace SystemSettingsUnitTest
12 //[Description("Tizen.System.FontSizeChangedEventArgs Tests")]
13 public static class FontSizeChangedEventArgsTests
15 private static bool s_fontSizeSmallCallbackCalled = false;
18 //[Description("Check FontSizeChangedEventArgs Value property")]
19 //[Property("SPEC", "Tizen.System.FontSizeChangedEventArgs.Value A")]
20 //[Property("SPEC_URL", "-")]
21 //[Property("CRITERIA", "PRE")]
22 //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")]
23 public static async Task Value_ENUM_SMALL()
28 * 1. Assign event handler
30 Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedSmallValue;
32 SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize;
33 Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Small;
34 await Task.Delay(2000);
35 Assert.IsTrue(s_fontSizeSmallCallbackCalled, "Value_ENUM_SMALL: EventHandler added. Not getting called");
39 * 1. Reset callback called flag
40 * 2. Remove event handler
41 * 3. Reset property value
43 Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedSmallValue;
44 s_fontSizeSmallCallbackCalled = false;
45 Tizen.System.SystemSettings.FontSize = preValue;
48 private static void OnFontSizeChangedSmallValue(object sender, Tizen.System.FontSizeChangedEventArgs e)
50 s_fontSizeSmallCallbackCalled = true;
52 Assert.IsInstanceOf<Tizen.System.SystemSettingsFontSize>(e.Value, "OnFontSizeChangedSmallValue: FontSize not an instance of SystemSettingsFontSize");
53 Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Small, "OnFontSizeChangedSmallValue: The callback should receive the latest value for the property.");
56 private static bool s_fontSizeNormalCallbackCalled = false;
59 //[Description("Check FontSizeChangedEventArgs Value property")]
60 //[Property("SPEC", "Tizen.System.FontSizeChangedEventArgs.Value A")]
61 //[Property("SPEC_URL", "-")]
62 //[Property("CRITERIA", "PRE")]
63 //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")]
64 public static async Task Value_ENUM_NORMAL()
69 * 1. Assign event handler
71 Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedNormalValue;
73 SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize;
74 Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Normal;
75 await Task.Delay(2000);
76 Assert.IsTrue(s_fontSizeNormalCallbackCalled, "Value_ENUM_NORMAL: EventHandler added. Not getting called");
80 * 1. Reset callback called flag
81 * 2. Remove event handler
82 * 3. Reset property value
84 Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedNormalValue;
85 s_fontSizeNormalCallbackCalled = false;
86 Tizen.System.SystemSettings.FontSize = preValue;
89 private static void OnFontSizeChangedNormalValue(object sender, Tizen.System.FontSizeChangedEventArgs e)
91 s_fontSizeNormalCallbackCalled = true;
93 Assert.IsInstanceOf<Tizen.System.SystemSettingsFontSize>(e.Value, "OnFontSizeChangedNormalValue: FontSize not an instance of SystemSettingsFontSize");
94 Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Normal, "OnFontSizeChangedNormalValue: The callback should receive the latest value for the property.");
97 private static bool s_fontSizeLargeCallbackCalled = false;
100 //[Description("Check FontSizeChangedEventArgs Value property")]
101 //[Property("SPEC", "Tizen.System.FontSizeChangedEventArgs.Value A")]
102 //[Property("SPEC_URL", "-")]
103 //[Property("CRITERIA", "PRE")]
104 //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")]
105 public static async Task Value_ENUM_LARGE()
107 LogUtils.StartTest();
110 * 1. Assign event handler
112 Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedLargeValue;
114 SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize;
115 Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Large;
116 await Task.Delay(2000);
117 Assert.IsTrue(s_fontSizeLargeCallbackCalled, "Value_ENUM_LARGE: EventHandler added. Not getting called");
121 * 1. Reset callback called flag
122 * 2. Remove event handler
123 * 3. Reset property value
125 Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedLargeValue;
126 s_fontSizeLargeCallbackCalled = false;
127 Tizen.System.SystemSettings.FontSize = preValue;
130 private static void OnFontSizeChangedLargeValue(object sender, Tizen.System.FontSizeChangedEventArgs e)
132 s_fontSizeLargeCallbackCalled = true;
134 Assert.IsInstanceOf<Tizen.System.SystemSettingsFontSize>(e.Value, "OnFontSizeChangedLargeValue: FontSize not an instance of SystemSettingsFontSize");
135 Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Large, "OnFontSizeChangedLargeValue: The callback should receive the latest value for the property.");
138 private static bool s_fontSizeHugeCallbackCalled = false;
141 //[Description("Check FontSizeChangedEventArgs Value property")]
142 //[Property("SPEC", "Tizen.System.FontSizeChangedEventArgs.Value A")]
143 //[Property("SPEC_URL", "-")]
144 //[Property("CRITERIA", "PRE")]
145 //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")]
146 public static async Task Value_ENUM_HUGE()
148 LogUtils.StartTest();
151 * 1. Assign event handler
153 Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedHugeValue;
155 SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize;
156 Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Huge;
157 await Task.Delay(2000);
158 Assert.IsTrue(s_fontSizeHugeCallbackCalled, "Value_ENUM_HUGE: EventHandler added. Not getting called");
162 * 1. Reset callback called flag
163 * 2. Remove event handler
164 * 3. Reset property value
166 Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedHugeValue;
167 s_fontSizeHugeCallbackCalled = false;
168 Tizen.System.SystemSettings.FontSize = preValue;
171 private static void OnFontSizeChangedHugeValue(object sender, Tizen.System.FontSizeChangedEventArgs e)
173 s_fontSizeHugeCallbackCalled = true;
175 Assert.IsInstanceOf<Tizen.System.SystemSettingsFontSize>(e.Value, "OnFontSizeChangedHugeValue: FontSize not an instance of SystemSettingsFontSize");
176 Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Huge, "OnFontSizeChangedHugeValue: The callback should receive the latest value for the property.");
179 private static bool s_fontSizeGiantCallbackCalled = false;
182 //[Description("Check FontSizeChangedEventArgs Value property")]
183 //[Property("SPEC", "Tizen.System.FontSizeChangedEventArgs.Value A")]
184 //[Property("SPEC_URL", "-")]
185 //[Property("CRITERIA", "PRE")]
186 //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")]
187 public static async Task Value_ENUM_GIANT()
189 LogUtils.StartTest();
192 * 1. Assign event handler
194 Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedGiantValue;
196 SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize;
197 Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Giant;
198 await Task.Delay(2000);
199 Assert.IsTrue(s_fontSizeGiantCallbackCalled, "Value_ENUM_GIANT: EventHandler added. Not getting called");
203 * 1. Reset callback called flag
204 * 2. Remove event handler
205 * 3. Reset property value
207 Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedGiantValue;
208 s_fontSizeGiantCallbackCalled = false;
209 Tizen.System.SystemSettings.FontSize = preValue;
212 private static void OnFontSizeChangedGiantValue(object sender, Tizen.System.FontSizeChangedEventArgs e)
214 s_fontSizeGiantCallbackCalled = true;
216 Assert.IsInstanceOf<Tizen.System.SystemSettingsFontSize>(e.Value, "OnFontSizeChangedGiantValue: FontSize nto an instance of SystemSettingsFontSize");
217 Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Giant, "OnFontSizeChangedGiantValue: The callback should receive the latest value for the property.");