From: JinWang An <35290168+jinwangan@users.noreply.github.com> Date: Thu, 24 Jan 2019 05:32:53 +0000 (+0900) Subject: [SystemSettings] Add SystemSettings.UnitTest (#679) X-Git-Tag: submit/tizen/20190125.000716~1^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d47567f77d5c9bb75a39917fce2a0634debe5229;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [SystemSettings] Add SystemSettings.UnitTest (#679) Signed-off-by: jinwang.an --- diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest.sln b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest.sln new file mode 100755 index 000000000..1ca2a8010 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2019 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SystemSettings.UnitTest", "SystemSettings.UnitTest\SystemSettings.UnitTest.csproj", "{CB9C4A03-165F-47E6-8007-169CF17C3D9D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CB9C4A03-165F-47E6-8007-169CF17C3D9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB9C4A03-165F-47E6-8007-169CF17C3D9D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB9C4A03-165F-47E6-8007-169CF17C3D9D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB9C4A03-165F-47E6-8007-169CF17C3D9D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EC4A7C87-EE6B-4112-9353-847F68166A22} + EndGlobalSection +EndGlobal diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/SystemSettings.UnitTest.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/SystemSettings.UnitTest.cs new file mode 100755 index 000000000..b348ae758 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/SystemSettings.UnitTest.cs @@ -0,0 +1,66 @@ +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using System.Threading.Tasks; +using Tizen; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + class Program : NUIApplication + { + protected override void OnCreate() + { + base.OnCreate(); + SystemSettingsTests.TestAllAsync(); + Initialize(); + } + + public static void PrintOkFuncName(String str_in) + { + String func_name = str_in.ToString(); + String[] parse_func = func_name.Split(' '); + Console.WriteLine(parse_func[1] + " >>>>>> ok"); + + } + + void Initialize() + { + Window.Instance.KeyEvent += OnKeyEvent; + TextLabel text = new TextLabel("SystemSettings Unit Test"); + text.HorizontalAlignment = HorizontalAlignment.Center; + text.VerticalAlignment = VerticalAlignment.Center; + text.TextColor = Color.Blue; + text.PointSize = 12.0f; + text.HeightResizePolicy = ResizePolicyType.FillToParent; + text.WidthResizePolicy = ResizePolicyType.FillToParent; + Window.Instance.GetDefaultLayer().Add(text); + + /* + Animation animation = new Animation(2000); + animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 200, 500); + animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000); + animation.Looping = true; + animation.Play(); + */ + + } + + public void OnKeyEvent(object sender, Window.KeyEventArgs e) + { + if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape")) + { + Exit(); + } + } + + static void Main(string[] args) + { + + var app = new Program(); + app.Run(args); + + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/SystemSettings.UnitTest.csproj b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/SystemSettings.UnitTest.csproj new file mode 100755 index 000000000..ac3af6788 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/SystemSettings.UnitTest.csproj @@ -0,0 +1,28 @@ + + + + Exe + netcoreapp2.0 + + + + portable + + + None + + + + + + + + + + Runtime + + + + + + diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-143802/Session.cps b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-143802/Session.cps new file mode 100755 index 000000000..7ba55d935 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-143802/Session.cps @@ -0,0 +1,10 @@ + + + + + diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-153950/Session.cps b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-153950/Session.cps new file mode 100755 index 000000000..3fc336353 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-153950/Session.cps @@ -0,0 +1,10 @@ + + + + + diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-154041/Session.cps b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-154041/Session.cps new file mode 100755 index 000000000..dc4d49234 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-154041/Session.cps @@ -0,0 +1,10 @@ + + + + + diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-163018/Session.cps b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-163018/Session.cps new file mode 100755 index 000000000..768c9019c --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190102-163018/Session.cps @@ -0,0 +1,10 @@ + + + + + diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190118-165948/Session.cps b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190118-165948/Session.cps new file mode 100755 index 000000000..5278639b7 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190118-165948/Session.cps @@ -0,0 +1,10 @@ + + + + + diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190118-170030/Session.cps b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190118-170030/Session.cps new file mode 100755 index 000000000..c519ba854 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190118-170030/Session.cps @@ -0,0 +1,10 @@ + + + + + diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190118-170105/Session.cps b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190118-170105/Session.cps new file mode 100755 index 000000000..a0ad3afc6 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/TizenProfiler/DotNET-20190118-170105/Session.cps @@ -0,0 +1,10 @@ + + + + + diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/copy_binary.bat b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/copy_binary.bat new file mode 100755 index 000000000..418442890 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/copy_binary.bat @@ -0,0 +1 @@ +copy D:\programming\C#\SystemSettings_UnitTest\SystemSettings.UnitTest\bin\Debug\netcoreapp2.0\org.tizen.example.SystemSettings.UnitTest-1.0.0.tpk W:\temp \ No newline at end of file diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/shared/res/SystemSettings_UnitTest.png b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/shared/res/SystemSettings_UnitTest.png new file mode 100755 index 000000000..9f3cb9860 Binary files /dev/null and b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/shared/res/SystemSettings_UnitTest.png differ diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/Assert.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/Assert.cs new file mode 100755 index 000000000..86902bdf9 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/Assert.cs @@ -0,0 +1,199 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + + +namespace SystemSettingsUnitTest +{ + public class Assert + { + static public string result; + static public string errorMessage; + + public Assert() + { + result = StrUtils.INIT; + errorMessage = null; + } + + static internal void SetExceptionMessage(Exception exception) + { + string errMessage = "Exception: " + exception.Message + Environment.NewLine; + errMessage += " Trace: " + exception.StackTrace + Environment.NewLine; + Fail(errMessage); + } + + static public void Pass() + { + // If it was marked Failed before, keep the result fail. + if (result != StrUtils.FAIL) result = StrUtils.PASS; + } + + static public void Fail(string message) + { + result = StrUtils.FAIL; + // To remember message from first failure + if (errorMessage == null) errorMessage = message; + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "  " + message); + } + + static public void Init() + { + result = StrUtils.INIT; + errorMessage = null; + } + + static public string GetResult() + { + return result; + } + + static public void True(bool condition, string message = "Expects true, but got false.") + { + if (condition == true) Pass(); else Fail(message); + } + + static public void IsTrue(bool condition, string message = "Expects true, but got false.") + { + if (condition == true) Pass(); else Fail(message); + } + + static public void False(bool condition, string message = "Expects false, but got true.") + { + if (condition == false) Pass(); else Fail(message); + } + + static public void IsFalse(bool condition, string message = "Expects false, but got true.") + { + if (condition == false) Pass(); else Fail(message); + } + + static public void AreEqual(T expected, T actual, string message = "Expects given values to be equal, but given values are not.") + { + if (EqualityComparer.Default.Equals(expected, actual)) Pass(); else Fail(message); + } + + static public void AreNotEqual(T expected, T actual, string message = "Expects given values to be unequal, but given values are identical.") + { + if (!EqualityComparer.Default.Equals(expected, actual)) Pass(); else Fail(message); + } + + static public void NotNull(object anObject, string message = "Given object is not null.") + { + if (anObject != null) Pass(); else Fail(message); + } + + static public void IsNull(object anObject, string message = "Given object is not null.") + { + if (anObject == null) Pass(); else Fail(message); + } + + static public void IsNotNull(object anObject, string message = "Given object is null.") + { + if (anObject != null) Pass(); else Fail(message); + } + + static public void IsA(object actual, string message = "Given object is NOT an instance of specified type.") + { + if (actual is T) Pass(); else Fail(message); + } + + static public void IsInstanceOf(object actual, string message = "Given object is NOT an instance of specified type.") + { + if (actual.GetType() == typeof(T)) Pass(); else Fail(message); + } + + static public void Greater(T actual, T expected, string message) where T : IComparable + { + if (actual.CompareTo(expected) > 0) Pass(); else Fail(message); + } + + static public void Smaller(T actual, T expected, string message) where T : IComparable + { + if (actual.CompareTo(expected) < 0) Pass(); else Fail(message); + } + + static public void IsNotEmpty(IEnumerable collection, string message) + { + foreach(object item in collection) + { + Pass(); + return; + } + + Fail(message); + } + } + + public class StrUtils + { + static public string PASS = "PASS"; + static public string FAIL = "FAIL"; + static public string INIT = "INIT"; + } + + public class LogUtils + { + // write with white font + static public string DEBUG = "D"; + + // write with blue font + static public string INFO = "I"; + + // write with red font + static public string ERROR = "E"; + + static public string TAG = "CS-SYSTEM-SETTINGS"; + + static public int ok_cnt = 0; + static public int chk_cnt = 0; + static public int not_support_cnt = 0; + + static public void Write(string level, string tag, string msg) + { + foreach (string line in msg.Split('\n')) + { + Tizen.Log.Debug(TAG, line); + } + + //if (level == INFO) + // Console.ForegroundColor = ConsoleColor.Blue; + //else if (level == DEBUG) + // Console.ForegroundColor = ConsoleColor.White; + //else if (level == ERROR) + // Console.ForegroundColor = ConsoleColor.Red; + + //Console.WriteLine(tag + " : [" + level + "] | " + msg); + //Console.ResetColor(); + } + static public void initWriteResult() + { + ok_cnt = 0; + chk_cnt = 0; + not_support_cnt = 0; + + } + + static public void StartTest() + { + chk_cnt++; + } + + static public void NotSupport() + { + not_support_cnt++; + } + + static public void WriteOK([CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Tizen.Log.Debug(TAG, "ok",file, func, line); + ok_cnt++; + } + static public void WriteResult() + { + Tizen.Log.Debug(TAG, "Result : " + ok_cnt + " Pass / " + not_support_cnt + " Not Support / " + (chk_cnt - (ok_cnt + not_support_cnt)) + " Failed"); + } + + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSData3GNetworkSettingChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSData3GNetworkSettingChangedEventArgs.cs new file mode 100755 index 000000000..7a19d0bff --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSData3GNetworkSettingChangedEventArgs.cs @@ -0,0 +1,55 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.Data3GNetworkSettingChangedEventArgs Tests")] + public static class Data3GNetworkSettingChangedEventArgsTests + { + private static bool s_data3GNetworkCallbackCalled = false; + private static bool s_data3GNetworkSettingValue = !Tizen.System.SystemSettings.Data3GNetworkEnabled; + ////[Test] + //[Category("P1")] + //[Description("Check Data3GNetworkSettingChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.Data3GNetworkSettingChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.Data3GNetworkSettingChanged += OnData3GNetworkSettingChangedValue; + + bool preValue = Tizen.System.SystemSettings.Data3GNetworkEnabled; + Tizen.System.SystemSettings.Data3GNetworkEnabled = s_data3GNetworkSettingValue; + await Task.Delay(2000); + Assert.IsTrue(s_data3GNetworkCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_data3GNetworkCallbackCalled = false; + Tizen.System.SystemSettings.Data3GNetworkSettingChanged -= OnData3GNetworkSettingChangedValue; + Tizen.System.SystemSettings.Data3GNetworkEnabled = preValue; + LogUtils.WriteOK(); + } + private static void OnData3GNetworkSettingChangedValue(object sender, Tizen.System.Data3GNetworkSettingChangedEventArgs e) + { + s_data3GNetworkCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnData3GNetworkSettingChangedValue: Data3GNetworkEnabled not an instance of bool"); + Assert.IsTrue(e.Value == s_data3GNetworkSettingValue, "OnData3GNetworkSettingChanged: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSEmailAlertRingtoneChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSEmailAlertRingtoneChangedEventArgs.cs new file mode 100755 index 000000000..c9a7ccfa4 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSEmailAlertRingtoneChangedEventArgs.cs @@ -0,0 +1,64 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.EmailAlertRingtoneChangedEventArgs Tests")] + public static class EmailAlertRingtoneChangedEventArgsTests + { + private static bool s_emailAlertRingtoneCallbackCalled = false; + private static readonly string s_emailAlertRingtoneValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.EmailAlertRingtone); + ////[Test] + //[Category("P1")] + //[Description("Check EmailAlertRingtoneChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.EmailAlertRingtoneChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + try { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.EmailAlertRingtoneChanged += OnEmailAlertRingtoneChangedValue; + + string preValue = Tizen.System.SystemSettings.EmailAlertRingtone; + Tizen.System.SystemSettings.EmailAlertRingtone = s_emailAlertRingtoneValue; + await Task.Delay(2000); + Assert.IsTrue(s_emailAlertRingtoneCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_emailAlertRingtoneCallbackCalled = false; + Tizen.System.SystemSettings.EmailAlertRingtoneChanged -= OnEmailAlertRingtoneChangedValue; + Tizen.System.SystemSettings.EmailAlertRingtone = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.notification_email", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.notification_email)"); + LogUtils.NotSupport(); + } + } + private static void OnEmailAlertRingtoneChangedValue(object sender, Tizen.System.EmailAlertRingtoneChangedEventArgs e) + { + s_emailAlertRingtoneCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnEmailAlertRingtoneChangedValue: EmailAlertRingtone not an instance of string"); + Assert.IsTrue(s_emailAlertRingtoneValue.CompareTo(e.Value) == 0, "OnEmailAlertRingtoneChanged: The callback should receive the latest value for the property."); + } + + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSFontSizeChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSFontSizeChangedEventArgs.cs new file mode 100755 index 000000000..9def29136 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSFontSizeChangedEventArgs.cs @@ -0,0 +1,223 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + +/* +string format = string.Format("Current Tizen.System.SystemSettings.FontSize : {0}", (int)Tizen.System.SystemSettings.FontSize); +Tizen.Log.Debug("CS-SYSTEM-SETTING", format); +*/ + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.FontSizeChangedEventArgs Tests")] + public static class FontSizeChangedEventArgsTests + { + private static bool s_fontSizeSmallCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check FontSizeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.FontSizeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRE")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_ENUM_SMALL() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedSmallValue; + + SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Small; + await Task.Delay(2000); + Assert.IsTrue(s_fontSizeSmallCallbackCalled, "Value_ENUM_SMALL: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedSmallValue; + s_fontSizeSmallCallbackCalled = false; + Tizen.System.SystemSettings.FontSize = preValue; + LogUtils.WriteOK(); + } + private static void OnFontSizeChangedSmallValue(object sender, Tizen.System.FontSizeChangedEventArgs e) + { + s_fontSizeSmallCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnFontSizeChangedSmallValue: FontSize not an instance of SystemSettingsFontSize"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Small, "OnFontSizeChangedSmallValue: The callback should receive the latest value for the property."); + } + + private static bool s_fontSizeNormalCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check FontSizeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.FontSizeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRE")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_ENUM_NORMAL() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedNormalValue; + + SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Normal; + await Task.Delay(2000); + Assert.IsTrue(s_fontSizeNormalCallbackCalled, "Value_ENUM_NORMAL: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedNormalValue; + s_fontSizeNormalCallbackCalled = false; + Tizen.System.SystemSettings.FontSize = preValue; + LogUtils.WriteOK(); + } + private static void OnFontSizeChangedNormalValue(object sender, Tizen.System.FontSizeChangedEventArgs e) + { + s_fontSizeNormalCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnFontSizeChangedNormalValue: FontSize not an instance of SystemSettingsFontSize"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Normal, "OnFontSizeChangedNormalValue: The callback should receive the latest value for the property."); + } + + private static bool s_fontSizeLargeCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check FontSizeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.FontSizeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRE")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_ENUM_LARGE() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedLargeValue; + + SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Large; + await Task.Delay(2000); + Assert.IsTrue(s_fontSizeLargeCallbackCalled, "Value_ENUM_LARGE: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedLargeValue; + s_fontSizeLargeCallbackCalled = false; + Tizen.System.SystemSettings.FontSize = preValue; + LogUtils.WriteOK(); + } + private static void OnFontSizeChangedLargeValue(object sender, Tizen.System.FontSizeChangedEventArgs e) + { + s_fontSizeLargeCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnFontSizeChangedLargeValue: FontSize not an instance of SystemSettingsFontSize"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Large, "OnFontSizeChangedLargeValue: The callback should receive the latest value for the property."); + } + + private static bool s_fontSizeHugeCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check FontSizeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.FontSizeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRE")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_ENUM_HUGE() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedHugeValue; + + SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Huge; + await Task.Delay(2000); + Assert.IsTrue(s_fontSizeHugeCallbackCalled, "Value_ENUM_HUGE: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedHugeValue; + s_fontSizeHugeCallbackCalled = false; + Tizen.System.SystemSettings.FontSize = preValue; + LogUtils.WriteOK(); + } + private static void OnFontSizeChangedHugeValue(object sender, Tizen.System.FontSizeChangedEventArgs e) + { + s_fontSizeHugeCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnFontSizeChangedHugeValue: FontSize not an instance of SystemSettingsFontSize"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Huge, "OnFontSizeChangedHugeValue: The callback should receive the latest value for the property."); + } + + private static bool s_fontSizeGiantCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check FontSizeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.FontSizeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRE")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_ENUM_GIANT() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedGiantValue; + + SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Giant; + await Task.Delay(2000); + Assert.IsTrue(s_fontSizeGiantCallbackCalled, "Value_ENUM_GIANT: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedGiantValue; + s_fontSizeGiantCallbackCalled = false; + Tizen.System.SystemSettings.FontSize = preValue; + LogUtils.WriteOK(); + } + private static void OnFontSizeChangedGiantValue(object sender, Tizen.System.FontSizeChangedEventArgs e) + { + s_fontSizeGiantCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnFontSizeChangedGiantValue: FontSize nto an instance of SystemSettingsFontSize"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Giant, "OnFontSizeChangedGiantValue: The callback should receive the latest value for the property."); + } + + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSFontTypeChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSFontTypeChangedEventArgs.cs new file mode 100755 index 000000000..934ffc42d --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSFontTypeChangedEventArgs.cs @@ -0,0 +1,55 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.FontTypeChangedEventArgs Tests")] + public static class FontTypeChangedEventArgsTests + { + private static bool s_fontTypeCallbackCalled = false; + private static readonly string s_fontTypeValue = "BreezeSans"; + ////[Test] + //[Category("P1")] + //[Description("Check FontTypeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.FontTypeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.FontTypeChanged += OnFontTypeChangedValue; + + string preValue = Tizen.System.SystemSettings.FontType; + Tizen.System.SystemSettings.FontType = s_fontTypeValue; + await Task.Delay(2000); + Assert.IsTrue(s_fontTypeCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_fontTypeCallbackCalled = false; + Tizen.System.SystemSettings.FontTypeChanged -= OnFontTypeChangedValue; + Tizen.System.SystemSettings.FontType = preValue; + LogUtils.WriteOK(); + } + private static void OnFontTypeChangedValue(object sender, Tizen.System.FontTypeChangedEventArgs e) + { + s_fontTypeCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnFontTypeChangedValue: FontType not an instance of string"); + Assert.IsTrue(s_fontTypeValue.CompareTo(e.Value) == 0, "OnFontTypeChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSIncomingCallRingtoneChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSIncomingCallRingtoneChangedEventArgs.cs new file mode 100755 index 000000000..c5e0e5108 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSIncomingCallRingtoneChangedEventArgs.cs @@ -0,0 +1,63 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.IncomingCallRingtoneChangedEventArgs Tests")] + public static class IncomingCallRingtoneChangedEventArgsTests + { + private static bool s_incomingCallRingtoneCallbackCalled = false; + private static readonly string s_incomingCallRingtoneValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.IncomingCallRingtone); + ////[Test] + //[Category("P1")] + //[Description("Check IncomingCallRingtoneChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.IncomingCallRingtoneChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + try { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.IncomingCallRingtoneChanged += OnIncomingCallRingtoneChangedValue; + + string preValue = Tizen.System.SystemSettings.IncomingCallRingtone; + Tizen.System.SystemSettings.IncomingCallRingtone = s_incomingCallRingtoneValue; + await Task.Delay(2000); + Assert.IsTrue(s_incomingCallRingtoneCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_incomingCallRingtoneCallbackCalled = false; + Tizen.System.SystemSettings.IncomingCallRingtoneChanged -= OnIncomingCallRingtoneChangedValue; + Tizen.System.SystemSettings.IncomingCallRingtone = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.incoming_call", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.incoming_call)"); + LogUtils.NotSupport(); + } + } + private static void OnIncomingCallRingtoneChangedValue(object sender, Tizen.System.IncomingCallRingtoneChangedEventArgs e) + { + s_incomingCallRingtoneCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnIncomingCallRingtoneChangedValue: IncomingCallRingtone not an instance of string"); + Assert.IsTrue(s_incomingCallRingtoneValue.CompareTo(e.Value) == 0, "OnIncomingCallRingtoneChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleCountryChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleCountryChangedEventArgs.cs new file mode 100755 index 000000000..cb3e03d80 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleCountryChangedEventArgs.cs @@ -0,0 +1,55 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.LocaleCountryChangedEventArgs Tests")] + public static class LocaleCountryChangedEventArgsTests + { + private static bool s_localeCountryCallbackCalled = false; + private static readonly string s_localeCountryValue = "en_US"; + ////[Test] + //[Category("P1")] + //[Description("Check LocaleCountryChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.LocaleCountryChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.LocaleCountryChanged += OnLocaleCountryChangedValue; + + string preValue = Tizen.System.SystemSettings.LocaleCountry; + Tizen.System.SystemSettings.LocaleCountry = s_localeCountryValue; + await Task.Delay(2000); + Assert.IsTrue(s_localeCountryCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_localeCountryCallbackCalled = false; + Tizen.System.SystemSettings.LocaleCountryChanged -= OnLocaleCountryChangedValue; + Tizen.System.SystemSettings.LocaleCountry = preValue; + LogUtils.WriteOK(); + } + private static void OnLocaleCountryChangedValue(object sender, Tizen.System.LocaleCountryChangedEventArgs e) + { + s_localeCountryCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnLocaleCountryChangedValue: LocaleCountry not an instance of string"); + Assert.IsTrue(s_localeCountryValue.CompareTo(e.Value) == 0, "OnLocaleCountryChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleLanguageChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleLanguageChangedEventArgs.cs new file mode 100755 index 000000000..3213d7c1c --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleLanguageChangedEventArgs.cs @@ -0,0 +1,55 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.LocaleLanguageChangedEventArgs Tests")] + public static class LocaleLanguageChangedEventArgsTests + { + private static bool s_localeLanguageCallbackCalled = false; + private static readonly string s_localeLanguageValue = "en_US"; + ////[Test] + //[Category("P1")] + //[Description("Check LocaleLanguageChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.LocaleLanguageChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.LocaleLanguageChanged += OnLocaleLanguageChangedValue; + + string preValue = Tizen.System.SystemSettings.LocaleLanguage; + Tizen.System.SystemSettings.LocaleLanguage = s_localeLanguageValue; + await Task.Delay(2000); + Assert.IsTrue(s_localeLanguageCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_localeLanguageCallbackCalled = false; + Tizen.System.SystemSettings.LocaleLanguageChanged -= OnLocaleLanguageChangedValue; + Tizen.System.SystemSettings.LocaleLanguage = preValue; + LogUtils.WriteOK(); + } + private static void OnLocaleLanguageChangedValue(object sender, Tizen.System.LocaleLanguageChangedEventArgs e) + { + s_localeLanguageCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnLocaleLanguageChangedValue: LocaleLanguage not an instance of string"); + Assert.IsTrue(s_localeLanguageValue.CompareTo(e.Value) == 0, "OnLocaleLanguageChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleTimeFormat24HourSettingChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleTimeFormat24HourSettingChangedEventArgs.cs new file mode 100755 index 000000000..7b27749dc --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleTimeFormat24HourSettingChangedEventArgs.cs @@ -0,0 +1,56 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.LocaleTimeFormat24HourSettingChangedEventArgs Tests")] + public static class LocaleTimeFormat24HourSettingChangedEventArgsTests + { + private static bool s_timeFormatCallbackCalled = false; + private static readonly bool s_localeTimeformat24HourValue = !Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled; + ////[Test] + //[Category("P1")] + //[Description("Check LocaleTimeFormat24HourSettingChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.LocaleTimeFormat24HourSettingChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.LocaleTimeFormat24HourSettingChanged += OnLocaleTimeformat24HourChangedValue; + + bool preValue = Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled; + Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled = s_localeTimeformat24HourValue; + await Task.Delay(2000); + Assert.IsTrue(s_timeFormatCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_timeFormatCallbackCalled = false; + Tizen.System.SystemSettings.LocaleTimeFormat24HourSettingChanged -= OnLocaleTimeformat24HourChangedValue; + Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled = preValue; + LogUtils.WriteOK(); + } + + private static void OnLocaleTimeformat24HourChangedValue(object sender, Tizen.System.LocaleTimeFormat24HourSettingChangedEventArgs e) + { + s_timeFormatCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnLocaleTimeformat24HourChangedValue: LocaleTimeFormat24HourEnabled not an instance of bool"); + Assert.IsTrue(e.Value == s_localeTimeformat24HourValue, "OnLocaleTimeformat24HourChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleTimeZoneChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleTimeZoneChangedEventArgs.cs new file mode 100755 index 000000000..9a0383427 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLocaleTimeZoneChangedEventArgs.cs @@ -0,0 +1,55 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.LocaleTimeZoneChangedEventArgs Tests")] + public static class LocaleTimeZoneChangedEventArgsTests + { + private static bool s_localeTimeZoneCallbackCalled = false; + private static readonly string s_localeTimeZoneValue = "Asia/Seoul"; + ////[Test] + //[Category("P1")] + //[Description("Check LocaleTimeZoneChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.LocaleTimeZoneChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.LocaleTimeZoneChanged += OnLocaleTimeZoneChangedValue; + + string preValue = Tizen.System.SystemSettings.LocaleTimeZone; + Tizen.System.SystemSettings.LocaleTimeZone = s_localeTimeZoneValue; + await Task.Delay(2000); + Assert.IsTrue(s_localeTimeZoneCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_localeTimeZoneCallbackCalled = false; + Tizen.System.SystemSettings.LocaleTimeZoneChanged -= OnLocaleTimeZoneChangedValue; + Tizen.System.SystemSettings.LocaleTimeZone = preValue; + LogUtils.WriteOK(); + } + private static void OnLocaleTimeZoneChangedValue(object sender, Tizen.System.LocaleTimeZoneChangedEventArgs e) + { + s_localeTimeZoneCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "LocaleTimeZone not an instance of string"); + Assert.IsTrue(s_localeTimeZoneValue.CompareTo(e.Value) == 0, "OnLocaleTimeZoneChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLockStateChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLockStateChangedEventArgs.cs new file mode 100755 index 000000000..8a521dbbe --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLockStateChangedEventArgs.cs @@ -0,0 +1,135 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.LockStateChangedEventArgs Tests")] + public static class LockStateChangedEventArgsTests + { + private static bool s_lockStateLockCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check LockStateChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.LockStateChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRE")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_ENUM_LOCK() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.LockStateChanged += OnLockStateChangedLockValue; + + SystemSettingsIdleLockState preValue = Tizen.System.SystemSettings.LockState; + Tizen.System.SystemSettings.LockState = Tizen.System.SystemSettingsIdleLockState.Lock; + await Task.Delay(2000); + Assert.IsTrue(s_lockStateLockCallbackCalled, "Value_ENUM_LOCK: EventHandler added. Not getting called"); + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_lockStateLockCallbackCalled = false; + Tizen.System.SystemSettings.LockStateChanged -= OnLockStateChangedLockValue; + Tizen.System.SystemSettings.LockState = preValue; + LogUtils.WriteOK(); + } + private static void OnLockStateChangedLockValue(object sender, Tizen.System.LockStateChangedEventArgs e) + { + s_lockStateLockCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnLockStateChangedLockValue: LockState nota na instance of SystemSettingsIdleLockState"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsIdleLockState.Lock, "OnLockStateChangedLockValue: The callback should receive the latest value for the property."); + } + + private static bool s_lockStateUnlockCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check LockStateChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.LockStateChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRE")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_ENUM_UNLOCK() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.LockStateChanged += OnLockStateChangedUnlockValue; + + SystemSettingsIdleLockState preValue = Tizen.System.SystemSettings.LockState; + Tizen.System.SystemSettings.LockState = Tizen.System.SystemSettingsIdleLockState.Unlock; + await Task.Delay(2000); + Assert.IsTrue(s_lockStateUnlockCallbackCalled, "Value_ENUM_UNLOCK: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.LockStateChanged -= OnLockStateChangedUnlockValue; + s_lockStateLockCallbackCalled = false; + Tizen.System.SystemSettings.LockState = preValue; + LogUtils.WriteOK(); + } + private static void OnLockStateChangedUnlockValue(object sender, Tizen.System.LockStateChangedEventArgs e) + { + s_lockStateUnlockCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnLockStateChangedUnlockValue: LockState not an instance of SystemSettingsIdleLockState"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsIdleLockState.Unlock, "OnLockStateChangedUnlockValue: The callback should receive the latest value for the property."); + } + + private static bool s_lockStateLaunchingLockCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check LockStateChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.LockStateChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_ENUM_LAUNCHING_LOCK() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.LockStateChanged += OnLockStateChangedLaunchingLockValue; + + SystemSettingsIdleLockState preValue = Tizen.System.SystemSettings.LockState; + Tizen.System.SystemSettings.LockState = Tizen.System.SystemSettingsIdleLockState.LaunchingLock; + await Task.Delay(2000); + Assert.IsTrue(s_lockStateLaunchingLockCallbackCalled, "Value_ENUM_LAUNCHING_LOCK: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.LockStateChanged -= OnLockStateChangedLaunchingLockValue; + s_lockStateLockCallbackCalled = false; + Tizen.System.SystemSettings.LockState = preValue; + LogUtils.WriteOK(); + } + private static void OnLockStateChangedLaunchingLockValue(object sender, Tizen.System.LockStateChangedEventArgs e) + { + s_lockStateLaunchingLockCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnLockStateChangedLaunchingLockValue: LockState not an instance of SystemSettingsIdleLockState"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsIdleLockState.LaunchingLock, "OnLockStateChangedLaunchingLockValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLockscreenAppChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLockscreenAppChangedEventArgs.cs new file mode 100755 index 000000000..c914c7dcf --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSLockscreenAppChangedEventArgs.cs @@ -0,0 +1,63 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.LockscreenAppChangedEventArgs Tests")] + public static class LockscreenAppChangedEventArgsTests + { + private static bool s_lockScreenAppCallbackCalled = false; + private static readonly string s_lockscreenAppValue = "org.tizen.lockscreen"; + ////[Test] + //[Category("P1")] + //[Description("Check LockscreenAppChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.LockscreenAppChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + try { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.LockScreenAppChanged += OnLockscreenAppChangedValue; + + string preValue = Tizen.System.SystemSettings.LockScreenApp; + Tizen.System.SystemSettings.LockScreenApp = s_lockscreenAppValue; + await Task.Delay(2000); + Assert.IsTrue(s_lockScreenAppCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_lockScreenAppCallbackCalled = false; + Tizen.System.SystemSettings.LockScreenAppChanged -= OnLockscreenAppChangedValue; + Tizen.System.SystemSettings.LockScreenApp = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.lock_screen", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.lock_screen)"); + LogUtils.NotSupport(); + } + } + private static void OnLockscreenAppChangedValue(object sender, Tizen.System.LockScreenAppChangedEventArgs e) + { + s_lockScreenAppCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnLockscreenAppChangedValue: LockscreenApp not an instance of string"); + Assert.IsTrue(s_lockscreenAppValue.CompareTo(e.Value) == 0, "OnLockscreenAppChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSMotionActivationSettingChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSMotionActivationSettingChangedEventArgs.cs new file mode 100755 index 000000000..2e369261a --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSMotionActivationSettingChangedEventArgs.cs @@ -0,0 +1,55 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.MotionActivationSettingChangedEventArgs Tests")] + public static class MotionActivationSettingChangedEventArgsTests + { + private static bool s_motionActivationCallbackCalled = false; + private static bool s_motionActivationValue = !Tizen.System.SystemSettings.MotionActivationEnabled; + ////[Test] + //[Category("P1")] + //[Description("Check MotionActivationSettingChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.MotionActivationSettingChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.MotionActivationSettingChanged += OnMotionActivationChangedValue; + + bool preValue = Tizen.System.SystemSettings.MotionActivationEnabled; + Tizen.System.SystemSettings.MotionActivationEnabled = s_motionActivationValue; + await Task.Delay(2000); + Assert.IsTrue(s_motionActivationCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_motionActivationCallbackCalled = false; + Tizen.System.SystemSettings.MotionActivationSettingChanged -= OnMotionActivationChangedValue; + Tizen.System.SystemSettings.MotionActivationEnabled = preValue; + LogUtils.WriteOK(); + } + private static void OnMotionActivationChangedValue(object sender, Tizen.System.MotionActivationSettingChangedEventArgs e) + { + s_motionActivationCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnMotionActivationChangedValue: MotionActivationEnabled not an instance of bool"); + Assert.IsTrue(e.Value == s_motionActivationValue, "OnMotionActivationChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSScreenBacklightTimeChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSScreenBacklightTimeChangedEventArgs.cs new file mode 100755 index 000000000..c0a93fa37 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSScreenBacklightTimeChangedEventArgs.cs @@ -0,0 +1,266 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.ScreenBacklightTimeChangedEventArgs Tests")] + public static class ScreenBacklightTimeChangedEventArgsTests + { + private static bool s_screenBacklightTime15CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check ScreenBacklightTimeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.ScreenBacklightTimeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY_15() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime15ChangedValue; + + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 15; + await Task.Delay(2000); + Assert.IsTrue(s_screenBacklightTime15CallbackCalled, "Value_PROPERTY_READ_ONLY_15: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime15ChangedValue; + s_screenBacklightTime15CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + + } + private static void OnScreenBacklightTime15ChangedValue(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime15CallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime15ChangedValue: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 15, "OnScreenBacklightTime15ChangedValue: The callback should receive the latest value for the property."); + } + + private static bool s_screenBacklightTime30CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check ScreenBacklightTimeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.ScreenBacklightTimeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY_30() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime30ChangedValue; + + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 30; + await Task.Delay(2000); + Assert.IsTrue(s_screenBacklightTime30CallbackCalled, "Value_PROPERTY_READ_ONLY_30: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime30ChangedValue; + s_screenBacklightTime30CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + + } + private static void OnScreenBacklightTime30ChangedValue(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime30CallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime30ChangedValue: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 30, "OnScreenBacklightTime30ChangedValue: The callback should receive the latest value for the property."); + } + + private static bool s_screenBacklightTime60CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check ScreenBacklightTimeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.ScreenBacklightTimeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY_60() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime60ChangedValue; + + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 60; + await Task.Delay(2000); + Assert.IsTrue(s_screenBacklightTime60CallbackCalled, "Value_PROPERTY_READ_ONLY_60: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime60ChangedValue; + s_screenBacklightTime60CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + + } + private static void OnScreenBacklightTime60ChangedValue(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime60CallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime60ChangedValue: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 60, "OnScreenBacklightTime60ChangedValue: The callback should receive the latest value for the property."); + } + + private static bool s_screenBacklightTime120CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check ScreenBacklightTimeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.ScreenBacklightTimeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY_120() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime120ChangedValue; + + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 120; + await Task.Delay(2000); + Assert.IsTrue(s_screenBacklightTime120CallbackCalled, "Value_PROPERTY_READ_ONLY_120: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime120ChangedValue; + s_screenBacklightTime120CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + + } + + private static void OnScreenBacklightTime120ChangedValue(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime120CallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime120ChangedValue: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 120, "OnScreenBacklightTime120ChangedValue: The callback should receive the latest value for the property."); + } + + private static bool s_screenBacklightTime300CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check ScreenBacklightTimeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.ScreenBacklightTimeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY_300() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime300ChangedValue; + + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 300; + await Task.Delay(2000); + Assert.IsTrue(s_screenBacklightTime300CallbackCalled, "Value_PROPERTY_READ_ONLY_300: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime300ChangedValue; + s_screenBacklightTime300CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + + } + private static void OnScreenBacklightTime300ChangedValue(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime300CallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime300ChangedValue: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 300, "OnScreenBacklightTime300ChangedValue: The callback should receive the latest value for the property."); + } + + private static bool s_screenBacklightTime600CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check ScreenBacklightTimeChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.ScreenBacklightTimeChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY_600() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime600ChangedValue; + + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 600; + await Task.Delay(2000); + Assert.IsTrue(s_screenBacklightTime600CallbackCalled, "Value_PROPERTY_READ_ONLY_600: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime600ChangedValue; + s_screenBacklightTime600CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + + } + private static void OnScreenBacklightTime600ChangedValue(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime600CallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime600ChangedValue: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 600, "OnScreenBacklightTime600ChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSSoundNotificationChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSSoundNotificationChangedEventArgs.cs new file mode 100755 index 000000000..86a488704 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSSoundNotificationChangedEventArgs.cs @@ -0,0 +1,64 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.SoundNotificationChangedEventArgs Tests")] + public static class SoundNotificationChangedEventArgsTests + { + private static bool s_soundNotificationCallbackCalled = false; + private static readonly string s_soundNotificationValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.SoundNotification); + ////[Test] + //[Category("P1")] + //[Description("Check SoundNotificationChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.SoundNotificationChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + try { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.SoundNotificationChanged += OnSoundNotificationChangedValue; + + string preValue = Tizen.System.SystemSettings.SoundNotification; + Tizen.System.SystemSettings.SoundNotification = s_soundNotificationValue; + await Task.Delay(2000); + Assert.IsTrue(s_soundNotificationCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + Tizen.System.SystemSettings.SoundNotificationChanged -= OnSoundNotificationChangedValue; + Tizen.System.SystemSettings.SoundNotification = preValue; + s_soundNotificationCallbackCalled = false; + LogUtils.WriteOK(); + } + catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.incoming_call", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.incoming_call)"); + LogUtils.NotSupport(); + } + } + private static void OnSoundNotificationChangedValue(object sender, Tizen.System.SoundNotificationChangedEventArgs e) + { + s_soundNotificationCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnSoundNotificationChangedValue: SoundNotification not an instance of string"); + Assert.IsTrue(s_soundNotificationValue.CompareTo(e.Value) == 0, "OnSoundNotificationChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSSoundNotificationRepetitionPeriodChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSSoundNotificationRepetitionPeriodChangedEventArgs.cs new file mode 100755 index 000000000..d999c6d76 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSSoundNotificationRepetitionPeriodChangedEventArgs.cs @@ -0,0 +1,55 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.SoundNotificationRepetitionPeriodChangedEventArgs Tests")] + public static class SoundNotificationRepetitionPeriodChangedEventArgsTests + { + private static bool s_soundNotificationRepetitionPeriodCallbackCalled = false; + private static readonly int s_soundNotificationRepetitionPeriodValue = 300; + ////[Test] + //[Category("P1")] + //[Description("Check SoundNotificationRepetitionPeriodChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.SoundNotificationRepetitionPeriodChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.SoundNotificationRepetitionPeriodChanged += OnSoundNotificationRepetitionPeriodChangedValue; + + int preValue = Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod; + Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod = s_soundNotificationRepetitionPeriodValue; + await Task.Delay(2000); + Assert.IsTrue(s_soundNotificationRepetitionPeriodCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_soundNotificationRepetitionPeriodCallbackCalled = false; + Tizen.System.SystemSettings.SoundNotificationRepetitionPeriodChanged -= OnSoundNotificationRepetitionPeriodChangedValue; + Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod = preValue; + LogUtils.WriteOK(); + } + private static void OnSoundNotificationRepetitionPeriodChangedValue(object sender, Tizen.System.SoundNotificationRepetitionPeriodChangedEventArgs e) + { + s_soundNotificationRepetitionPeriodCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnSoundNotificationRepetitionPeriodChangedValue: EventHandler added. Not getting called"); + Assert.IsTrue(s_soundNotificationRepetitionPeriodValue.CompareTo(e.Value) == 0, "OnSoundNotificationRepetitionPeriodChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSSystemSettings.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSSystemSettings.cs new file mode 100755 index 000000000..81795398c --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSSystemSettings.cs @@ -0,0 +1,1936 @@ +using System.Threading; +using System.Threading.Tasks; +using System; +using Tizen.System; + +// /opt/usr/data/settings/Ringtones/ringtone_sdk.mp3 +namespace SystemSettingsUnitTest +{ + + public static class SystemSettingsTestInput + { + + + private const int nStringDataSize = 100; + + enum eProfileValue + { + PROFILE_MOBILE = 0, + PROFILE_WEARABLE, //1 + PROFILE_TV, //2 + PROFILE_COMMON, //3 + PROFILE_MAX, + + }; + static string[,] string_data = new string[5, 100]; + + public static void InitStringValue() + { + string[,] init_data = new string[,] { + { //mobile + "/opt/usr/data/settings/Ringtones/ringtone_sdk.mp3", + "/opt/usr/data/settings/Wallpapers/home_003.png", + "/opt/usr/data/settings/Wallpapers/home_003.png", + }, + { //wearable + "/opt/usr/data/settings/Ringtones/Ringtone.ogg", + "/opt/usr/data/settings/Wallpaper/BG_preview_02.png", + "/opt/usr/data/settings/Wallpaper/BG_preview_02.png", + }, + { //tv + "/opt/usr/data/settings/Ringtones/ringtone_sdk.mp3", + "/opt/usr/data/settings/Wallpapers/home_003.png", + "/opt/usr/data/settings/Wallpapers/home_003.png", + }, + { //common + "/opt/usr/data/settings/Ringtones/ringtone_sdk.mp3", + "/opt/usr/data/settings/Wallpapers/home_003.png", + "/opt/usr/data/settings/Wallpapers/home_003.png", + }, + }; + + for (int i = 0; i < 4; i++) + { + for (int j = 0; j < 3; j++) + { + string_data[i, j] = init_data[i, j]; + } + } + + string_data[(int)eProfileValue.PROFILE_MOBILE, (int)Tizen.System.SystemSettingsKeys.SoundNotification] = "/opt/usr/data/settings/Alerts/General notification_sdk.wav"; + string_data[(int)eProfileValue.PROFILE_WEARABLE, (int)Tizen.System.SystemSettingsKeys.SoundNotification] = "/opt/usr/data/settings/Alerts/Notification.ogg"; + string_data[(int)eProfileValue.PROFILE_TV, (int)Tizen.System.SystemSettingsKeys.SoundNotification] = "/opt/usr/data/settings/Alerts/General notification_sdk.wav"; + string_data[(int)eProfileValue.PROFILE_COMMON, (int)Tizen.System.SystemSettingsKeys.SoundNotification] = "/opt/usr/data/settings/Alerts/General notification_sdk.wav"; + + string_data[(int)eProfileValue.PROFILE_MOBILE, (int)Tizen.System.SystemSettingsKeys.EmailAlertRingtone] = "/opt/usr/data/settings/Alerts/General notification_sdk.wav"; + string_data[(int)eProfileValue.PROFILE_WEARABLE, (int)Tizen.System.SystemSettingsKeys.EmailAlertRingtone] = "/opt/usr/data/settings/Alerts/Notification.ogg"; + string_data[(int)eProfileValue.PROFILE_TV, (int)Tizen.System.SystemSettingsKeys.EmailAlertRingtone] = "/opt/usr/data/settings/Alerts/General notification_sdk.wav"; + string_data[(int)eProfileValue.PROFILE_COMMON, (int)Tizen.System.SystemSettingsKeys.EmailAlertRingtone] = "/opt/usr/data/settings/Alerts/General notification_sdk.wav"; + + } + static bool isStarted = false; + + public static string GetStringValue(int enum_val) + { + + if (!isStarted) + { + InitStringValue(); + isStarted = true; + } + string strProfile; + eProfileValue profile_val = eProfileValue.PROFILE_MOBILE; + Information.TryGetValue("tizen.org/feature/profile", out strProfile); + if (string.Compare(strProfile, "mobile") == 0) + { + profile_val = eProfileValue.PROFILE_MOBILE; + } + else if (string.Compare(strProfile, "wearable") == 0) + { + profile_val = eProfileValue.PROFILE_WEARABLE; + } + else if (string.Compare(strProfile, "tv") == 0) + { + profile_val = eProfileValue.PROFILE_TV; + } + else if (string.Compare(strProfile, "common") == 0) + { + profile_val = eProfileValue.PROFILE_COMMON; + } + return string_data[(int)profile_val, enum_val]; + } + + } + + //[TestFixture] + //[Description("Tizen.System.SystemSettings Tests")] + public static class SystemSettingsTests + { + //[SetUp] + public static void Init() + { + //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + //[TearDown] + public static void Destroy() + { + //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + + + + + // IncomingCallRingtone + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:IncomingCallRingtone is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.IncomingCallRingtone A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void IncomingCallRingtone_READ_WRITE() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.IncomingCallRingtone, "IncomingCallRingtone_READ_WRITE: IncomingCallRingtone not an instance of string"); + string preValue = Tizen.System.SystemSettings.IncomingCallRingtone; + var setValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.IncomingCallRingtone); + + Tizen.System.SystemSettings.IncomingCallRingtone = setValue; + var getValue = Tizen.System.SystemSettings.IncomingCallRingtone; + Assert.IsTrue(setValue.CompareTo(getValue) == 0, "IncomingCallRingtone_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.IncomingCallRingtone = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.incoming_call", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.incoming_call)"); + LogUtils.NotSupport(); + } + } + + private static bool s_incomingCallRingtoneCallbackCalled = false; + private static readonly string s_incomingCallRingtoneValue = SystemSettingsTestInput.GetStringValue((int) Tizen.System.SystemSettingsKeys.IncomingCallRingtone); + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:IncomingCallRingtoneChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.IncomingCallRingtoneChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task IncomingCallRingtoneChanged_CHECK_EVENT() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.IncomingCallRingtoneChanged += OnIncomingCallRingtoneChanged; + string preValue = Tizen.System.SystemSettings.IncomingCallRingtone; + Tizen.System.SystemSettings.IncomingCallRingtone = s_incomingCallRingtoneValue; + await Task.Delay(2000); + Assert.IsTrue(s_incomingCallRingtoneCallbackCalled, "IncomingCallRingtoneChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_incomingCallRingtoneCallbackCalled = false; + Tizen.System.SystemSettings.IncomingCallRingtoneChanged -= OnIncomingCallRingtoneChanged; + Tizen.System.SystemSettings.IncomingCallRingtone = s_incomingCallRingtoneValue; + await Task.Delay(2000); + Assert.IsFalse(s_incomingCallRingtoneCallbackCalled, "IncomingCallRingtoneChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.IncomingCallRingtone = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.incoming_call", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.incoming_call)"); + LogUtils.NotSupport(); + } + } + private static void OnIncomingCallRingtoneChanged(object sender, Tizen.System.IncomingCallRingtoneChangedEventArgs e) + { + s_incomingCallRingtoneCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnIncomingCallRingtoneChanged: IncomingCallRingtone not an instance of string"); + Assert.IsTrue(s_incomingCallRingtoneValue.CompareTo(e.Value) == 0, "OnIncomingCallRingtoneChanged: The callback should receive the latest value for the property."); + } + + // WallpaperHomeScreen + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:WallpaperHomeScreen is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.WallpaperHomeScreen A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void WallpaperHomeScreen_READ_WRITE() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.WallpaperHomeScreen, "WallpaperHomeScreen_READ_WRITE: WallpaperHomeScreen not an instance of string"); + string preValue = Tizen.System.SystemSettings.WallpaperHomeScreen; + var setValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.WallpaperHomeScreen); + + Tizen.System.SystemSettings.WallpaperHomeScreen = setValue; + var getValue = Tizen.System.SystemSettings.WallpaperHomeScreen; + Assert.IsTrue(setValue.CompareTo(getValue) == 0, "WallpaperHomeScreen_READ_WRITE: Set value and get value of the property should be same."); + + string strProfile; + Information.TryGetValue("tizen.org/feature/profile", out strProfile); + if (string.Compare(strProfile, "mobile") == 0) + Tizen.System.SystemSettings.WallpaperHomeScreen = preValue; + + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.home_screen", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.home_screen)"); + LogUtils.NotSupport(); + } + } + + private static bool s_wallpaperHomeScreenCallbackCalled = false; + private static readonly string s_wallpaperHomeScreenValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.WallpaperHomeScreen); + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:WallpaperHomeScreenChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.WallpaperHomeScreenChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task WallpaperHomeScreenChanged_CHECK_EVENT() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.WallpaperHomeScreenChanged += OnWallpaperHomeScreenChanged; + string preValue = Tizen.System.SystemSettings.WallpaperHomeScreen; + Tizen.System.SystemSettings.WallpaperHomeScreen = s_wallpaperHomeScreenValue; + await Task.Delay(2000); + Assert.IsTrue(s_wallpaperHomeScreenCallbackCalled, "WallpaperHomeScreenChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_wallpaperHomeScreenCallbackCalled = false; + Tizen.System.SystemSettings.WallpaperHomeScreenChanged -= OnWallpaperHomeScreenChanged; + Tizen.System.SystemSettings.WallpaperHomeScreen = s_wallpaperHomeScreenValue; + await Task.Delay(2000); + Assert.IsFalse(s_wallpaperHomeScreenCallbackCalled, "WallpaperHomeScreenChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + + string strProfile; + Information.TryGetValue("tizen.org/feature/profile", out strProfile); + if (string.Compare(strProfile, "mobile") == 0) + Tizen.System.SystemSettings.WallpaperHomeScreen = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.home_screen", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.home_screen)"); + LogUtils.NotSupport(); + } + } + private static void OnWallpaperHomeScreenChanged(object sender, Tizen.System.WallpaperHomeScreenChangedEventArgs e) + { + s_wallpaperHomeScreenCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnWallpaperHomeScreenChanged: WallpaperHomeScreen not an instance of string"); + Assert.IsTrue(s_wallpaperHomeScreenValue.CompareTo(e.Value) == 0, "OnWallpaperHomeScreenChanged: The callback should receive the latest value for the property."); + } + + //WallpaperLockScreen + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:WallpaperLockScreen is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.WallpaperLockScreen A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void WallpaperLockScreen_READ_WRITE() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.WallpaperLockScreen, "WallpaperLockScreen_READ_WRITE: WallpaperLockScreen not an instance of string"); + string preValue = Tizen.System.SystemSettings.WallpaperLockScreen; + var setValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.WallpaperLockScreen); + Tizen.System.SystemSettings.WallpaperLockScreen = setValue; + var getValue = Tizen.System.SystemSettings.WallpaperLockScreen; + Assert.IsTrue(setValue.CompareTo(getValue) == 0, "WallpaperLockScreen_READ_WRITE: Set value and get value of the property should be same."); + + string strProfile; + Information.TryGetValue("tizen.org/feature/profile", out strProfile); + if (string.Compare(strProfile, "mobile") == 0) + Tizen.System.SystemSettings.WallpaperLockScreen = preValue; + + + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.lock_screen", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.lock_screen)"); + LogUtils.NotSupport(); + } + } + + private static bool s_wallpaperLockScreenCallbackCalled = false; + private static readonly string s_wallpaperLockScreenValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.WallpaperLockScreen); + //[Category("P1")] + //[Description("Check if callback to SystemSettings:WallpaperLockScreenChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.WallpaperLockScreenChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task WallpaperLockScreenChanged_CHECK_EVENT() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.WallpaperLockScreenChanged += OnWallpaperLockScreenChanged; + string preValue = Tizen.System.SystemSettings.WallpaperLockScreen; + Tizen.System.SystemSettings.WallpaperLockScreen = s_wallpaperLockScreenValue; + await Task.Delay(2000); + Assert.IsTrue(s_wallpaperLockScreenCallbackCalled, "WallpaperLockScreenChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_wallpaperLockScreenCallbackCalled = false; + Tizen.System.SystemSettings.WallpaperLockScreenChanged -= OnWallpaperLockScreenChanged; + Tizen.System.SystemSettings.WallpaperLockScreen = s_wallpaperLockScreenValue; + await Task.Delay(2000); + Assert.IsFalse(s_wallpaperLockScreenCallbackCalled, "WallpaperLockScreenChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + + string strProfile; + Information.TryGetValue("tizen.org/feature/profile", out strProfile); + if (string.Compare(strProfile, "mobile") == 0) + Tizen.System.SystemSettings.WallpaperLockScreen = preValue; + + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.lock_screen", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.lock_screen)"); + LogUtils.NotSupport(); + } + } + private static void OnWallpaperLockScreenChanged(object sender, Tizen.System.WallpaperLockScreenChangedEventArgs e) + { + s_wallpaperLockScreenCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnWallpaperLockScreenChanged: WallpaperLockScreen not an instance of string"); + Assert.IsTrue(s_wallpaperLockScreenValue.CompareTo(e.Value) == 0, "OnWallpaperLockScreenChanged: The callback should receive the latest value for the property."); + } + + // FontSize + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:FontSize is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.FontSize A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRE")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void FontSize_READ_WRITE_ALL() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.FontSize, "FontSize_READ_WRITE_ALL: FontSize not an instance of SystemSettingsFontSize"); + Thread.Sleep(3000); + SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Small; + var getValue = Tizen.System.SystemSettings.FontSize; + Assert.IsTrue(getValue == Tizen.System.SystemSettingsFontSize.Small, "FontSize_READ_WRITE_ALL: Set value and get value of the property should be same."); + + Thread.Sleep(3000); + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Normal; + getValue = Tizen.System.SystemSettings.FontSize; + Assert.IsTrue(getValue == Tizen.System.SystemSettingsFontSize.Normal, "FontSize_READ_WRITE_ALL: Set value and get value of the property should be same."); + + Thread.Sleep(3000); + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Large; + getValue = Tizen.System.SystemSettings.FontSize; + Assert.IsTrue(getValue == Tizen.System.SystemSettingsFontSize.Large, "FontSize_READ_WRITE_ALL: Set value and get value of the property should be same."); + + Thread.Sleep(3000); + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Huge; + getValue = Tizen.System.SystemSettings.FontSize; + Assert.IsTrue(getValue == Tizen.System.SystemSettingsFontSize.Huge, "FontSize_READ_WRITE_ALL: Set value and get value of the property should be same."); + + Thread.Sleep(3000); + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Giant; + getValue = Tizen.System.SystemSettings.FontSize; + Assert.IsTrue(getValue == Tizen.System.SystemSettingsFontSize.Giant, "FontSize_READ_WRITE_ALL: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.FontSize = preValue; + LogUtils.WriteOK(); + } + + private static bool s_fontSizeSmallCallbackCalled = false; + private static SystemSettingsFontSize preFontValue; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:FontSizeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.FontSizeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task FontSizeChanged_CHECK_EVENT_SMALL() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedSmall; + //SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize; + preFontValue = Tizen.System.SystemSettings.FontSize; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Small; + await Task.Delay(2000); + Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedSmall; + Assert.IsTrue(s_fontSizeSmallCallbackCalled, "FontSizeChanged_CHECK_EVENT_SMALL: EventHandler added. Not getting called"); + s_fontSizeSmallCallbackCalled = false; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Small; + await Task.Delay(2000); + Assert.IsFalse(s_fontSizeSmallCallbackCalled, "FontSizeChanged_CHECK_EVENT_SMALL: EventHandler removed. Still getting called"); + //Tizen.System.SystemSettings.FontSize = preValue; + LogUtils.WriteOK(); + } + private static void OnFontSizeChangedSmall(object sender, Tizen.System.FontSizeChangedEventArgs e) + { + s_fontSizeSmallCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnFontSizeChangedSmall: FontSize not an instance of SystemSettingsFontSize"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Small, "OnFontSizeChangedSmall: The callback should receive the latest value for the property."); + } + + private static bool s_fontSizeNormalCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:FontSizeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.FontSizeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task FontSizeChanged_CHECK_EVENT_NORMAL() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedNormal; + await Task.Delay(2000); + //SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Normal; + await Task.Delay(2000); + Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedNormal; + await Task.Delay(2000); + Assert.IsTrue(s_fontSizeNormalCallbackCalled, "FontSizeChanged_CHECK_EVENT_NORMAL: EventHandler added. Not getting called"); + s_fontSizeNormalCallbackCalled = false; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Normal; + await Task.Delay(2000); + Assert.IsFalse(s_fontSizeNormalCallbackCalled, "FontSizeChanged_CHECK_EVENT_NORMAL: EventHandler removed. Still getting called"); + //Tizen.System.SystemSettings.FontSize = preValue; + LogUtils.WriteOK(); + } + private static void OnFontSizeChangedNormal(object sender, Tizen.System.FontSizeChangedEventArgs e) + { + s_fontSizeNormalCallbackCalled = true; + // string format = string.Format("Current Tizen.System.SystemSettings.FontSize : {0} , actual value {1}", Tizen.System.SystemSettings.FontSize, e.Value); + // Tizen.Log.Debug("CS-SYSTEM-SETTINGS", format); + + Assert.IsInstanceOf(e.Value, "OnFontSizeChangedNormal: FontSize not an instance of SystemSettingsFontSize"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Normal, "OnFontSizeChangedNormal: The callback should receive the latest value for the property."); + } + + private static bool s_fontSizeLargeCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:FontSizeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.FontSizeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task FontSizeChanged_CHECK_EVENT_LARGE() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedLarge; + await Task.Delay(2000); + //SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Large; + await Task.Delay(2000); + Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedLarge; + await Task.Delay(2000); + Assert.IsTrue(s_fontSizeLargeCallbackCalled, "FontSizeChanged_CHECK_EVENT_LARGE: EventHandler added. Not getting called"); + s_fontSizeLargeCallbackCalled = false; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Large; + await Task.Delay(2000); + Assert.IsFalse(s_fontSizeLargeCallbackCalled, "FontSizeChanged_CHECK_EVENT_LARGE: EventHandler removed. Still getting called"); + //Tizen.System.SystemSettings.FontSize = preValue; + LogUtils.WriteOK(); + } + private static void OnFontSizeChangedLarge(object sender, Tizen.System.FontSizeChangedEventArgs e) + { + s_fontSizeLargeCallbackCalled = true; + //string format = string.Format("Current Tizen.System.SystemSettings.FontSize : {0} , actual value {1}", Tizen.System.SystemSettings.FontSize, e.Value); + //Tizen.Log.Debug("CS-SYSTEM-SETTINGS", format); + + Assert.IsInstanceOf(e.Value, "OnFontSizeChangedLarge: FontSizeChanged not an instance of SystemSettingsFontSize"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Large, "OnFontSizeChangedLarge: The callback should receive the latest value for the property."); + } + + private static bool s_fontSizeHugeCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:FontSizeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.FontSizeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task FontSizeChanged_CHECK_EVENT_HUGE() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedHuge; + await Task.Delay(2000); + //SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Huge; + await Task.Delay(2000); + Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedHuge; + await Task.Delay(2000); + Assert.IsTrue(s_fontSizeHugeCallbackCalled, "FontSizeChanged_CHECK_EVENT_HUGE: EventHandler added. Not getting called"); + s_fontSizeHugeCallbackCalled = false; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Huge; + await Task.Delay(2000); + Assert.IsFalse(s_fontSizeHugeCallbackCalled, "FontSizeChanged_CHECK_EVENT_HUGE: EventHandler removed. Still getting called"); + //Tizen.System.SystemSettings.FontSize = preValue; + LogUtils.WriteOK(); + } + private static void OnFontSizeChangedHuge(object sender, Tizen.System.FontSizeChangedEventArgs e) + { + s_fontSizeHugeCallbackCalled = true; + //string format = string.Format("Current Tizen.System.SystemSettings.FontSize : {0} , actual value {1}", Tizen.System.SystemSettings.FontSize, e.Value); + //Tizen.Log.Debug("CS-SYSTEM-SETTINSG", format); + + Assert.IsInstanceOf(e.Value, "OnFontSizeChangedHuge: FontSize not an instance of SystemSettingsFontSize"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Huge, "OnFontSizeChangedHuge: The callback should receive the latest value for the property."); + } + + private static bool s_fontSizeGiantCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:FontSizeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.FontSizeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task FontSizeChanged_CHECK_EVENT_GIANT() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.FontSizeChanged += OnFontSizeChangedGiant; + await Task.Delay(2000); + //SystemSettingsFontSize preValue = Tizen.System.SystemSettings.FontSize; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Giant; + await Task.Delay(2000); + Tizen.System.SystemSettings.FontSizeChanged -= OnFontSizeChangedGiant; + await Task.Delay(2000); + Assert.IsTrue(s_fontSizeGiantCallbackCalled, "FontSizeChanged_CHECK_EVENT_GIANT: EventHandler added. Not getting called"); + s_fontSizeGiantCallbackCalled = false; + Tizen.System.SystemSettings.FontSize = Tizen.System.SystemSettingsFontSize.Giant; + await Task.Delay(2000); + Assert.IsFalse(s_fontSizeGiantCallbackCalled, "FontSizeChanged_CHECK_EVENT_GIANT: EventHandler removed. Still getting called"); + //Tizen.System.SystemSettings.FontSize = preValue; + Tizen.System.SystemSettings.FontSize = preFontValue; + LogUtils.WriteOK(); + } + private static void OnFontSizeChangedGiant(object sender, Tizen.System.FontSizeChangedEventArgs e) + { + s_fontSizeGiantCallbackCalled = true; + //string format = string.Format("Current Tizen.System.SystemSettings.FontSize : {0} , actual value {1}", Tizen.System.SystemSettings.FontSize, e.Value); + //Tizen.Log.Debug("CS-SYSTEM-SETTINGS", format); + + Assert.IsInstanceOf(e.Value, "OnFontSizeChangedGiant: FontSize not an instance of SystemSettingsFontSize"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsFontSize.Giant, "OnFontSizeChangedGiant: The callback should receive the latest value for the property."); + } + + // FontType + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:FontType is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.FontType A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void FontType_READ_WRITE() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.FontType, "FontType_READ_WRITE: FontType not an instance of string"); + string setValue = "BreezeSans"; + string preValue = Tizen.System.SystemSettings.FontType; + Thread.Sleep(3000); + Tizen.System.SystemSettings.FontType = setValue; + var getValue = Tizen.System.SystemSettings.FontType; + Assert.IsTrue(getValue.CompareTo(setValue) == 0, "FontType_READ_WRITE: Set value and get value of the property should be same."); + Thread.Sleep(1000); + + + string strProfile; + Information.TryGetValue("tizen.org/feature/profile", out strProfile); + if (string.Compare(strProfile, "mobile") == 0) + Tizen.System.SystemSettings.FontType = preValue; + + + LogUtils.WriteOK(); + } + + private static bool s_fontTypeCallbackCalled = false; + private static readonly string s_fontTypeValue = "BreezeSans"; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:FontTypeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.FontTypeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task FontTypeChanged_CHECK_EVENT() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.FontTypeChanged += OnFontTypeChanged; + string preValue = Tizen.System.SystemSettings.FontType; + Tizen.System.SystemSettings.FontType = s_fontTypeValue; + await Task.Delay(2000); + Assert.IsTrue(s_fontTypeCallbackCalled, "FontTypeChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_fontTypeCallbackCalled = false; + Tizen.System.SystemSettings.FontTypeChanged -= OnFontTypeChanged; + Tizen.System.SystemSettings.FontType = s_fontTypeValue; + await Task.Delay(2000); + Assert.IsFalse(s_fontTypeCallbackCalled, "FontTypeChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.FontType = preValue; + LogUtils.WriteOK(); + } + private static void OnFontTypeChanged(object sender, Tizen.System.FontTypeChangedEventArgs e) + { + s_fontTypeCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnFontTypeChanged: FontType not an instance of string"); + Assert.IsTrue(s_fontTypeValue.CompareTo(e.Value) == 0, "OnFontTypeChanged: The callback should receive the latest value for the property."); + } + + // MotionActivation + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:MotionActivationEnabled is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.MotionActivationEnabled A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void MotionActivationEnabled_READ_WRITE() + { + LogUtils.StartTest(); + /* TEST CODE */ + bool preValue = Tizen.System.SystemSettings.MotionActivationEnabled; + Assert.IsInstanceOf(Tizen.System.SystemSettings.MotionActivationEnabled, "MotionActivationEnabled_READ_WRITE: MotionActivationEnabled not an instance of bool"); + Tizen.System.SystemSettings.MotionActivationEnabled = true; + Assert.IsTrue(Tizen.System.SystemSettings.MotionActivationEnabled, "MotionActivation_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.MotionActivationEnabled = false; + Assert.IsFalse(Tizen.System.SystemSettings.MotionActivationEnabled, "MotionActivation_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.MotionActivationEnabled = preValue; + LogUtils.WriteOK(); + } + + private static bool s_motionActivationCallbackCalled = false; + private static bool s_motionActivationValue = !Tizen.System.SystemSettings.MotionActivationEnabled; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:MotionActivationSettingChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.MotionActivationSettingChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task MotionActivationSettingChanged_CHECK_EVENT() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.MotionActivationSettingChanged += OnMotionActivationChanged; + bool preValue = Tizen.System.SystemSettings.MotionActivationEnabled; + Tizen.System.SystemSettings.MotionActivationEnabled = s_motionActivationValue; + await Task.Delay(2000); + Assert.IsTrue(s_motionActivationCallbackCalled, "MotionActivationSettingChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_motionActivationCallbackCalled = false; + s_motionActivationValue = !s_motionActivationValue; + Tizen.System.SystemSettings.MotionActivationEnabled = s_motionActivationValue; + await Task.Delay(2000); + Assert.IsTrue(s_motionActivationCallbackCalled, "MotionActivationSettingChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_motionActivationCallbackCalled = false; + + Tizen.System.SystemSettings.MotionActivationSettingChanged -= OnMotionActivationChanged; + Tizen.System.SystemSettings.MotionActivationEnabled = s_motionActivationValue; + await Task.Delay(2000); + Assert.IsFalse(s_motionActivationCallbackCalled, "MotionActivationSettingChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.MotionActivationEnabled = preValue; + LogUtils.WriteOK(); + } + private static void OnMotionActivationChanged(object sender, Tizen.System.MotionActivationSettingChangedEventArgs e) + { + s_motionActivationCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnMotionActivationChanged: MotionActivationEnabled not an instance of bool"); + Assert.IsTrue(e.Value == s_motionActivationValue, "OnMotionActivationChanged: The callback should receive the latest value for the property."); + } + + // EmailAlertRingtone + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:EmailAlertRingtone is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.EmailAlertRingtone A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void EmailAlertRingtone_READ_WRITE() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.EmailAlertRingtone, "EmailAlertRingtone_READ_WRITE: EmailAlertRingtone not an instance of string"); + var setValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.EmailAlertRingtone); + string preValue = Tizen.System.SystemSettings.EmailAlertRingtone; + Tizen.System.SystemSettings.EmailAlertRingtone = setValue; + var getValue = Tizen.System.SystemSettings.EmailAlertRingtone; + Assert.IsTrue(setValue.CompareTo(getValue) == 0, "EmailAlertRingtone_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.EmailAlertRingtone = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.notification_email", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.notification_email)"); + LogUtils.NotSupport(); + + } + } + + private static bool s_emailAlertRingtoneCallbackCalled = false; + private static readonly string s_emailAlertRingtoneValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.EmailAlertRingtone); + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:EmailAlertRingtoneChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.EmailAlertRingtoneChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task EmailAlertRingtoneChanged_CHECK_EVENT() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.EmailAlertRingtoneChanged += OnEmailAlertRingtoneChanged; + string preValue = Tizen.System.SystemSettings.EmailAlertRingtone; + Tizen.System.SystemSettings.EmailAlertRingtone = s_emailAlertRingtoneValue; + await Task.Delay(2000); + Assert.IsTrue(s_emailAlertRingtoneCallbackCalled, "EmailAlertRingtoneChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_emailAlertRingtoneCallbackCalled = false; + Tizen.System.SystemSettings.EmailAlertRingtoneChanged -= OnEmailAlertRingtoneChanged; + Tizen.System.SystemSettings.EmailAlertRingtone = s_emailAlertRingtoneValue; + await Task.Delay(2000); + Assert.IsFalse(s_emailAlertRingtoneCallbackCalled, "EmailAlertRingtoneChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.EmailAlertRingtone = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.notification_email", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.notification_email)"); + LogUtils.NotSupport(); + } + } + private static void OnEmailAlertRingtoneChanged(object sender, Tizen.System.EmailAlertRingtoneChangedEventArgs e) + { + s_emailAlertRingtoneCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnEmailAlertRingtoneChanged: EmailAlertRingtone not an instance of string"); + Assert.IsTrue(s_emailAlertRingtoneValue.CompareTo(e.Value) == 0, "OnEmailAlertRingtoneChanged: The callback should receive the latest value for the property."); + } + + // Data3GNetworkEnabled + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:Data3GNetworkEnabled is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.Data3GNetworkEnabled A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void Data3GNetworkEnabled_READ_WRITE() + { + LogUtils.StartTest(); + /* TEST CODE */ + bool preValue = Tizen.System.SystemSettings.Data3GNetworkEnabled; + Assert.IsInstanceOf(Tizen.System.SystemSettings.Data3GNetworkEnabled, "Data3GNetworkEnabled_READ_WRITE: Data3GNetworkEnabled not an instance of bool"); + Tizen.System.SystemSettings.Data3GNetworkEnabled = true; + Assert.IsTrue(Tizen.System.SystemSettings.Data3GNetworkEnabled, "Data3GNetworkEnabled_READ_WRITE: Set value and get value of the property should be same"); + Tizen.System.SystemSettings.Data3GNetworkEnabled = false; + Assert.IsFalse(Tizen.System.SystemSettings.Data3GNetworkEnabled, "Data3GNetworkEnabled_READ_WRITE: Set value and get value of the property should be same"); + Tizen.System.SystemSettings.Data3GNetworkEnabled = preValue; + LogUtils.WriteOK(); + } + + private static bool s_data3GNetworkCallbackCalled = false; + private static bool s_data3GNetworkSettingValue = !Tizen.System.SystemSettings.Data3GNetworkEnabled; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:Data3GNetworkSettingChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.Data3GNetworkSettingChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Data3GNetworkSettingChanged_CHECK_EVENT() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.Data3GNetworkSettingChanged += OnData3GNetworkSettingChanged; + bool preValue = Tizen.System.SystemSettings.Data3GNetworkEnabled; + Tizen.System.SystemSettings.Data3GNetworkEnabled = s_data3GNetworkSettingValue; + await Task.Delay(2000); + Assert.IsTrue(s_data3GNetworkCallbackCalled, "Data3GNetworkSettingChanged_CHECK_EVENT: EventHandler added. Not getting called"); + + s_data3GNetworkSettingValue = !s_data3GNetworkSettingValue; + s_data3GNetworkCallbackCalled = false; + Tizen.System.SystemSettings.Data3GNetworkEnabled = s_data3GNetworkSettingValue; + await Task.Delay(2000); + Assert.IsTrue(s_data3GNetworkCallbackCalled, "Data3GNetworkSettingChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_data3GNetworkCallbackCalled = false; + + Tizen.System.SystemSettings.Data3GNetworkSettingChanged -= OnData3GNetworkSettingChanged; + Tizen.System.SystemSettings.Data3GNetworkEnabled = s_data3GNetworkSettingValue; + await Task.Delay(2000); + Assert.IsFalse(s_data3GNetworkCallbackCalled, "Data3GNetworkSettingChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.Data3GNetworkEnabled = preValue; + LogUtils.WriteOK(); + } + private static void OnData3GNetworkSettingChanged(object sender, Tizen.System.Data3GNetworkSettingChangedEventArgs e) + { + s_data3GNetworkCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnData3GNetworkSettingChanged: Data3GNetworkEnabled not an instance of bool"); + Assert.IsTrue(e.Value == s_data3GNetworkSettingValue, "OnData3GNetworkSettingChanged: The callback should receive the latest value for the property."); + } + + // LockscreenApp + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:LockscreenApp is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.LockscreenApp A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void LockscreenApp_READ_WRITE() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.LockScreenApp, "LockscreenApp_READ_WRITE: LockscreenApp not an instance of string"); + var setValue = "org.tizen.lockscreen"; + string preValue = Tizen.System.SystemSettings.LockScreenApp; + Tizen.System.SystemSettings.LockScreenApp = setValue; + var getValue = Tizen.System.SystemSettings.LockScreenApp; + Assert.IsTrue(setValue.CompareTo(getValue) == 0, "LockscreenApp_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.LockScreenApp = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.lock_screen", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.lock_screen)"); + LogUtils.NotSupport(); + } + } + + private static bool s_lockScreenAppCallbackCalled = false; + private static readonly string s_lockscreenAppValue = "org.tizen.lockscreen"; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:LockscreenAppChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.LockscreenAppChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task LockscreenAppChanged_CHECK_EVENT() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.LockScreenAppChanged += OnLockscreenAppChanged; + string preValue = Tizen.System.SystemSettings.LockScreenApp; + Tizen.System.SystemSettings.LockScreenApp = s_lockscreenAppValue; + await Task.Delay(2000); + Assert.IsTrue(s_lockScreenAppCallbackCalled, "LockscreenAppChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_lockScreenAppCallbackCalled = false; + Tizen.System.SystemSettings.LockScreenAppChanged -= OnLockscreenAppChanged; + Tizen.System.SystemSettings.LockScreenApp = s_lockscreenAppValue; + await Task.Delay(2000); + Assert.IsFalse(s_lockScreenAppCallbackCalled, "LockscreenAppChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.LockScreenApp = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.lock_screen", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.lock_screen)"); + LogUtils.NotSupport(); + } + } + private static void OnLockscreenAppChanged(object sender, Tizen.System.LockScreenAppChangedEventArgs e) + { + s_lockScreenAppCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnLockscreenAppChanged: LockscreenApp not an instance of string"); + Assert.IsTrue(s_lockscreenAppValue.CompareTo(e.Value) == 0, "OnLockscreenAppChanged: The callback should receive the latest value for the property."); + } + + // DefaultFontType + //[Test] + //[Category("P1")] + //[Description("Test if get for SystemSettings:DefaultFontType is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.DefaultFontType A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void DefaultFontType_READ_ONLY() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsNotNull(Tizen.System.SystemSettings.DefaultFontType, "DefaultFontType_READ_ONLY: DefaultFontType is null"); + Assert.IsInstanceOf(Tizen.System.SystemSettings.DefaultFontType, "DefaultFontType_READ_ONLY: DefaultFontType not an instance of string"); + LogUtils.WriteOK(); + } + + // LocaleCountry + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:LocaleCountry is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.LocaleCountry A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void LocaleCountry_READ_WRITE() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.LocaleCountry, "LocaleCountry_READ_WRITE: LocaleCountry not an instance of string"); + var setValue = "en_US"; + string preValue = Tizen.System.SystemSettings.LocaleCountry; + Tizen.System.SystemSettings.LocaleCountry = setValue; + var getValue = Tizen.System.SystemSettings.LocaleCountry; + Assert.IsTrue(setValue.CompareTo(getValue) == 0, "LocaleCountry_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.LocaleCountry = preValue; + LogUtils.WriteOK(); + } + + private static bool s_localeCountryCallbackCalled = false; + private static readonly string s_localeCountryValue = "en_US"; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:LocaleCountryChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.LocaleCountryChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task LocaleCountryChanged_CHECK_EVENT() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.LocaleCountryChanged += OnLocaleCountryChanged; + string preValue = Tizen.System.SystemSettings.LocaleCountry; + Tizen.System.SystemSettings.LocaleCountry = s_localeCountryValue; + await Task.Delay(2000); + Assert.IsTrue(s_localeCountryCallbackCalled, "LocaleCountryChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_localeCountryCallbackCalled = false; + Tizen.System.SystemSettings.LocaleCountryChanged -= OnLocaleCountryChanged; + Tizen.System.SystemSettings.LocaleCountry = s_localeCountryValue; + await Task.Delay(2000); + Assert.IsFalse(s_localeCountryCallbackCalled, "LocaleCountryChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.LocaleCountry = preValue; + LogUtils.WriteOK(); + } + private static void OnLocaleCountryChanged(object sender, Tizen.System.LocaleCountryChangedEventArgs e) + { + s_localeCountryCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnLocaleCountryChanged: LocaleCountry not an instance of string"); + Assert.IsTrue(s_localeCountryValue.CompareTo(e.Value) == 0, "OnLocaleCountryChanged: The callback should receive the latest value for the property."); + } + + // LocaleLanguage + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:LocaleLanguage is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.LocaleLanguage A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void LocaleLanguage_READ_WRITE() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.LocaleLanguage, "LocaleLanguage_READ_WRITE: LocaleLanguage not an instance of string"); + var setValue = "en_US"; + string preValue = Tizen.System.SystemSettings.LocaleLanguage; + Tizen.System.SystemSettings.LocaleLanguage = setValue; + var getValue = Tizen.System.SystemSettings.LocaleLanguage; + Assert.IsTrue(setValue.CompareTo(getValue) == 0, "LocaleLanguage_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.LocaleLanguage = preValue; + LogUtils.WriteOK(); + } + + private static bool s_localeLanguageCallbackCalled = false; + private static readonly string s_localeLanguageValue = "en_US"; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:LocaleLanguageChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.LocaleLanguageChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task LocaleLanguageChanged_CHECK_EVENT() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.LocaleLanguageChanged += OnLocaleLanguageChanged; + string preValue = Tizen.System.SystemSettings.LocaleLanguage; + Tizen.System.SystemSettings.LocaleLanguage = s_localeLanguageValue; + await Task.Delay(2000); + Assert.IsTrue(s_localeLanguageCallbackCalled, "LocaleLanguageChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_localeLanguageCallbackCalled = false; + Tizen.System.SystemSettings.LocaleLanguageChanged -= OnLocaleLanguageChanged; + Tizen.System.SystemSettings.LocaleLanguage = s_localeLanguageValue; + await Task.Delay(2000); + Assert.IsFalse(s_localeLanguageCallbackCalled, "LocaleLanguageChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.LocaleLanguage = preValue; + LogUtils.WriteOK(); + } + private static void OnLocaleLanguageChanged(object sender, Tizen.System.LocaleLanguageChangedEventArgs e) + { + s_localeLanguageCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnLocaleLanguageChanged: LocaleLanguage not an instance of string"); + Assert.IsTrue(s_localeLanguageValue.CompareTo(e.Value) == 0, "OnLocaleLanguageChanged: The callback should receive the latest value for the property."); + } + + // LocaleTimeformat24Hour + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:LocaleTimeFormat24HourEnabled is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void LocaleTimeFormat24HourEnabled_READ_WRITE() + { + LogUtils.StartTest(); + /* TEST CODE */ + bool preValue = Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled; + Assert.IsInstanceOf(Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled, "LocaleTimeFormat24HourEnabled_READ_WRITE: LocaleTimeFormat24HourEnabled not an instance of bool"); + Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled = true; + Assert.IsTrue(Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled, "LocaleTimeformat24Hour_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled = false; + Assert.IsFalse(Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled, "LocaleTimeformat24Hour_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled = preValue; + LogUtils.WriteOK(); + } + + private static bool s_timeFormatCallbackCalled = false; + private static bool s_localeTimeformat24HourValue = !Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:LocaleTimeFormat24HourSettingChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.LocaleTimeFormat24HourSettingChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task LocaleTimeFormat24HourSettingChanged_CHECK_EVENT() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.LocaleTimeFormat24HourSettingChanged += OnLocaleTimeformat24HourChanged; + bool preValue = Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled; + Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled = s_localeTimeformat24HourValue; + await Task.Delay(2000); + Assert.IsTrue(s_timeFormatCallbackCalled, "LocaleTimeFormat24HourSettingChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_timeFormatCallbackCalled = false; + + s_localeTimeformat24HourValue = !s_localeTimeformat24HourValue; + Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled = s_localeTimeformat24HourValue; + await Task.Delay(2000); + Assert.IsTrue(s_timeFormatCallbackCalled, "LocaleTimeFormat24HourSettingChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_timeFormatCallbackCalled = false; + + Tizen.System.SystemSettings.LocaleTimeFormat24HourSettingChanged -= OnLocaleTimeformat24HourChanged; + Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled = s_localeTimeformat24HourValue; + await Task.Delay(2000); + Assert.IsFalse(s_timeFormatCallbackCalled, "LocaleTimeFormat24HourSettingChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.LocaleTimeFormat24HourEnabled = preValue; + LogUtils.WriteOK(); + } + + private static void OnLocaleTimeformat24HourChanged(object sender, Tizen.System.LocaleTimeFormat24HourSettingChangedEventArgs e) + { + s_timeFormatCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnLocaleTimeformat24HourChanged: LocaleTimeFormat24HourEnabled not an instance of bool"); + Assert.IsTrue(e.Value == s_localeTimeformat24HourValue, "OnLocaleTimeformat24HourChanged: The callback should receive the latest value for the property."); + } + + // LocaleTimezone + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:LocaleTimeZone is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.LocaleTimeZone A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void LocaleTimeZone_READ_WRITE() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.LocaleTimeZone, "LocaleTimeZone_READ_WRITE: LocaleTimeZone not an instance of string"); + //var setValue = "Pacific/Tahiti"; + var setValue = "Asia/Seoul"; + string preValue = Tizen.System.SystemSettings.LocaleTimeZone; + Tizen.System.SystemSettings.LocaleTimeZone = setValue; + var getValue = Tizen.System.SystemSettings.LocaleTimeZone; + Assert.IsTrue(setValue.CompareTo(getValue) == 0, "LocaleTimezone_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.LocaleTimeZone = preValue; + LogUtils.WriteOK(); + } + + private static bool s_localeTimeZoneCallbackCalled = false; + private static readonly string s_localeTimeZoneValue = "Asia/Seoul"; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:LocaleTimeZoneChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.LocaleTimeZoneChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task LocaleTimeZoneChanged_CHECK_EVENT() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.LocaleTimeZoneChanged += OnLocaleTimeZoneChanged; + string preValue = Tizen.System.SystemSettings.LocaleTimeZone; + Tizen.System.SystemSettings.LocaleTimeZone = s_localeTimeZoneValue; + await Task.Delay(2000); + Assert.IsTrue(s_localeTimeZoneCallbackCalled, "LocaleTimeZoneChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_localeTimeZoneCallbackCalled = false; + + Tizen.System.SystemSettings.LocaleTimeZoneChanged -= OnLocaleTimeZoneChanged; + Tizen.System.SystemSettings.LocaleTimeZone = s_localeTimeZoneValue; + await Task.Delay(2000); + Assert.IsFalse(s_localeTimeZoneCallbackCalled, "LocaleTimeZoneChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.LocaleTimeZone = preValue; + LogUtils.WriteOK(); + } + private static void OnLocaleTimeZoneChanged(object sender, Tizen.System.LocaleTimeZoneChangedEventArgs e) + { + s_localeTimeZoneCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnLocaleTimeZoneChanged: LocaleTimeZone not an instance of string"); + Assert.IsTrue(s_localeTimeZoneValue.CompareTo(e.Value) == 0, "OnLocaleTimezoneChanged: The callback should receive the latest value for the property."); + } + + // SoundLock + //[Test] + //[Category("P1")] + //[Description("Test if get for SystemSettings:SoundLockEnabled is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.SoundLockEnabled A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void SoundLockEnabled_READ_ONLY() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.SoundLockEnabled, "SoundLockEnabled_READ_ONLY: SoundLockEnabled not an instance of bool"); + LogUtils.WriteOK(); + } + + // SoundSilentMode + //[Test] + //[Category("P1")] + //[Description("Test if get for SystemSettings:SoundSilentModeEnabled is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.SoundSilentModeEnabled A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void SoundSilentModeEnabled_READ_ONLY() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.SoundSilentModeEnabled, "SoundSilentModeEnabled_READ_ONLY: SoundSilentModeEnabled not an instance of bool"); + LogUtils.WriteOK(); + } + + // SoundTouch + //[Test] + //[Category("P1")] + //[Description("Test if get for SystemSettings:SoundTouchEnabled is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.SoundTouchEnabled A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void SoundTouchEnabled_READ_ONLY() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.SoundTouchEnabled, "SoundTouchEnabled_READ_ONLY: SoundTouchEnabled not an instance of bool"); + LogUtils.WriteOK(); + } + + // DisplayScreenRotationAuto + //[Test] + //[Category("P1")] + //[Description("Test if get for SystemSettings:DisplayScreenRotationAutoEnabled is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.DisplayScreenRotationAutoEnabled A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void DisplayScreenRotationAutoEnabled_READ_ONLY() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.DisplayScreenRotationAutoEnabled, "DisplayScreenRotationAutoEnabled_READ_ONLY: DisplayScreenRotationAutoEnabled not an instance of bool"); + LogUtils.WriteOK(); + } + + // DeviceName + //[Test] + //[Category("P1")] + //[Description("Test if get for SystemSettings:DeviceName is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.DeviceName A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void DeviceName_READ_ONLY() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsNotNull(Tizen.System.SystemSettings.DeviceName, "DeviceName_READ_ONLY: DeviceName is null"); + Assert.IsInstanceOf(Tizen.System.SystemSettings.DeviceName, "DeviceName_READ_ONLY: DeviceName not an instance of string"); + Assert.IsFalse(Tizen.System.SystemSettings.DeviceName.CompareTo("") == 0, "DeviceName_READ_ONLY: Device name is empty"); + LogUtils.WriteOK(); + } + + // MotionEnabled + //[Test] + //[Category("P1")] + //[Description("Test if get for SystemSettings:MotionEnabled is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.MotionEnabled A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void MotionEnabled_READ_ONLY() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.MotionEnabled, "MotionEnabled_READ_ONLY: MotionEnabled not an instance of bool"); + LogUtils.WriteOK(); + } + + // NetworkWifiNotification + //[Test] + //[Category("P1")] + //[Description("Test if get for SystemSettings:NetworkWifiNotificationEnabled is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.NetworkWifiNotificationEnabled A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void NetworkWifiNotificationEnabled_READ_ONLY() + { + /* TEST CODE */ + try + { + LogUtils.StartTest(); + Assert.IsInstanceOf(Tizen.System.SystemSettings.NetworkWifiNotificationEnabled, "NetworkWifiNotificationEnabled_READ_ONLY: NetworkWifiNotificationEnabled not an instance of bool"); + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/network.wifi", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.wifi)"); + LogUtils.NotSupport(); + } + } + + // NetworkFlightMode + //[Test] + //[Category("P1")] + //[Description("Test if get for SystemSettings:NetworkFlightModeEnabled is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.NetworkFlightModeEnabled A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void NetworkFlightModeEnabled_READ_ONLY() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.NetworkFlightModeEnabled, "NetworkFlightModeEnabled_READ_ONLY: NetworkFlightModeEnabled not an instance of bool"); + LogUtils.WriteOK(); + } + + // ScreenBacklightTime + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:ScreenBacklightTime is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.ScreenBacklightTime A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void ScreenBacklightTime_READ_WRITE_ALL() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.ScreenBacklightTime, "ScreenBacklightTime_READ_WRITE_ALL: ScreenBacklightTime not an instance of int"); + var setValue = 15; + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = setValue; + var getValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Assert.IsTrue(setValue == getValue, "ScreenBacklightTime_READ_WRITE_ALL: Set value and get value of the property should be same."); + + setValue = 30; + Tizen.System.SystemSettings.ScreenBacklightTime = setValue; + getValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Assert.IsTrue(setValue == getValue, "ScreenBacklightTime_READ_WRITE_ALL: Set value and get value of the property should be same."); + + setValue = 60; + Tizen.System.SystemSettings.ScreenBacklightTime = setValue; + getValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Assert.IsTrue(setValue == getValue, "ScreenBacklightTime_READ_WRITE_ALL: Set value and get value of the property should be same."); + + setValue = 120; + Tizen.System.SystemSettings.ScreenBacklightTime = setValue; + getValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Assert.IsTrue(setValue == getValue, "ScreenBacklightTime_READ_WRITE_ALL: Set value and get value of the property should be same."); + + setValue = 300; + Tizen.System.SystemSettings.ScreenBacklightTime = setValue; + getValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Assert.IsTrue(setValue == getValue, "ScreenBacklightTime_READ_WRITE_ALL: Set value and get value of the property should be same."); + + setValue = 600; + Tizen.System.SystemSettings.ScreenBacklightTime = setValue; + getValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Assert.IsTrue(setValue == getValue, "ScreenBacklightTime_READ_WRITE_ALL: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + } + private static bool s_screenBacklightTime15CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:ScreenBacklightTimeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.ScreenBacklightTimeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task ScreenBacklightTimeChanged_CHECK_EVENT_15() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime15Changed; + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 15; + await Task.Delay(2000); + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime15Changed; + Assert.IsTrue(s_screenBacklightTime15CallbackCalled, "ScreenBacklightTimeChanged_CHECK_EVENT_15: EventHandler added. Not getting called"); + s_screenBacklightTime15CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + } + private static void OnScreenBacklightTime15Changed(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime15CallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime15Changed: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 15, "OnScreenBacklightTime15Changed: The callback should receive the latest value for the property."); + } + + private static bool s_screenBacklightTime30CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:ScreenBacklightTimeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.ScreenBacklightTimeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task ScreenBacklightTimeChanged_CHECK_EVENT_30() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime30Changed; + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 30; + await Task.Delay(2000); + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime30Changed; + Assert.IsTrue(s_screenBacklightTime30CallbackCalled, "ScreenBacklightTimeChanged_CHECK_EVENT_30: EventHandler added. Not getting called"); + s_screenBacklightTime30CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + } + private static void OnScreenBacklightTime30Changed(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime30CallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime30Changed: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 30, "OnScreenBacklightTime30Changed: The callback should receive the latest value for the property."); + } + + private static bool s_screenBacklightTime60CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:ScreenBacklightTimeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.ScreenBacklightTimeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task ScreenBacklightTimeChanged_CHECK_EVENT_60() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime60Changed; + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 60; + await Task.Delay(2000); + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime60Changed; + Assert.IsTrue(s_screenBacklightTime60CallbackCalled, "ScreenBacklightTimeChanged_CHECK_EVENT_60: EventHandler added. Not getting called"); + s_screenBacklightTime60CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + } + private static void OnScreenBacklightTime60Changed(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime60CallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime60Changed: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 60, "OnScreenBacklightTime60Changed: The callback should receive the latest value for the property."); + } + + private static bool s_screenBacklightTime120CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:ScreenBacklightTimeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.ScreenBacklightTimeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task ScreenBacklightTimeChanged_CHECK_EVENT_120() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime120Changed; + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 120; + await Task.Delay(2000); + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime120Changed; + Assert.IsTrue(s_screenBacklightTime120CallbackCalled, "ScreenBacklightTimeChanged_CHECK_EVENT_120: EventHandler added. Not getting called"); + s_screenBacklightTime120CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + } + private static void OnScreenBacklightTime120Changed(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime120CallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime120Changed: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 120, "OnScreenBacklightTime120Changed: The callback should receive the latest value for the property."); + } + + private static bool s_screenBacklightTime300CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:ScreenBacklightTimeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.ScreenBacklightTimeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task ScreenBacklightTimeChanged_CHECK_EVENT_300() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime300Changed; + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 300; + await Task.Delay(2000); + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime300Changed; + Assert.IsTrue(s_screenBacklightTime300CallbackCalled, "ScreenBacklightTimeChanged_CHECK_EVENT_300: EventHandler added. Not getting called"); + s_screenBacklightTime300CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + } + private static void OnScreenBacklightTime300Changed(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime300CallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime300Changed: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 300, "OnScreenBacklightTime300Changed: The callback should receive the latest value for the property."); + } + + private static bool s_screenBacklightTime600CallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:ScreenBacklightTimeChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.ScreenBacklightTimeChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task ScreenBacklightTimeChanged_CHECK_EVENT_600() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.ScreenBacklightTimeChanged += OnScreenBacklightTime600Changed; + int preValue = Tizen.System.SystemSettings.ScreenBacklightTime; + Tizen.System.SystemSettings.ScreenBacklightTime = 600; + await Task.Delay(2000); + Tizen.System.SystemSettings.ScreenBacklightTimeChanged -= OnScreenBacklightTime600Changed; + Assert.IsTrue(s_screenBacklightTime600CallbackCalled, "ScreenBacklightTimeChanged_CHECK_EVENT_600: EventHandler added. Not getting called"); + s_screenBacklightTime600CallbackCalled = false; + Tizen.System.SystemSettings.ScreenBacklightTime = preValue; + LogUtils.WriteOK(); + } + private static void OnScreenBacklightTime600Changed(object sender, Tizen.System.ScreenBacklightTimeChangedEventArgs e) + { + s_screenBacklightTime600CallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnScreenBacklightTime600Changed: ScreenBacklightTime not an instance of int"); + Assert.IsTrue(e.Value == 600, "OnScreenBacklightTime600Changed; The callback should receive the latest value for the property."); + } + + // SoundNotification + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:SoundNotification is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.SoundNotification A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void SoundNotification_READ_WRITE() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.SoundNotification, "SoundNotification_READ_WRITE: SoundNotification not an instance of string"); + var setValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.SoundNotification); + string preValue = Tizen.System.SystemSettings.SoundNotification; + Tizen.System.SystemSettings.SoundNotification = setValue; + var getValue = Tizen.System.SystemSettings.SoundNotification; + Assert.IsTrue(setValue.CompareTo(getValue) == 0, "SoundNotification_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.SoundNotification = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.incoming_call", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.incoming_call)"); + LogUtils.NotSupport(); + } + } + + private static bool s_soundNotificationCallbackCalled = false; + private static readonly string s_soundNotificationValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.SoundNotification); + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:SoundNotificationChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.SoundNotificationChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task SoundNotificationChanged_CHECK_EVENT() + { + try { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.SoundNotificationChanged += OnSoundNotificationChanged; + string preValue = Tizen.System.SystemSettings.SoundNotification; + Tizen.System.SystemSettings.SoundNotification = s_soundNotificationValue; + await Task.Delay(2000); + Assert.IsTrue(s_soundNotificationCallbackCalled, "SoundNotificationChanged_CHECK_EVENT: EventHandler added. Not getting called"); + + s_soundNotificationCallbackCalled = false; + Tizen.System.SystemSettings.SoundNotificationChanged -= OnSoundNotificationChanged; + Tizen.System.SystemSettings.SoundNotification = s_soundNotificationValue; + await Task.Delay(2000); + Assert.IsFalse(s_soundNotificationCallbackCalled, "SoundNotificationChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.SoundNotification = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.incoming_call", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.incoming_call)"); + LogUtils.NotSupport(); + } + } + private static void OnSoundNotificationChanged(object sender, Tizen.System.SoundNotificationChangedEventArgs e) + { + s_soundNotificationCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnSoundNotificationChanged: SoundNotification not an instance of string"); + Assert.IsTrue(s_soundNotificationValue.CompareTo(e.Value) == 0, "OnSoundNotificationChanged: The callback should receive the latest value for the property."); + } + + // SoundNotificationRepetitionPeriod + ////[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:SoundNotificationRepetitionPeriod is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void SoundNotificationRepetitionPeriod_READ_WRITE() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod, "SoundNotificationRepetitionPeriod_READ_WRITE: SoundNotificationRepetitionPeriod not an instance of int"); + var setValue = 300; + int preValue = Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod; + Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod = setValue; + var getValue = Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod; + Assert.IsTrue(setValue.CompareTo(getValue) == 0, "SoundNotificationRepetitionPeriod_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod = preValue; + LogUtils.WriteOK(); + } + + private static bool s_soundNotificationRepetitionPeriodCallbackCalled = false; + private static readonly int s_soundNotificationRepetitionPeriodValue = 300; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:SoundNotificationRepetitionPeriodChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.SoundNotificationRepetitionPeriodChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task SoundNotificationRepetitionPeriodChanged_CHECK_EVENT() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.SoundNotificationRepetitionPeriodChanged += OnSoundNotificationRepetitionPeriodChanged; + int preValue = Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod; + Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod = s_soundNotificationRepetitionPeriodValue; + await Task.Delay(2000); + Assert.IsTrue(s_soundNotificationRepetitionPeriodCallbackCalled, "SoundNotificationRepetitionPeriodChanged_CHECK_EVENT: EventHandler added. Not getting called"); + s_soundNotificationRepetitionPeriodCallbackCalled = false; + + Tizen.System.SystemSettings.SoundNotificationRepetitionPeriodChanged -= OnSoundNotificationRepetitionPeriodChanged; + Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod = s_soundNotificationRepetitionPeriodValue; + await Task.Delay(2000); + Assert.IsFalse(s_soundNotificationRepetitionPeriodCallbackCalled, "SoundNotificationRepetitionPeriodChanged_CHECK_EVENT: EventHandler removed. Still getting called"); + Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod = preValue; + LogUtils.WriteOK(); + } + private static void OnSoundNotificationRepetitionPeriodChanged(object sender, Tizen.System.SoundNotificationRepetitionPeriodChangedEventArgs e) + { + s_soundNotificationRepetitionPeriodCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnSoundNotificationRepetitionPeriodChanged: SoundNotificationRepetitionPeriod not an instance of int"); + Assert.IsTrue(s_soundNotificationRepetitionPeriodValue.CompareTo(e.Value) == 0, "OnSoundNotificationRepetitionPeriodChanged: The callback should receive the latest value for the property."); + } + + // LockState + // //[Test] + //[Category("P1")] + //[Description("Test if set/get for SystemSettings:LockState is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.LockState A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRE")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void LockState_READ_WRITE_ALL() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.LockState, "LockState_READ_WRITE_ALL: LockState not an instance of SystemSettingsIdleLockState"); + SystemSettingsIdleLockState preValue = Tizen.System.SystemSettings.LockState; + var setValue = Tizen.System.SystemSettingsIdleLockState.Unlock; + Tizen.System.SystemSettings.LockState = setValue; + var getValue = Tizen.System.SystemSettings.LockState; + Assert.IsTrue(setValue == getValue, "LockState_READ_WRITE_ALL: Set value and get value of the property should be same."); + + setValue = Tizen.System.SystemSettingsIdleLockState.Lock; + Tizen.System.SystemSettings.LockState = setValue; + getValue = Tizen.System.SystemSettings.LockState; + Assert.IsTrue(setValue == getValue, "LockState_READ_WRITE_ALL: Set value and get value of the property should be same."); + + setValue = Tizen.System.SystemSettingsIdleLockState.LaunchingLock; + Tizen.System.SystemSettings.LockState = setValue; + getValue = Tizen.System.SystemSettings.LockState; + Assert.IsTrue(setValue == getValue, "LockState_READ_WRITE_ALL: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.LockState = preValue; + LogUtils.WriteOK(); + } + + private static bool s_lockStateLockCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:LockStateChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.LockStateChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task LockStateChanged_CHECK_EVENT_LOCK() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.LockStateChanged += OnLockStateChangedLock; + SystemSettingsIdleLockState preValue = Tizen.System.SystemSettings.LockState; + Tizen.System.SystemSettings.LockState = Tizen.System.SystemSettingsIdleLockState.Lock; + await Task.Delay(2000); + Assert.IsTrue(s_lockStateLockCallbackCalled, "LockStateChanged_CHECK_EVENT_LOCK: EventHandler added. Not getting called"); + Tizen.System.SystemSettings.LockStateChanged -= OnLockStateChangedLock; + s_lockStateLockCallbackCalled = false; + Tizen.System.SystemSettings.LockState = preValue; + LogUtils.WriteOK(); + } + private static void OnLockStateChangedLock(object sender, Tizen.System.LockStateChangedEventArgs e) + { + s_lockStateLockCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnLockStateChangedLock: LockState not an instance of SystemSettingsIdleLockState"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsIdleLockState.Lock, "OnLockStateChangedLock: The callback should receive the latest value for the property."); + } + + private static bool s_lockStateUnlockCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:LockStateChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.LockStateChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task LockStateChanged_CHECK_EVENT_UNLOCK() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.LockStateChanged += OnLockStateChangedUnlock; + SystemSettingsIdleLockState preValue = Tizen.System.SystemSettings.LockState; + Tizen.System.SystemSettings.LockState = Tizen.System.SystemSettingsIdleLockState.Unlock; + await Task.Delay(2000); + Tizen.System.SystemSettings.LockStateChanged -= OnLockStateChangedUnlock; + Assert.IsTrue(s_lockStateUnlockCallbackCalled, "LockStateChanged_CHECK_EVENT_UNLOCK: EventHandler added. Not getting called"); + s_lockStateLockCallbackCalled = false; + Tizen.System.SystemSettings.LockState = preValue; + LogUtils.WriteOK(); + } + private static void OnLockStateChangedUnlock(object sender, Tizen.System.LockStateChangedEventArgs e) + { + s_lockStateUnlockCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnLockStateChangedUnlock: LockState not an instance of SystemSettingsIdleLockState"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsIdleLockState.Unlock, "OnLockStateChangedUnlock: The callback should receive the latest value for the property."); + } + + private static bool s_lockStateLaunchingLockCallbackCalled = false; + ////[Test] + //[Category("P1")] + //[Description("Check if callback to SystemSettings:LockStateChanged event is called")] + //[Property("SPEC", "Tizen.System.SystemSettings.LockStateChanged E")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "EVL")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task LockStateChanged_CHECK_EVENT_LAUNCHING_LOCK() + { + LogUtils.StartTest(); + /* TEST CODE */ + Tizen.System.SystemSettings.LockStateChanged += OnLockStateChangedLaunchingLock; + SystemSettingsIdleLockState preValue = Tizen.System.SystemSettings.LockState; + Tizen.System.SystemSettings.LockState = Tizen.System.SystemSettingsIdleLockState.LaunchingLock; + await Task.Delay(2000); + Tizen.System.SystemSettings.LockStateChanged -= OnLockStateChangedLaunchingLock; + Assert.IsTrue(s_lockStateLaunchingLockCallbackCalled, "LockStateChanged_CHECK_EVENT_LAUNCHING_LOCK: EventHandler added. Not getting called"); + s_lockStateLockCallbackCalled = false; + Tizen.System.SystemSettings.LockState = preValue; + LogUtils.WriteOK(); + } + private static void OnLockStateChangedLaunchingLock(object sender, Tizen.System.LockStateChangedEventArgs e) + { + s_lockStateLaunchingLockCallbackCalled = true; + Assert.IsInstanceOf(e.Value, "OnLockStateChangedLaunchingLock: LockState not an instance of SystemSettingsIdleLockState"); + Assert.IsTrue(e.Value == Tizen.System.SystemSettingsIdleLockState.LaunchingLock, "OnLockStateChangedLaunchingLock: The callback should receive the latest value for the property."); + } + + // Time + //[Test] + //[Category("P1")] + //[Description("Test if get for SystemSettings:Time is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.Time A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void Time_READ_ONLY() + { + LogUtils.StartTest(); + /* TEST CODE */ + Assert.IsInstanceOf(Tizen.System.SystemSettings.Time, "Time_READ_ONLY: Time not an instance of int"); + var readValue = Tizen.System.SystemSettings.Time; + Assert.NotNull(readValue, "Should be readable"); + LogUtils.WriteOK(); + } + + // UsbDebuggingEnabled + ////[Test] + //[Category("P1")] + //[Description("Test if get for SystemSettings:UsbDebuggingEnabled is working properly")] + //[Property("SPEC", "Tizen.System.SystemSettings.UsbDebuggingEnabled A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void UsbDebuggingEnabled_READ_WRITE() + { + LogUtils.StartTest(); + /* TEST CODE */ + bool setValue = true; + bool preValue = Tizen.System.SystemSettings.UsbDebuggingEnabled; + Tizen.System.SystemSettings.UsbDebuggingEnabled = setValue; + Assert.IsTrue(Tizen.System.SystemSettings.UsbDebuggingEnabled, "UsbDebuggingEnabled_READ_WRITE: Set value and get value of the property should be same."); + Tizen.System.SystemSettings.UsbDebuggingEnabled = preValue; + LogUtils.WriteOK(); + } + + public static async void TestAllAsync() + { + + LogUtils.initWriteResult(); + IncomingCallRingtone_READ_WRITE(); + await IncomingCallRingtoneChanged_CHECK_EVENT(); + WallpaperHomeScreen_READ_WRITE(); + await WallpaperHomeScreenChanged_CHECK_EVENT(); + WallpaperLockScreen_READ_WRITE(); + await WallpaperLockScreenChanged_CHECK_EVENT(); + FontSize_READ_WRITE_ALL(); + await FontSizeChanged_CHECK_EVENT_SMALL(); + await FontSizeChanged_CHECK_EVENT_NORMAL(); + await FontSizeChanged_CHECK_EVENT_LARGE(); + await FontSizeChanged_CHECK_EVENT_HUGE(); + await FontSizeChanged_CHECK_EVENT_GIANT(); + FontType_READ_WRITE(); + await FontTypeChanged_CHECK_EVENT(); + MotionActivationEnabled_READ_WRITE(); + await MotionActivationSettingChanged_CHECK_EVENT(); + EmailAlertRingtone_READ_WRITE(); + await EmailAlertRingtoneChanged_CHECK_EVENT(); + Data3GNetworkEnabled_READ_WRITE(); + await Data3GNetworkSettingChanged_CHECK_EVENT(); + LockscreenApp_READ_WRITE(); + await LockscreenAppChanged_CHECK_EVENT(); + DefaultFontType_READ_ONLY(); + LocaleCountry_READ_WRITE(); + await LocaleCountryChanged_CHECK_EVENT(); + LocaleLanguage_READ_WRITE(); + await LocaleLanguageChanged_CHECK_EVENT(); + LocaleTimeFormat24HourEnabled_READ_WRITE(); + await LocaleTimeFormat24HourSettingChanged_CHECK_EVENT(); + LocaleTimeZone_READ_WRITE(); + await LocaleTimeZoneChanged_CHECK_EVENT(); + SoundLockEnabled_READ_ONLY(); + SoundSilentModeEnabled_READ_ONLY(); + SoundTouchEnabled_READ_ONLY(); + DisplayScreenRotationAutoEnabled_READ_ONLY(); + DeviceName_READ_ONLY(); + MotionEnabled_READ_ONLY(); + NetworkWifiNotificationEnabled_READ_ONLY(); + NetworkFlightModeEnabled_READ_ONLY(); + + SoundNotification_READ_WRITE(); + await SoundNotificationChanged_CHECK_EVENT(); + SoundNotificationRepetitionPeriod_READ_WRITE(); + await SoundNotificationRepetitionPeriodChanged_CHECK_EVENT(); + LockState_READ_WRITE_ALL(); + await LockStateChanged_CHECK_EVENT_LOCK(); + await LockStateChanged_CHECK_EVENT_UNLOCK(); + await LockStateChanged_CHECK_EVENT_LAUNCHING_LOCK(); + Time_READ_ONLY(); + UsbDebuggingEnabled_READ_WRITE(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "Data3GNetworkSettingChangedEventArgsTests"); + await Data3GNetworkSettingChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "EmailAlertRingtoneChangedEventArgsTests"); + await EmailAlertRingtoneChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "FontSizeChangedEventArgsTests"); + await FontSizeChangedEventArgsTests.Value_ENUM_GIANT(); + await FontSizeChangedEventArgsTests.Value_ENUM_HUGE(); + await FontSizeChangedEventArgsTests.Value_ENUM_LARGE(); + await FontSizeChangedEventArgsTests.Value_ENUM_NORMAL(); + await FontSizeChangedEventArgsTests.Value_ENUM_SMALL(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "FontTypeChangedEventArgsTests"); + await FontTypeChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "IncomingCallRingtoneChangedEventArgsTests"); + await IncomingCallRingtoneChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "LocaleCountryChangedEventArgsTests"); + await LocaleCountryChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "LocaleLanguageChangedEventArgsTests"); + await LocaleLanguageChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "LocaleTimeFormat24HourSettingChangedEventArgsTests"); + await LocaleTimeFormat24HourSettingChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "LocaleTimeZoneChangedEventArgsTests"); + await LocaleTimeZoneChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "LockStateChangedEventArgsTests"); + await LockStateChangedEventArgsTests.Value_ENUM_LAUNCHING_LOCK(); + await LockStateChangedEventArgsTests.Value_ENUM_LOCK(); + await LockStateChangedEventArgsTests.Value_ENUM_UNLOCK(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "MotionActivationSettingChangedEventArgsTests"); + await MotionActivationSettingChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "SoundNotificationChangedEventArgsTests"); + await SoundNotificationChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "SoundNotificationRepetitionPeriodChangedEventArgsTests"); + await SoundNotificationRepetitionPeriodChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "WallpaperHomeScreenChangedEventArgsTests"); + await WallpaperHomeScreenChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "WallpaperLockScreenChangedEventArgsTests"); + await WallpaperLockScreenChangedEventArgsTests.Value_PROPERTY_READ_ONLY(); + + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "BlackLightTime Test"); + ScreenBacklightTime_READ_WRITE_ALL(); + await ScreenBacklightTimeChanged_CHECK_EVENT_15(); + await ScreenBacklightTimeChanged_CHECK_EVENT_30(); + await ScreenBacklightTimeChanged_CHECK_EVENT_60(); + await ScreenBacklightTimeChanged_CHECK_EVENT_120(); + await ScreenBacklightTimeChanged_CHECK_EVENT_300(); + await ScreenBacklightTimeChanged_CHECK_EVENT_600(); + + + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "ScreenBacklightTimeChangedEventArgsTests"); + await ScreenBacklightTimeChangedEventArgsTests.Value_PROPERTY_READ_ONLY_120(); + await ScreenBacklightTimeChangedEventArgsTests.Value_PROPERTY_READ_ONLY_15(); + await ScreenBacklightTimeChangedEventArgsTests.Value_PROPERTY_READ_ONLY_30(); + await ScreenBacklightTimeChangedEventArgsTests.Value_PROPERTY_READ_ONLY_300(); + await ScreenBacklightTimeChangedEventArgsTests.Value_PROPERTY_READ_ONLY_60(); + await ScreenBacklightTimeChangedEventArgsTests.Value_PROPERTY_READ_ONLY_600(); + + LogUtils.WriteResult(); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", "All of Unit test for Tizen.System.SystemSettings have completed!"); + } + } +} + + diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSWallpaperHomeScreenChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSWallpaperHomeScreenChangedEventArgs.cs new file mode 100755 index 000000000..0ff5b948e --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSWallpaperHomeScreenChangedEventArgs.cs @@ -0,0 +1,63 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.WallpaperHomeScreenChangedEventArgs Tests")] + public static class WallpaperHomeScreenChangedEventArgsTests + { + private static bool s_wallpaperHomeScreenCallbackCalled = false; + private static readonly string s_wallpaperHomeScreenValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.WallpaperHomeScreen); + ////[Test] + //[Category("P1")] + //[Description("Check WallpaperHomeScreenChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.WallpaperHomeScreenChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + try { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.WallpaperHomeScreenChanged += OnWallpaperHomeScreenChangedValue; + + string preValue = Tizen.System.SystemSettings.WallpaperHomeScreen; + Tizen.System.SystemSettings.WallpaperHomeScreen = s_wallpaperHomeScreenValue; + await Task.Delay(2000); + Assert.IsTrue(s_wallpaperHomeScreenCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_wallpaperHomeScreenCallbackCalled = false; + Tizen.System.SystemSettings.WallpaperHomeScreenChanged -= OnWallpaperHomeScreenChangedValue; + Tizen.System.SystemSettings.WallpaperHomeScreen = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.home_screen", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.home_screen)"); + LogUtils.NotSupport(); + } + } + private static void OnWallpaperHomeScreenChangedValue(object sender, Tizen.System.WallpaperHomeScreenChangedEventArgs e) + { + s_wallpaperHomeScreenCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnWallpaperHomeScreenChangedValue: WallpaperHomeScreen not an instance of string"); + Assert.IsTrue(s_wallpaperHomeScreenValue.CompareTo(e.Value) == 0, "OnWallpaperHomeScreenChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSWallpaperLockScreenChangedEventArgs.cs b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSWallpaperLockScreenChangedEventArgs.cs new file mode 100755 index 000000000..43e1d3c2e --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/test/TSWallpaperLockScreenChangedEventArgs.cs @@ -0,0 +1,63 @@ +using System.Threading.Tasks; +using System; +using System.Threading; +using Tizen.System; + + +namespace SystemSettingsUnitTest +{ + //[TestFixture] + //[Description("Tizen.System.WallpaperLockScreenChangedEventArgs Tests")] + public static class WallpaperLockScreenChangedEventArgsTests + { + private static bool s_wallpaperLockScreenCallbackCalled = false; + private static readonly string s_wallpaperLockScreenValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.WallpaperLockScreen); + ////[Test] + //[Category("P1")] + //[Description("Check WallpaperLockScreenChangedEventArgs Value property")] + //[Property("SPEC", "Tizen.System.WallpaperLockScreenChangedEventArgs.Value A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRO")] + //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task Value_PROPERTY_READ_ONLY() + { + try { + LogUtils.StartTest(); + /* + * PRECONDITION + * 1. Assign event handler + */ + Tizen.System.SystemSettings.WallpaperLockScreenChanged += OnWallpaperLockScreenChangedValue; + + string preValue = Tizen.System.SystemSettings.WallpaperLockScreen; + Tizen.System.SystemSettings.WallpaperLockScreen = s_wallpaperLockScreenValue; + await Task.Delay(2000); + Assert.IsTrue(s_wallpaperLockScreenCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called"); + + /* + * POSTCONDITION + * 1. Reset callback called flag + * 2. Remove event handler + * 3. Reset property value + */ + s_wallpaperLockScreenCallbackCalled = false; + Tizen.System.SystemSettings.WallpaperLockScreenChanged -= OnWallpaperLockScreenChangedValue; + Tizen.System.SystemSettings.WallpaperLockScreen = preValue; + LogUtils.WriteOK(); + } catch (NotSupportedException) { + bool isSupport = true; + Information.TryGetValue("tizen.org/feature/systemsetting.lock_screen", out isSupport); + Assert.IsTrue(isSupport == false, "Invalid NotSupportedException"); + Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.lock_screen)"); + LogUtils.NotSupport(); + } + } + private static void OnWallpaperLockScreenChangedValue(object sender, Tizen.System.WallpaperLockScreenChangedEventArgs e) + { + s_wallpaperLockScreenCallbackCalled = true; + /* TEST CODE */ + Assert.IsInstanceOf(e.Value, "OnWallpaperLockScreenChangedValue: WallpaperLockScreen not an instance of string"); + Assert.IsTrue(s_wallpaperLockScreenValue.CompareTo(e.Value) == 0, "OnWallpaperLockScreenChangedValue: The callback should receive the latest value for the property."); + } + } +} diff --git a/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/tizen-manifest.xml b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/tizen-manifest.xml new file mode 100755 index 000000000..1838a1da2 --- /dev/null +++ b/test/Tizen.System.SystemSettings.UnitTest/SystemSettings.UnitTest/tizen-manifest.xml @@ -0,0 +1,19 @@ + + + + + + SystemSettings_UnitTest.png + + + + + + http://tizen.org/privilege/systemsettings.admin + + + true + true + true + true +