-using NUnit.Framework;\r
-using NUnit.Framework.TUnit;\r
-using System;\r
-using Tizen.NUI;\r
-using Tizen.NUI.Components;\r
-using Tizen.NUI.BaseComponents;\r
-using System.Runtime.InteropServices;\r
-using System.Threading.Tasks;\r
-using Tizen.NUI.Components.Test;\r
-\r
-namespace Tizen.NUI.Components.Tests\r
-{\r
- [TestFixture]\r
- [Description("Tizen.NUI.Components.Popup Tests")]\r
- public class PopupTests\r
- {\r
- private const string TAG = "Components";\r
- private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";\r
- private string _path = Tizen.Applications.Application.Current.DirectoryInfo.Resource;\r
- private static bool _flagGetViewStyle = false;\r
- private static bool _flagOnThemeChangedEvent = false;\r
-\r
- [SetUp]\r
- public void Init()\r
- {\r
- Tizen.Log.Info(TAG, "Init() is called!");\r
- }\r
-\r
- [TearDown]\r
- public void Destroy()\r
- {\r
- Tizen.Log.Info(TAG, "Destroy() is called!");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test Popup empty constructor. Check it has been triggered")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.Popup C")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "CONSTR")]\r
- [Property("COVPARAM", "")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void Popup_CHECK_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test Popup constructor using string. Check whether Popup is successfully created or not.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.Popup C")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "CONSTR")]\r
- [Property("COVPARAM", "string")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void Popup_INIT_WITH_STRING()\r
- {\r
- /* TEST CODE */\r
- StyleManager.Instance.Theme = "default";\r
- StyleManager.Instance.RegisterStyle("defaultPopup", "default", typeof(DefaultPopupStyle));\r
- var popup = new Popup("defaultPopup");\r
- Assert.IsNotNull(popup, "Should be not null!");\r
- Assert.IsInstanceOf<Popup>(popup, "Should be an instance of Popup!");\r
- }\r
-\r
- [Test]\r
- [Category("P2")]\r
- [Description("Check exception when constructing a Popup with nonexistent style")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.Popup C")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "CONSTX")]\r
- [Property("COVPARAM", "string")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void Popup_INIT_WITH_STRING_Exception()\r
- {\r
- /* TEST CODE */\r
- try\r
- {\r
- var popup = new Popup("defaultPopupX");\r
- Assert.Fail("Should throw the Exception: There is no style of defaultPopupX !");\r
- }\r
- catch(InvalidOperationException e)\r
- {\r
- if (e != null)\r
- {\r
- Assert.Pass("InvalidOperationException: passed!");\r
- }\r
- }\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test Popup constructor using style. Check whether Popup is successfully created or not.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.Popup C")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "CONSTR")]\r
- [Property("COVPARAM", "PopupStyle")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void Popup_INIT_WITH_STYLE()\r
- {\r
- /* TEST CODE */\r
- var style = new PopupStyle();\r
- Assert.IsNotNull(style, "Should be not null!");\r
- Assert.IsInstanceOf<PopupStyle>(style, "Should be an instance of PopupStyle!");\r
-\r
- var popup = new Popup(style);\r
- Assert.IsNotNull(popup, "Should be not null!");\r
- Assert.IsInstanceOf<Popup>(popup, "Should be an instance of Popup!");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test Style. Check whether Style is readable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.Style A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRO")]\r
- [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")]\r
- public void Style_CHECK_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Popup();\r
- Assert.IsNotNull(popup, "Should be not null");\r
- Assert.IsInstanceOf<Popup>(popup, "Should be an instance of Popup!");\r
-\r
- var style = popup.Style;\r
- Assert.IsNotNull(style, "Should be not null");\r
- Assert.IsInstanceOf<PopupStyle>(style, "Should be an instance of PopupStyle!");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test TitleText. Check whether TitleText is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.TitleText A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void TitleText_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- popup.TitleText = "Test TitleText";\r
- Assert.AreEqual("Test TitleText", popup.TitleText, "Should be equals to the set value of TitleText");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test ButtonCount. Check whether ButtonCount is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonCount A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void ButtonCount_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- popup.ButtonCount = 2;\r
- Assert.AreEqual(2, popup.ButtonCount, "Should be equals to the set value of ButtonCount");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test ContentView. Check whether ContentView is readable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.ContentView A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRO")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void ContentView_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup.ContentView, "Should be equals!");\r
- Assert.IsInstanceOf<BaseComponents.View>(popup.ContentView, "Should be an instance of view!");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test TitlePointSize. Check whether TitlePointSize is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.TitlePointSize A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void TitlePointSize_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- popup.TitlePointSize = 10.0f;\r
- Assert.AreEqual(10.0f, popup.TitlePointSize, "Should be equals to the set value of TitlePointSize");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test TitleTextColor. Check whether TitleTextColor is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.TitleTextColor A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void TitleTextColor_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- var color = new Color(1.0f, 0.0f, 0.0f, 1.0f);\r
- Assert.IsNotNull(color, "Should be not Null!");\r
- Assert.IsInstanceOf<Color>(color, "Should be equal!");\r
- popup.TitleTextColor = color;\r
-\r
- Assert.AreEqual(color.R, popup.TitleTextColor.R, "Should be equals to the color.R set");\r
- Assert.AreEqual(color.G, popup.TitleTextColor.G, "Should be equals to the color.G set");\r
- Assert.AreEqual(color.B, popup.TitleTextColor.B, "Should be equals to the color.B set");\r
- Assert.AreEqual(color.A, popup.TitleTextColor.A, "Should be equals to the color.A set");\r
-\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test TitleTextHorizontalAlignment. Check whether TitleTextHorizontalAlignment is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.TitleTextHorizontalAlignment A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void TitleTextHorizontalAlignment_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- popup.TitleTextHorizontalAlignment = HorizontalAlignment.Begin;\r
- Assert.AreEqual(HorizontalAlignment.Begin, popup.TitleTextHorizontalAlignment, "Should be equals to the set value of TitleTextHorizontalAlignment");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test TitleTextPosition. Check whether TitleTextPosition is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.TitleTextPosition A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void TitleTextPosition_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- popup.TitleTextPosition = new Position(10, 10);\r
-\r
- Assert.AreEqual(10, popup.TitleTextPosition.X, "Should be equal");\r
- Assert.AreEqual(10, popup.TitleTextPosition.Y, "Should be equal");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test TitleHeight. Check whether TitleHeight is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.TitleHeight A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void TitleHeight_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- popup.TitleHeight = 10;\r
- Assert.AreEqual(10, popup.TitleHeight, "Should be equals to the set value of TitleHeight");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test ButtonHeight. Check whether ButtonHeight is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonHeight A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void ButtonHeight_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- popup.ButtonHeight = 10;\r
- Assert.AreEqual(10, popup.ButtonHeight, "Should be equals to the set value of ButtonHeight");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test ButtonTextPointSize. Check whether ButtonTextPointSize is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonTextPointSize A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void ButtonTextPointSize_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- popup.ButtonTextPointSize = 10.0f;\r
- Assert.AreEqual(10.0f, popup.ButtonTextPointSize, "Should be equals to the set value of ButtonTextPointSize");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test ButtonFontFamily. Check whether ButtonFontFamily is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonFontFamily A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void ButtonFontFamily_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- popup.ButtonFontFamily = "SamsungOne 500";\r
- Assert.AreEqual("SamsungOne 500", popup.ButtonFontFamily, "Should be equals to the set value of ButtonFontFamily");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test ButtonTextAlignment. Check whether ButtonTextAlignment is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonTextAlignment A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void ButtonTextAlignment_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- popup.ButtonTextAlignment = HorizontalAlignment.Begin;\r
- Assert.AreEqual(HorizontalAlignment.Begin, popup.ButtonTextAlignment, "Should be equal");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test ButtonTextColor. Check whether ButtonTextColor is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonTextColor A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void ButtonTextColor_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var popup = new Components.Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
-\r
- var textColor = new Color(0.0f, 0.0f, 1.0f, 0.0f);\r
- Assert.IsNotNull(textColor, "Should be not Null!");\r
- Assert.IsInstanceOf<Color>(textColor, "Should be equal!");\r
- popup.ButtonTextColor = textColor;\r
-\r
- Assert.AreEqual(textColor.R, popup.ButtonTextColor.R, "Should be equal");\r
- Assert.AreEqual(textColor.G, popup.ButtonTextColor.G, "Should be equal");\r
- Assert.AreEqual(textColor.B, popup.ButtonTextColor.B, "Should be equal");\r
- Assert.AreEqual(textColor.A, popup.ButtonTextColor.A, "Should be equal");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test SetButtonText. Check it has been triggered")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.SetButtonText M")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "MCST")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void SetButtonText_CHECK_VALUE()\r
- {\r
- /* TEST CODE */\r
- try\r
- {\r
- Popup popup = new Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
- popup.SetButtonText(0, "YES");\r
- }\r
- catch (Exception e)\r
- {\r
- Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());\r
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());\r
- Assert.Fail("Caught Exception" + e.ToString());\r
- }\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test Dispose, try to dispose the Popup.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.Dispose M")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "MCST")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void Dispose_TEST()\r
- {\r
- /* TEST CODE */\r
- try\r
- {\r
- Popup popup = new Popup();\r
- Assert.IsNotNull(popup, "Should be not Null!");\r
- Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");\r
- popup.Dispose();\r
- }\r
- catch (Exception e)\r
- {\r
- Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());\r
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());\r
- Assert.Fail("Caught Exception" + e.ToString());\r
- }\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test AddButton. Check whether AddButton works or not.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.AddButton M")]\r
- [Property("SPEC_URL", " - ")]\r
- [Property("CRITERIA", "MR")]\r
- [Property("COVPARAM", "string, string")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void AddButton_WITH_STRING_STRING()\r
- {\r
- try\r
- {\r
- var popup = new Popup();\r
- var style = new ButtonStyle();\r
- popup.AddButton("button1", "button");\r
- }\r
- catch (Exception e)\r
- {\r
- Assert.Fail("Caught Exception" + e.ToString());\r
- }\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test AddButton. Check whether AddButton works or not.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.AddButton M")]\r
- [Property("SPEC_URL", " - ")]\r
- [Property("CRITERIA", "MR")]\r
- [Property("COVPARAM", "string, ButtonStyle")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void AddButton_WITH_STRING_STYLE()\r
- {\r
- try\r
- {\r
- var popup = new Popup();\r
- var style = new ButtonStyle();\r
- popup.AddButton("button1", style);\r
- }\r
- catch (Exception e)\r
- {\r
- Assert.Fail("Caught Exception" + e.ToString());\r
- }\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test ApplyStyle. Check whether ApplyStyle works or not.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.ApplyStyle M")]\r
- [Property("SPEC_URL", " - ")]\r
- [Property("CRITERIA", "MR")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void ApplyStyle_NO_RETURN_VALUE()\r
- {\r
- try\r
- {\r
- var popup = new Popup();\r
- var style = new ButtonStyle();\r
- popup.ApplyStyle(style);\r
- }\r
- catch (Exception e)\r
- {\r
- Assert.Fail("Caught Exception" + e.ToString());\r
- }\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test GetViewStyle. Check whether GetViewStyle works or not.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.GetViewStyle M")]\r
- [Property("SPEC_URL", " - ")]\r
- [Property("CRITERIA", "MR")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void GetViewStyle_CHECK_RETURN_VALUE()\r
- {\r
- try\r
- {\r
- _flagGetViewStyle = false;\r
- var popup = new MyPopup();\r
- var style = popup.Style;\r
- Assert.IsNotNull(style, "Should be not null");\r
- Assert.IsTrue(_flagGetViewStyle, "Should be true!");\r
- }\r
- catch (Exception e)\r
- {\r
- Assert.Fail("Caught Exception" + e.ToString());\r
- }\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test OnThemeChangedEvent. Check whether OnThemeChangedEvent works or not.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Popup.OnThemeChangedEvent M")]\r
- [Property("SPEC_URL", " - ")]\r
- [Property("CRITERIA", "MR")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void OnThemeChangedEvent_CHECK_RETURN_VALUE()\r
- {\r
- try\r
- {\r
- _flagOnThemeChangedEvent = false;\r
- StyleManager.Instance.Theme = "Family";\r
- var popup = new MyPopup();\r
- StyleManager.Instance.Theme = "Food";\r
- Assert.IsNotNull(popup, "Should be not null");\r
- Assert.IsTrue(_flagOnThemeChangedEvent, "Should be true!");\r
- }\r
- catch (Exception e)\r
- {\r
- Assert.Fail("Caught Exception" + e.ToString());\r
- }\r
- }\r
-\r
- public class MyPopup : Popup\r
- {\r
- public MyPopup () : base() {}\r
-\r
- protected override ViewStyle GetViewStyle()\r
- {\r
- _flagGetViewStyle = true;\r
- return base.GetViewStyle();\r
- }\r
-\r
- protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)\r
- {\r
- _flagOnThemeChangedEvent = true;\r
- }\r
- }\r
-\r
- public class DefaultPopupStyle : StyleBase\r
- {\r
- protected override ViewStyle GetViewStyle()\r
- {\r
- return new PopupStyle();\r
- }\r
- }\r
- }\r
-}\r
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using Tizen.NUI.Components.Test;
+
+namespace Tizen.NUI.Components.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.Components.Popup Tests")]
+ public class PopupTests
+ {
+ private const string TAG = "Components";
+ private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
+ private string _path = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+ private static bool _flagOnThemeChangedEvent = false;
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Popup empty constructor. Check it has been triggered")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.Popup C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void Popup_CHECK_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Popup constructor using string. Check whether Popup is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.Popup C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Popup_INIT_WITH_STRING()
+ {
+ /* TEST CODE */
+ StyleManager.Instance.Theme = "default";
+ StyleManager.Instance.RegisterStyle("defaultPopup", "default", typeof(DefaultPopupStyle));
+ var popup = new Popup("defaultPopup");
+ Assert.IsNotNull(popup, "Should be not null!");
+ Assert.IsInstanceOf<Popup>(popup, "Should be an instance of Popup!");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check exception when constructing a Popup with nonexistent style")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.Popup C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTX")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Popup_INIT_WITH_STRING_Exception()
+ {
+ /* TEST CODE */
+ try
+ {
+ var popup = new Popup("defaultPopupX");
+ Assert.Fail("Should throw the Exception: There is no style of defaultPopupX !");
+ }
+ catch(InvalidOperationException e)
+ {
+ Assert.Pass("InvalidOperationException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Popup constructor using style. Check whether Popup is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.Popup C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "PopupStyle")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Popup_INIT_WITH_STYLE()
+ {
+ /* TEST CODE */
+ var style = new PopupStyle();
+ Assert.IsNotNull(style, "Should be not null!");
+ Assert.IsInstanceOf<PopupStyle>(style, "Should be an instance of PopupStyle!");
+
+ var popup = new Popup(style);
+ Assert.IsNotNull(popup, "Should be not null!");
+ Assert.IsInstanceOf<Popup>(popup, "Should be an instance of Popup!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Style. Check whether Style is readable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.Style A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")]
+ public void Style_CHECK_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Popup();
+ Assert.IsNotNull(popup, "Should be not null");
+ Assert.IsInstanceOf<Popup>(popup, "Should be an instance of Popup!");
+
+ var style = popup.Style;
+ Assert.IsNotNull(style, "Should be not null");
+ Assert.IsInstanceOf<PopupStyle>(style, "Should be an instance of PopupStyle!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test TitleText. Check whether TitleText is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.TitleText A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void TitleText_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ popup.TitleText = "Test TitleText";
+ Assert.AreEqual("Test TitleText", popup.TitleText, "Should be equals to the set value of TitleText");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ButtonCount. Check whether ButtonCount is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonCount A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void ButtonCount_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ popup.ButtonCount = 2;
+ Assert.AreEqual(2, popup.ButtonCount, "Should be equals to the set value of ButtonCount");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ContentView. Check whether ContentView is readable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.ContentView A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void ContentView_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup.ContentView, "Should be equals!");
+ Assert.IsInstanceOf<BaseComponents.View>(popup.ContentView, "Should be an instance of view!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test TitlePointSize. Check whether TitlePointSize is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.TitlePointSize A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void TitlePointSize_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ popup.TitlePointSize = 10.0f;
+ Assert.AreEqual(10.0f, popup.TitlePointSize, "Should be equals to the set value of TitlePointSize");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test TitleTextColor. Check whether TitleTextColor is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.TitleTextColor A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void TitleTextColor_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ var color = new Color(1.0f, 0.0f, 0.0f, 1.0f);
+ Assert.IsNotNull(color, "Should be not Null!");
+ Assert.IsInstanceOf<Color>(color, "Should be equal!");
+ popup.TitleTextColor = color;
+
+ Assert.AreEqual(color.R, popup.TitleTextColor.R, "Should be equals to the color.R set");
+ Assert.AreEqual(color.G, popup.TitleTextColor.G, "Should be equals to the color.G set");
+ Assert.AreEqual(color.B, popup.TitleTextColor.B, "Should be equals to the color.B set");
+ Assert.AreEqual(color.A, popup.TitleTextColor.A, "Should be equals to the color.A set");
+
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test TitleTextHorizontalAlignment. Check whether TitleTextHorizontalAlignment is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.TitleTextHorizontalAlignment A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void TitleTextHorizontalAlignment_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ popup.TitleTextHorizontalAlignment = HorizontalAlignment.Begin;
+ Assert.AreEqual(HorizontalAlignment.Begin, popup.TitleTextHorizontalAlignment, "Should be equals to the set value of TitleTextHorizontalAlignment");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test TitleTextPosition. Check whether TitleTextPosition is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.TitleTextPosition A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void TitleTextPosition_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ popup.TitleTextPosition = new Position(10, 10);
+
+ Assert.AreEqual(10, popup.TitleTextPosition.X, "Should be equal");
+ Assert.AreEqual(10, popup.TitleTextPosition.Y, "Should be equal");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test TitleHeight. Check whether TitleHeight is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.TitleHeight A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void TitleHeight_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ popup.TitleHeight = 10;
+ Assert.AreEqual(10, popup.TitleHeight, "Should be equals to the set value of TitleHeight");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ButtonHeight. Check whether ButtonHeight is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonHeight A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void ButtonHeight_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ popup.ButtonHeight = 10;
+ Assert.AreEqual(10, popup.ButtonHeight, "Should be equals to the set value of ButtonHeight");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ButtonTextPointSize. Check whether ButtonTextPointSize is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonTextPointSize A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void ButtonTextPointSize_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ popup.ButtonTextPointSize = 10.0f;
+ Assert.AreEqual(10.0f, popup.ButtonTextPointSize, "Should be equals to the set value of ButtonTextPointSize");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ButtonFontFamily. Check whether ButtonFontFamily is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonFontFamily A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void ButtonFontFamily_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ popup.ButtonFontFamily = "SamsungOne 500";
+ Assert.AreEqual("SamsungOne 500", popup.ButtonFontFamily, "Should be equals to the set value of ButtonFontFamily");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ButtonTextAlignment. Check whether ButtonTextAlignment is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonTextAlignment A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void ButtonTextAlignment_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ popup.ButtonTextAlignment = HorizontalAlignment.Begin;
+ Assert.AreEqual(HorizontalAlignment.Begin, popup.ButtonTextAlignment, "Should be equal");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ButtonTextColor. Check whether ButtonTextColor is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonTextColor A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void ButtonTextColor_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var popup = new Components.Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+
+ var textColor = new Color(0.0f, 0.0f, 1.0f, 0.0f);
+ Assert.IsNotNull(textColor, "Should be not Null!");
+ Assert.IsInstanceOf<Color>(textColor, "Should be equal!");
+ popup.ButtonTextColor = textColor;
+
+ Assert.AreEqual(textColor.R, popup.ButtonTextColor.R, "Should be equal");
+ Assert.AreEqual(textColor.G, popup.ButtonTextColor.G, "Should be equal");
+ Assert.AreEqual(textColor.B, popup.ButtonTextColor.B, "Should be equal");
+ Assert.AreEqual(textColor.A, popup.ButtonTextColor.A, "Should be equal");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SetButtonText. Check it has been triggered")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.SetButtonText M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void SetButtonText_CHECK_VALUE()
+ {
+ /* TEST CODE */
+ try
+ {
+ Popup popup = new Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+ popup.SetButtonText(0, "YES");
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Dispose, try to dispose the Popup.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.Dispose M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Dispose_TEST()
+ {
+ /* TEST CODE */
+ try
+ {
+ Popup popup = new Popup();
+ Assert.IsNotNull(popup, "Should be not Null!");
+ Assert.IsInstanceOf<Components.Popup>(popup, "Should be equal!");
+ popup.Dispose();
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test AddButton. Check whether AddButton works or not.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.AddButton M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void AddButton_WITH_STRING_STRING()
+ {
+ try
+ {
+ var popup = new Popup();
+ var style = new ButtonStyle();
+ popup.AddButton("button1", "button");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test AddButton. Check whether AddButton works or not.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.AddButton M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, ButtonStyle")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void AddButton_WITH_STRING_STYLE()
+ {
+ try
+ {
+ var popup = new Popup();
+ var style = new ButtonStyle();
+ popup.AddButton("button1", style);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ApplyStyle. Check whether ApplyStyle works or not.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.ApplyStyle M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void ApplyStyle_NO_RETURN_VALUE()
+ {
+ try
+ {
+ var popup = new Popup();
+ var style = new ButtonStyle();
+ popup.ApplyStyle(style);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test CreateViewStyle. Check whether CreateViewStyle works or not.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.CreateViewStyle M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void CreateViewStyle_CHECK_RETURN_VALUE()
+ {
+ try
+ {
+ var popup = new MyPopup();
+ ViewStyle style = popup.CreateMyViewStyle();
+ Assert.IsNotNull(style, "Should be not null");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test OnThemeChangedEvent. Check whether OnThemeChangedEvent works or not.")]
+ [Property("SPEC", "Tizen.NUI.Components.Popup.OnThemeChangedEvent M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void OnThemeChangedEvent_CHECK_RETURN_VALUE()
+ {
+ try
+ {
+ _flagOnThemeChangedEvent = false;
+ StyleManager.Instance.Theme = "Family";
+ var popup = new MyPopup();
+ StyleManager.Instance.Theme = "Food";
+ Assert.IsNotNull(popup, "Should be not null");
+ Assert.IsTrue(_flagOnThemeChangedEvent, "Should be true!");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ public class MyPopup : Popup
+ {
+ public MyPopup() : base() {}\r
+\r
+ public ViewStyle CreateMyViewStyle()
+ {
+ return base.CreateViewStyle();
+ }
+
+ protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ {
+ _flagOnThemeChangedEvent = true;
+ }
+ }
+
+ public class DefaultPopupStyle : StyleBase
+ {
+ protected override ViewStyle GetViewStyle()
+ {
+ return new PopupStyle();
+ }
+ }
+ }
+}
-using NUnit.Framework;\r
-using NUnit.Framework.TUnit;\r
-using System;\r
-using Tizen.NUI;\r
-using Tizen.NUI.BaseComponents;\r
-using Tizen.NUI.Components;\r
-using System.Runtime.InteropServices;\r
-using System.Threading.Tasks;\r
-using Tizen.NUI.Components.Test;\r
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using Tizen.NUI.Components.Test;
+
+namespace Tizen.NUI.Components.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.Components.Switch Tests")]
+ public class SwitchTests
+ {
+ private const string TAG = "Components";
+ private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
+ private static bool _flagOnThemeChangedEvent = false;
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Switch empty constructor. Check it has been triggered")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.Switch C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void Switch_CHECK_VALUE()
+ {
+ /* TEST CODE */
+ var _switch = new Switch();
+ Assert.IsNotNull(_switch, "Should be not null!");
+ Assert.IsInstanceOf<Switch>(_switch, "Should be an instance of Switch!");
+
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Switch constructor using string. Check whether Switch is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.Switch C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Switch_INIT_WITH_STRING()
+ {
+ /* TEST CODE */
+ StyleManager.Instance.Theme = "default";
+ StyleManager.Instance.RegisterStyle("defaultSwitch", "default", typeof(DefaultSwitchStyle));
+ var switch1 = new Switch("defaultSwitch");
+ Assert.IsNotNull(switch1, "Should be not null!");
+ Assert.IsInstanceOf<Switch>(switch1, "Should be an instance of Switch!");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check exception when constructing a Switch with nonexistent style.")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.Switch C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTX")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Switch_INIT_WITH_STRING_Exception()
+ {
+ /* TEST CODE */
+ try
+ {
+ var switch1 = new Switch("defaultSwitchX");
+ Assert.Fail("Should throw the Exception: There is no style of defaultSwitchX !");
+ }
+ catch(InvalidOperationException e)
+ {
+ Assert.Pass("InvalidOperationException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Switch constructor using style. Check whether Switch is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.Switch C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "SwitchStyle")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Switch_INIT_WITH_STYLE()
+ {
+ /* TEST CODE */
+ var style = new SwitchStyle();
+ Assert.IsNotNull(style, "Should be not null!");
+ Assert.IsInstanceOf<SwitchStyle>(style, "Should be an instance of SwitchStyle!");
+
+ var _switch = new Switch(style);
+ Assert.IsNotNull(_switch, "Should be not null!");
+ Assert.IsInstanceOf<Switch>(_switch, "Should be an instance of Switch!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Style. Check whether Style is readable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.Style A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")]
+ public void Style_CHECK_GET_VALUE()
+ {
+ /* TEST CODE */
+ var _switch = new Switch();
+ Assert.IsNotNull(_switch, "Should be not null");
+ Assert.IsInstanceOf<Switch>(_switch, "Should be an instance of Switch!");
+
+ var style = _switch.Style;
+ Assert.IsNotNull(style, "Should be not null");
+ Assert.IsInstanceOf<SwitchStyle>(style, "Should be an instance of SwitchStyle!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SwitchBackgroundImageURLSelector. Check whether SwitchBackgroundImageURLSelector is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchBackgroundImageURLSelector A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void SwitchBackgroundImageURLSelector_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var _switch = new Switch();
+ Assert.IsNotNull(_switch, "Should be not null!");
+ Assert.IsInstanceOf<Switch>(_switch, "Should be equal!");
+
+ StringSelector stringSelector = new StringSelector
+ {
+ Normal = _image_path,
+ Selected = _image_path,
+ };
+ Assert.IsNotNull(stringSelector, "Should be not null!");
+ Assert.IsInstanceOf<StringSelector>(stringSelector, "Should be equal!");
+
+ _switch.SwitchBackgroundImageURLSelector = stringSelector;
+ Assert.AreEqual(stringSelector.Normal, _switch.SwitchBackgroundImageURLSelector.Normal, "Should be equals to the set value of SwitchBackgroundImageURLSelector Normal");
+ Assert.AreEqual(stringSelector.Selected, _switch.SwitchBackgroundImageURLSelector.Selected, "Should be equals to the set value of SwitchBackgroundImageURLSelector Selected");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SwitchHandlerImageURL. Check whether SwitchHandlerImageURL is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchHandlerImageURL A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void SwitchHandlerImageURL_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var _switch = new Switch();
+ Assert.IsNotNull(_switch, "Should be not null!");
+ Assert.IsInstanceOf<Switch>(_switch, "Should be equal!");
+
+ _switch.SwitchHandlerImageURL = _image_path;
+ Assert.AreEqual(_image_path, _switch.SwitchHandlerImageURL, "Should be equals to the set value of SwitchHandlerImageURL");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SwitchHandlerImageURLSelector. Check whether SwitchHandlerImageURLSelector is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchHandlerImageURLSelector A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void SwitchHandlerImageURLSelector_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var _switch = new Switch();
+ Assert.IsNotNull(_switch, "Should be not null!");
+ Assert.IsInstanceOf<Switch>(_switch, "Should be equal!");
+
+ StringSelector stringSelector = new StringSelector
+ {
+ Normal = _image_path,
+ Selected = _image_path,
+ };
+ Assert.IsNotNull(stringSelector, "Should be not null!");
+ Assert.IsInstanceOf<StringSelector>(stringSelector, "Should be equal!");
+
+ _switch.SwitchHandlerImageURLSelector = stringSelector;
+ Assert.AreEqual(stringSelector.Normal, _switch.SwitchHandlerImageURLSelector.Normal, "Should be equals to the set value of SwitchHandlerImageURLSelector Normal");
+ Assert.AreEqual(stringSelector.Selected, _switch.SwitchHandlerImageURLSelector.Selected, "Should be equals to the set value of SwitchHandlerImageURLSelector Selected");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SwitchHandlerImageSize. Check whether SwitchHandlerImageSize is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchHandlerImageSize A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]
+ public void SwitchHandlerImageSize_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var _switch = new Switch();
+ Assert.IsNotNull(_switch, "Should be not null!");
+ Assert.IsInstanceOf<Switch>(_switch, "Should be equal!");
+
+ _switch.SwitchHandlerImageSize = new Size(10, 10);
+ Assert.AreEqual(10, _switch.SwitchHandlerImageSize.Width, "Should be equals to the set value of SwitchHandlerImageSize2D.Width");
+ Assert.AreEqual(10, _switch.SwitchHandlerImageSize.Height, "Should be equals to the set value of SwitchHandlerImageSize2D.Height");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Dispose, try to dispose the Switch.")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.Dispose M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Dispose_TEST()
+ {
+ /* TEST CODE */
+ try
+ {
+ var mySwitch = new Switch();
+ Assert.IsNotNull(mySwitch, "Should be not null!");
+ Assert.IsInstanceOf<Switch>(mySwitch, "Should be equal!");
+
+ mySwitch.Dispose();
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test GetViewStyle. Check whether CreateViewStyle works or not.")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.CreateViewStyle M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void CreateViewStyle_CHECK_RETURN_VALUE()
+ {
+ try
+ {
+ var _switch = new MySwitch();
+ ViewStyle style = _switch.CreateMyViewStyle();
+ Assert.IsNotNull(style, "Should be not null");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test OnThemeChangedEvent. Check whether OnThemeChangedEvent works or not.")]
+ [Property("SPEC", "Tizen.NUI.Components.Switch.OnThemeChangedEvent M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void OnThemeChangedEvent_CHECK_RETURN_VALUE()
+ {
+ try
+ {
+ _flagOnThemeChangedEvent = false;
+ StyleManager.Instance.Theme = "Family";
+ var _switch = new Switch();
+ StyleManager.Instance.Theme = "Food";
+ Assert.IsNotNull(_switch, "Should be not null");
+ Assert.IsTrue(_flagOnThemeChangedEvent, "Should be true!");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ public class MySwitch : Switch
+ {
+ public MySwitch() : base() {}\r
\r
-namespace Tizen.NUI.Components.Tests\r
-{\r
- [TestFixture]\r
- [Description("Tizen.NUI.Components.Switch Tests")]\r
- public class SwitchTests\r
- {\r
- private const string TAG = "Components";\r
- private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";\r
- private static bool _flagGetViewStyle = false;\r
- private static bool _flagOnThemeChangedEvent = false;\r
-\r
- [SetUp]\r
- public void Init()\r
- {\r
- Tizen.Log.Info(TAG, "Init() is called!");\r
- }\r
-\r
- [TearDown]\r
- public void Destroy()\r
- {\r
- Tizen.Log.Info(TAG, "Destroy() is called!");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test Switch empty constructor. Check it has been triggered")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.Switch C")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "CONSTR")]\r
- [Property("COVPARAM", "")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void Switch_CHECK_VALUE()\r
- {\r
- /* TEST CODE */\r
- var _switch = new Switch();\r
- Assert.IsNotNull(_switch, "Should be not null!");\r
- Assert.IsInstanceOf<Switch>(_switch, "Should be an instance of Switch!");\r
-\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test Switch constructor using string. Check whether Switch is successfully created or not.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.Switch C")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "CONSTR")]\r
- [Property("COVPARAM", "string")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void Switch_INIT_WITH_STRING()\r
- {\r
- /* TEST CODE */\r
- StyleManager.Instance.Theme = "default";\r
- StyleManager.Instance.RegisterStyle("defaultSwitch", "default", typeof(DefaultSwitchStyle));\r
- var switch1 = new Switch("defaultSwitch");\r
- Assert.IsNotNull(switch1, "Should be not null!");\r
- Assert.IsInstanceOf<Switch>(switch1, "Should be an instance of Switch!");\r
- }\r
-\r
- [Test]\r
- [Category("P2")]\r
- [Description("Check exception when constructing a Switch with nonexistent style.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.Switch C")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "CONSTX")]\r
- [Property("COVPARAM", "string")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void Switch_INIT_WITH_STRING_Exception()\r
- {\r
- /* TEST CODE */\r
- try\r
- {\r
- var switch1 = new Switch("defaultSwitchX");\r
- Assert.Fail("Should throw the Exception: There is no style of defaultSwitchX !");\r
- }\r
- catch(InvalidOperationException e)\r
- {\r
- if (e != null)\r
- {\r
- Assert.Pass("InvalidOperationException: passed!");\r
- }\r
- }\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test Switch constructor using style. Check whether Switch is successfully created or not.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.Switch C")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "CONSTR")]\r
- [Property("COVPARAM", "SwitchStyle")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void Switch_INIT_WITH_STYLE()\r
- {\r
- /* TEST CODE */\r
- var style = new SwitchStyle();\r
- Assert.IsNotNull(style, "Should be not null!");\r
- Assert.IsInstanceOf<SwitchStyle>(style, "Should be an instance of SwitchStyle!");\r
-\r
- var _switch = new Switch(style);\r
- Assert.IsNotNull(_switch, "Should be not null!");\r
- Assert.IsInstanceOf<Switch>(_switch, "Should be an instance of Switch!");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test Style. Check whether Style is readable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.Style A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRO")]\r
- [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")]\r
- public void Style_CHECK_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var _switch = new Switch();\r
- Assert.IsNotNull(_switch, "Should be not null");\r
- Assert.IsInstanceOf<Switch>(_switch, "Should be an instance of Switch!");\r
-\r
- var style = _switch.Style;\r
- Assert.IsNotNull(style, "Should be not null");\r
- Assert.IsInstanceOf<SwitchStyle>(style, "Should be an instance of SwitchStyle!");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test SwitchBackgroundImageURLSelector. Check whether SwitchBackgroundImageURLSelector is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchBackgroundImageURLSelector A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void SwitchBackgroundImageURLSelector_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var _switch = new Switch();\r
- Assert.IsNotNull(_switch, "Should be not null!");\r
- Assert.IsInstanceOf<Switch>(_switch, "Should be equal!");\r
-\r
- StringSelector stringSelector = new StringSelector\r
- {\r
- Normal = _image_path,\r
- Selected = _image_path,\r
- };\r
- Assert.IsNotNull(stringSelector, "Should be not null!");\r
- Assert.IsInstanceOf<StringSelector>(stringSelector, "Should be equal!");\r
-\r
- _switch.SwitchBackgroundImageURLSelector = stringSelector;\r
- Assert.AreEqual(stringSelector.Normal, _switch.SwitchBackgroundImageURLSelector.Normal, "Should be equals to the set value of SwitchBackgroundImageURLSelector Normal");\r
- Assert.AreEqual(stringSelector.Selected, _switch.SwitchBackgroundImageURLSelector.Selected, "Should be equals to the set value of SwitchBackgroundImageURLSelector Selected");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test SwitchHandlerImageURL. Check whether SwitchHandlerImageURL is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchHandlerImageURL A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void SwitchHandlerImageURL_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var _switch = new Switch();\r
- Assert.IsNotNull(_switch, "Should be not null!");\r
- Assert.IsInstanceOf<Switch>(_switch, "Should be equal!");\r
-\r
- _switch.SwitchHandlerImageURL = _image_path;\r
- Assert.AreEqual(_image_path, _switch.SwitchHandlerImageURL, "Should be equals to the set value of SwitchHandlerImageURL");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test SwitchHandlerImageURLSelector. Check whether SwitchHandlerImageURLSelector is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchHandlerImageURLSelector A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void SwitchHandlerImageURLSelector_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var _switch = new Switch();\r
- Assert.IsNotNull(_switch, "Should be not null!");\r
- Assert.IsInstanceOf<Switch>(_switch, "Should be equal!");\r
-\r
- StringSelector stringSelector = new StringSelector\r
- {\r
- Normal = _image_path,\r
- Selected = _image_path,\r
- };\r
- Assert.IsNotNull(stringSelector, "Should be not null!");\r
- Assert.IsInstanceOf<StringSelector>(stringSelector, "Should be equal!");\r
-\r
- _switch.SwitchHandlerImageURLSelector = stringSelector;\r
- Assert.AreEqual(stringSelector.Normal, _switch.SwitchHandlerImageURLSelector.Normal, "Should be equals to the set value of SwitchHandlerImageURLSelector Normal");\r
- Assert.AreEqual(stringSelector.Selected, _switch.SwitchHandlerImageURLSelector.Selected, "Should be equals to the set value of SwitchHandlerImageURLSelector Selected");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test SwitchHandlerImageSize. Check whether SwitchHandlerImageSize is readable and writable.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchHandlerImageSize A")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "PRW")]\r
- [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")]\r
- public void SwitchHandlerImageSize_SET_GET_VALUE()\r
- {\r
- /* TEST CODE */\r
- var _switch = new Switch();\r
- Assert.IsNotNull(_switch, "Should be not null!");\r
- Assert.IsInstanceOf<Switch>(_switch, "Should be equal!");\r
-\r
- _switch.SwitchHandlerImageSize = new Size(10, 10);\r
- Assert.AreEqual(10, _switch.SwitchHandlerImageSize.Width, "Should be equals to the set value of SwitchHandlerImageSize2D.Width");\r
- Assert.AreEqual(10, _switch.SwitchHandlerImageSize.Height, "Should be equals to the set value of SwitchHandlerImageSize2D.Height");\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test Dispose, try to dispose the Switch.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.Dispose M")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "MCST")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void Dispose_TEST()\r
- {\r
- /* TEST CODE */\r
- try\r
- {\r
- var mySwitch = new Switch();\r
- Assert.IsNotNull(mySwitch, "Should be not null!");\r
- Assert.IsInstanceOf<Switch>(mySwitch, "Should be equal!");\r
-\r
- mySwitch.Dispose();\r
- }\r
- catch (Exception e)\r
- {\r
- Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());\r
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());\r
- Assert.Fail("Caught Exception" + e.ToString());\r
- }\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test GetViewStyle. Check whether GetViewStyle works or not.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.GetViewStyle M")]\r
- [Property("SPEC_URL", " - ")]\r
- [Property("CRITERIA", "MR")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void GetViewStyle_CHECK_RETURN_VALUE()\r
- {\r
- try\r
- {\r
- _flagGetViewStyle = false;\r
- var _switch = new MySwitch();\r
- var style = _switch.Style;\r
- Assert.IsNotNull(style, "Should be not null");\r
- Assert.IsTrue(_flagGetViewStyle, "Should be true!");\r
- }\r
- catch (Exception e)\r
- {\r
- Assert.Fail("Caught Exception" + e.ToString());\r
- }\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("Test OnThemeChangedEvent. Check whether OnThemeChangedEvent works or not.")]\r
- [Property("SPEC", "Tizen.NUI.Components.Switch.OnThemeChangedEvent M")]\r
- [Property("SPEC_URL", " - ")]\r
- [Property("CRITERIA", "MR")]\r
- [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
- public void OnThemeChangedEvent_CHECK_RETURN_VALUE()\r
- {\r
- try\r
- {\r
- _flagOnThemeChangedEvent = false;\r
- StyleManager.Instance.Theme = "Family";\r
- var _switch = new Switch();\r
- StyleManager.Instance.Theme = "Food";\r
- Assert.IsNotNull(_switch, "Should be not null");\r
- Assert.IsTrue(_flagOnThemeChangedEvent, "Should be true!");\r
- }\r
- catch (Exception e)\r
- {\r
- Assert.Fail("Caught Exception" + e.ToString());\r
- }\r
- }\r
-\r
- public class MySwitch : Switch\r
- {\r
- public MySwitch () : base() {}\r
-\r
- protected override ViewStyle GetViewStyle()\r
- {\r
- _flagGetViewStyle = true;\r
- return base.GetViewStyle();\r
- }\r
-\r
- protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)\r
- {\r
- _flagOnThemeChangedEvent = true;\r
- }\r
- }\r
-\r
- public class DefaultSwitchStyle : StyleBase\r
- {\r
- protected override ViewStyle GetViewStyle()\r
- {\r
- return new SwitchStyle();\r
- }\r
- }\r
- }\r
-}\r
+ public ViewStyle CreateMyViewStyle()
+ {
+ return base.CreateViewStyle();
+ }
+
+ protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ {
+ _flagOnThemeChangedEvent = true;
+ }
+ }
+
+ public class DefaultSwitchStyle : StyleBase
+ {
+ protected override ViewStyle GetViewStyle()
+ {
+ return new SwitchStyle();
+ }
+ }
+ }
+}