1 using System.Threading.Tasks;
3 using System.Threading;
7 namespace SystemSettingsUnitTest
10 //[Description("Tizen.System.LocaleTimeFormat24HourSettingChangedEventArgs Tests")]
11 public static class LocaleTimeFormat24HourSettingChangedEventArgsTests
13 private static bool s_timeFormatCallbackCalled = false;
14 private static readonly bool s_localeTimeformat24HourValue = !Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled;
17 //[Description("Check LocaleTimeFormat24HourSettingChangedEventArgs Value property")]
18 //[Property("SPEC", "Tizen.System.LocaleTimeFormat24HourSettingChangedEventArgs.Value A")]
19 //[Property("SPEC_URL", "-")]
20 //[Property("CRITERIA", "PRO")]
21 //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")]
22 public static async Task Value_PROPERTY_READ_ONLY()
27 * 1. Assign event handler
29 Tizen.System.SystemSettings.LocaleTimeFormat24HourSettingChanged += OnLocaleTimeformat24HourChangedValue;
31 bool preValue = Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled;
32 Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled = s_localeTimeformat24HourValue;
33 await Task.Delay(2000);
34 Assert.IsTrue(s_timeFormatCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called");
38 * 1. Reset callback called flag
39 * 2. Remove event handler
40 * 3. Reset property value
42 s_timeFormatCallbackCalled = false;
43 Tizen.System.SystemSettings.LocaleTimeFormat24HourSettingChanged -= OnLocaleTimeformat24HourChangedValue;
44 Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled = preValue;
48 private static void OnLocaleTimeformat24HourChangedValue(object sender, Tizen.System.LocaleTimeFormat24HourSettingChangedEventArgs e)
50 s_timeFormatCallbackCalled = true;
52 Assert.IsInstanceOf<bool>(e.Value, "OnLocaleTimeformat24HourChangedValue: LocaleTimeFormat24HourEnabled not an instance of bool");
53 Assert.IsTrue(e.Value == s_localeTimeformat24HourValue, "OnLocaleTimeformat24HourChangedValue: The callback should receive the latest value for the property.");