3 using NUnit.Framework.TUnit;
5 using Tizen.NUI.Components;
6 using Tizen.NUI.BaseComponents;
7 using Tizen.NUI.Components.Extension;
9 namespace Tizen.NUI.Components.Devel.Tests
11 using static Tizen.NUI.BaseComponents.View;
12 using tlog = Tizen.Log;
15 [Description("Controls/Extension/SlidingSwitchExtension")]
16 public class SlidingSwitchExtensionTest
18 private const string tag = "NUITEST";
19 private string image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
21 internal class MySlidingSwitchExtension : SlidingSwitchExtension
23 public MySlidingSwitchExtension() : base()
26 public void MyOnSelectedChanged(Switch button)
28 base.OnSelectedChanged(button);
31 public void MyDispose(bool disposing)
33 base.Dispose(disposing);
40 tlog.Info(tag, "Init() is called!");
46 tlog.Info(tag, "Destroy() is called!");
51 [Description("SlidingSwitchExtension OnSelectedChanged.")]
52 [Property("SPEC", "Tizen.NUI.Components.SlidingSwitchExtension.OnSelectedChanged M")]
53 [Property("SPEC_URL", "-")]
54 [Property("CRITERIA", "MR")]
55 [Property("COVPARAM", "")]
56 [Property("AUTHOR", "guowei.wang@samsung.com")]
57 public void SlidingSwitchExtensionOnSelectedChanged()
59 tlog.Debug(tag, $"SlidingSwitchExtensionOnSelectedChanged START");
61 var testingTarget = new MySlidingSwitchExtension();
62 Assert.IsNotNull(testingTarget, "null handle");
63 Assert.IsInstanceOf<MySlidingSwitchExtension>(testingTarget, "Should return SlidingSwitchExtension instance.");
65 SwitchStyle style = new SwitchStyle()
67 Track = new ImageViewStyle()
69 BackgroundImage = image_path,
71 Thumb = new ImageViewStyle()
73 BackgroundImage = image_path,
77 using (Switch button = new Switch(style) )
80 Window.Instance.Add(button);
84 testingTarget.MyOnSelectedChanged(button);
88 tlog.Debug(tag, e.Message.ToString());
89 Assert.Fail("Caught Exception : Failed!");
93 testingTarget.MyDispose(true);
94 tlog.Debug(tag, $"SlidingSwitchExtensionOnSelectedChanged END (OK)");
99 [Description("SlidingSwitchExtension Dispose.")]
100 [Property("SPEC", "Tizen.NUI.Components.SlidingSwitchExtension.Dispose M")]
101 [Property("SPEC_URL", "-")]
102 [Property("CRITERIA", "MR")]
103 [Property("COVPARAM", "")]
104 [Property("AUTHOR", "guowei.wang@samsung.com")]
105 public void SlidingSwitchExtensionDispose()
107 tlog.Debug(tag, $"SlidingSwitchExtensionDispose START");
109 var testingTarget = new SlidingSwitchExtension();
110 Assert.IsNotNull(testingTarget, "null handle");
111 Assert.IsInstanceOf<SlidingSwitchExtension>(testingTarget, "Should return SlidingSwitchExtension instance.");
115 testingTarget.Dispose();
119 tlog.Debug(tag, e.Message.ToString());
120 Assert.Fail("Caught Exception : Failed!");
123 tlog.Debug(tag, $"SlidingSwitchExtensionDispose END (OK)");