f17dd7604dd058313d77bb793ce372eb84f34719
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / BaseComponents / TSViewEvent.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 using System.Collections.Generic;
7
8 namespace Tizen.NUI.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("public/BaseComponents/ViewEvent")]
14     public class PublicViewEventTest
15     {
16         private const string tag = "NUITEST";
17
18         private bool OnKeyEvent(object source, View.KeyEventArgs e)
19         {
20             return true;
21         }
22
23         private bool OnInterceptTouchEvent(object source, View.TouchEventArgs e)
24         {
25             return true;
26         }
27
28         private bool OnWheelEvent(object source, View.WheelEventArgs e)
29         {
30             return true;
31         }
32
33         private bool OnHoverEvent(object source, View.HoverEventArgs e)
34         {
35             return true;
36         }
37
38         private bool OnTouchEvent(object source, View.TouchEventArgs e)
39         {
40             return true;
41         }
42
43         private void OnBackgroundResourceLoaded(object sender, View.BackgroundResourceLoadedEventArgs e) { }
44
45         [SetUp]
46         public void Init()
47         {
48             tlog.Info(tag, "Init() is called!");
49         }
50
51         [TearDown]
52         public void Destroy()
53         {
54             tlog.Info(tag, "Destroy() is called!");
55         }
56
57         [Test]
58         [Category("P1")]
59         [Description("ViewEvent KeyEvent.")]
60         [Property("SPEC", "Tizen.NUI.ViewEvent.KeyEvent A")]
61         [Property("SPEC_URL", "-")]
62         [Property("CRITERIA", "PRW")]
63         [Property("AUTHOR", "guowei.wang@samsung.com")]
64         public void ViewEventKeyEvent()
65         {
66             tlog.Debug(tag, $"ViewEventKeyEvent START");
67
68             var testingTarget = new View();
69             Assert.IsNotNull(testingTarget, "Can't create success object View");
70             Assert.IsInstanceOf<View>(testingTarget, "Should be an instance of View type.");
71
72             testingTarget.KeyEvent += OnKeyEvent;
73             testingTarget.KeyEvent -= OnKeyEvent;
74
75             testingTarget.InterceptTouchEvent += OnInterceptTouchEvent;
76             testingTarget.InterceptTouchEvent -= OnInterceptTouchEvent;
77
78             testingTarget.TouchEvent += OnTouchEvent;
79             testingTarget.TouchEvent -= OnTouchEvent;
80
81             testingTarget.HoverEvent += OnHoverEvent;
82             testingTarget.HoverEvent -= OnHoverEvent;
83
84             testingTarget.WheelEvent += OnWheelEvent;
85             testingTarget.WheelEvent -= OnWheelEvent;
86
87             testingTarget.BackgroundResourceLoaded += OnBackgroundResourceLoaded;
88             testingTarget.BackgroundResourceLoaded -= OnBackgroundResourceLoaded;
89
90             tlog.Debug(tag, $"ViewEventKeyEvent END (OK)");
91         }
92     }
93 }