[NUI] Add TCs of WebView & Update some TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / WebView / TSWebContextMenuItem.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("internal/WebView/WebContextMenuItem")]
13     public class InternalWebContextMenuItemTest
14     {
15         private const string tag = "NUITEST";
16         private string url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
17
18         internal class MyWebContextMenuItem : WebContextMenuItem
19         {
20             public MyWebContextMenuItem(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
21             { }
22
23             public void OnReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
24             {
25                 base.ReleaseSwigCPtr(swigCPtr);
26             }
27         }
28
29         [SetUp]
30         public void Init()
31         {
32             tlog.Info(tag, "Init() is called!");
33         }
34
35         [TearDown]
36         public void Destroy()
37         {
38             tlog.Info(tag, "Destroy() is called!");
39         }
40
41         [Test]
42         [Category("P1")]
43         [Description("WebContextMenuItem constructor.")]
44         [Property("SPEC", "Tizen.NUI.WebContextMenuItem.WebContextMenuItem C")]
45         [Property("SPEC_URL", "-")]
46         [Property("CRITERIA", "CONSTR")]
47         [Property("COVPARAM", "")]
48         [Property("AUTHOR", "guowei.wang@samsung.com")]
49         public void WebContextMenuItemConstructor()
50         {
51             tlog.Debug(tag, $"WebContextMenuItemConstructor START");
52
53             using (Tizen.NUI.BaseComponents.WebView webview = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai"))
54             {
55                 WebContextMenu menu = new WebContextMenu(webview.SwigCPtr.Handle, false);
56
57                 var testingTarget = new WebContextMenuItem(menu.SwigCPtr.Handle, false);
58                 Assert.IsNotNull(testingTarget, "null handle");
59                 Assert.IsInstanceOf<WebContextMenuItem>(testingTarget, "Should return WebContextMenuItem instance.");
60
61                 menu.Dispose();
62                 testingTarget.Dispose();
63             }
64
65             tlog.Debug(tag, $"WebContextMenuItemConstructor END (OK)");
66         }
67
68         [Test]
69         [Category("P1")]
70         [Description("WebContextMenuItem getCPtr.")]
71         [Property("SPEC", "Tizen.NUI.WebContextMenuItem.getCPtr M")]
72         [Property("SPEC_URL", "-")]
73         [Property("CRITERIA", "MR")]
74         [Property("COVPARAM", "")]
75         [Property("AUTHOR", "guowei.wang@samsung.com")]
76         public void WebContextMenuItemGetCPtr()
77         {
78             tlog.Debug(tag, $"WebContextMenuItemGetCPtr START");
79
80             using (Tizen.NUI.BaseComponents.WebView webview = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai"))
81             {
82                 WebContextMenu menu = new WebContextMenu(webview.SwigCPtr.Handle, false);
83
84                 var testingTarget = new WebContextMenuItem(menu.SwigCPtr.Handle, false);
85                 Assert.IsNotNull(testingTarget, "null handle");
86                 Assert.IsInstanceOf<WebContextMenuItem>(testingTarget, "Should return WebContextMenuItem instance.");
87
88                 var result = WebContextMenuItem.getCPtr(testingTarget);
89                 tlog.Debug(tag, "getCPtr : " + result);
90
91                 menu.Dispose();
92                 testingTarget.Dispose();
93             }
94
95             tlog.Debug(tag, $"WebContextMenuItemGetCPtr END (OK)");
96         }
97     }
98 }