[NUI] Add Application(Internal & Public) TCs.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.TCT / testcase / public / Common / TSPropertyNotifySignal.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("public/Common/PropertyNotifySignal")]
13     class PublicPropertyNotifySignalTest
14     {
15         private const string tag = "NUITEST";
16         private delegate void dummyCallback();
17         private void OnDummyCallback()
18         { }
19
20         [SetUp]
21         public void Init()
22         {
23             tlog.Info(tag, "Init() is called!");
24         }
25
26         [TearDown]
27         public void Destroy()
28         {
29             tlog.Info(tag, "Destroy() is called!");
30         }
31
32         [Test]
33         [Category("P1")]
34         [Description("PropertyNotifySignal constructor.")]
35         [Property("SPEC", "Tizen.NUI.PropertyNotifySignal.PropertyNotifySignal C")]
36         [Property("SPEC_URL", "-")]
37         [Property("CRITERIA", "CONSTR")]
38         [Property("AUTHOR", "guowei.wang@samsung.com")]
39         public void PropertyNotifySignalConstructor()
40         {
41             tlog.Debug(tag, $"PropertyNotifySignalConstructor START");
42
43             var testingTarget = new PropertyNotifySignal();
44             Assert.IsNotNull(testingTarget, "Should be not null!");
45             Assert.IsInstanceOf<PropertyNotifySignal>(testingTarget, "Should be an Instance of PropertyNotifySignal!");
46
47             testingTarget.Dispose();
48             tlog.Debug(tag, $"PropertyNotifySignalConstructor END (OK)");
49         }
50
51         [Test]
52         [Category("P1")]
53         [Description("PropertyNotifySignal Empty")]
54         [Property("SPEC", "Tizen.NUI.PropertyNotifySignal.Empty M")]
55         [Property("SPEC_URL", "-")]
56         [Property("CRITERIA", "MR")]
57         [Property("AUTHOR", "guowei.wang@samsung.com")]
58         public void PropertyNotifySignalEmpty()
59         {
60             tlog.Debug(tag, $"PropertyNotifySignalEmpty START");
61
62             var testingTarget = new PropertyNotifySignal();
63             Assert.IsNotNull(testingTarget, "Should be not null!");
64             Assert.IsInstanceOf<PropertyNotifySignal>(testingTarget, "Should be an Instance of PropertyNotifySignal!");
65
66             Assert.IsTrue(testingTarget.Empty());
67
68             testingTarget.Dispose();
69             tlog.Debug(tag, $"PropertyNotifySignalEmpty END (OK)");
70         }
71
72         [Test]
73         [Category("P1")]
74         [Description("PropertyNotifySignal GetConnectionCount")]
75         [Property("SPEC", "Tizen.NUI.PropertyNotifySignal.GetConnectionCount M")]
76         [Property("SPEC_URL", "-")]
77         [Property("CRITERIA", "MR")]
78         [Property("AUTHOR", "guowei.wang@samsung.com")]
79         public void PropertyNotifySignalGetConnectionCount()
80         {
81             tlog.Debug(tag, $"PropertyNotifySignalGetConnectionCount START");
82
83             var testingTarget = new PropertyNotifySignal();
84             Assert.IsNotNull(testingTarget, "Should be not null!");
85             Assert.IsInstanceOf<PropertyNotifySignal>(testingTarget, "Should be an Instance of PropertyNotifySignal!");
86
87             Assert.AreEqual(0, testingTarget.GetConnectionCount(), "Should be zero!");
88
89             testingTarget.Dispose();
90             tlog.Debug(tag, $"PropertyNotifySignalGetConnectionCount END (OK)");
91         }
92
93         [Test]
94         [Category("P1")]
95         [Description("PropertyNotifySignal Connect")]
96         [Property("SPEC", "Tizen.NUI.PropertyNotifySignal.Connect M")]
97         [Property("SPEC_URL", "-")]
98         [Property("CRITERIA", "MR")]
99         [Property("AUTHOR", "guowei.wang@samsung.com")]
100         public void PropertyNotifySignalConnect()
101         {
102             tlog.Debug(tag, $"PropertyNotifySignalConnect START");
103
104             var testingTarget = new PropertyNotifySignal();
105             Assert.IsNotNull(testingTarget, "Should be not null!");
106             Assert.IsInstanceOf<PropertyNotifySignal>(testingTarget, "Should be an Instance of PropertyNotifySignal!");
107
108             dummyCallback callback = OnDummyCallback;
109             testingTarget.Connect(callback);
110             testingTarget.Disconnect(callback);
111
112             testingTarget.Dispose();
113             tlog.Debug(tag, $"PropertyNotifySignalConnect END (OK)");
114         }
115
116         [Test]
117         [Category("P1")]
118         [Description("PropertyNotifySignal Disconnect")]
119         [Property("SPEC", "Tizen.NUI.PropertyNotifySignal.Disconnect M")]
120         [Property("SPEC_URL", "-")]
121         [Property("CRITERIA", "MR")]
122         [Property("AUTHOR", "guowei.wang@samsung.com")]
123         public void PropertyNotifySignalDisconnect()
124         {
125             tlog.Debug(tag, $"PropertyNotifySignalDisconnect START");
126
127             var testingTarget = new PropertyNotifySignal();
128             Assert.IsNotNull(testingTarget, "Should be not null!");
129             Assert.IsInstanceOf<PropertyNotifySignal>(testingTarget, "Should be an Instance of PropertyNotifySignal!");
130
131             dummyCallback callback = OnDummyCallback;
132             testingTarget.Connect(callback);
133             testingTarget.Disconnect(callback);
134
135             testingTarget.Dispose();
136             tlog.Debug(tag, $"PropertyNotifySignalDisconnect END (OK)");
137         }
138
139         [Test]
140         [Category("P1")]
141         [Description("PropertyNotifySignal Emit")]
142         [Property("SPEC", "Tizen.NUI.PropertyNotifySignal.Emit M")]
143         [Property("SPEC_URL", "-")]
144         [Property("CRITERIA", "MR")]
145         [Property("AUTHOR", "guowei.wang@samsung.com")]
146         public void PropertyNotifySignalEmit()
147         {
148             tlog.Debug(tag, $"PropertyNotifySignalEmit START");
149
150             var testingTarget = new PropertyNotifySignal();
151             Assert.IsNotNull(testingTarget, "Should be not null!");
152             Assert.IsInstanceOf<PropertyNotifySignal>(testingTarget, "Should be an Instance of PropertyNotifySignal!");
153
154             View view = new View()
155             {
156                 Size = new Size(200, 200),
157                 BackgroundColor = Color.Red
158             };
159             Window.Instance.Add(view);
160
161             var dummy = view.AddPropertyNotification("PositionX", PropertyCondition.GreaterThan(100.0f));
162             Assert.IsNotNull(dummy, "Should be not null!");
163             Assert.IsInstanceOf<PropertyNotification>(dummy, "Should be an Instance of PropertyNotification!");
164
165             testingTarget.Emit(dummy);
166
167             testingTarget.Dispose();
168             dummy.Dispose();
169             view.Dispose();
170             tlog.Debug(tag, $"PropertyNotifySignalEmit END (OK)");
171         }
172     }
173 }