[NUI] Update webview TCs.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / WebView / TSWebHitTestResult.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.Threading.Tasks;
7
8 namespace Tizen.NUI.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("internal/WebView/WebHitTestResult")]
14     public class InternalWebHitTestResultTest
15     {
16         private const string tag = "NUITEST";
17         private string url = $"file://{Tizen.Applications.Application.Current.DirectoryInfo.Resource}webview/index.html";
18         private BaseComponents.WebView webview_;
19
20         [SetUp]
21         public void Init()
22         {
23             tlog.Info(tag, "Init() is called!");
24             webview_ = new BaseComponents.WebView()
25             {
26                 Size = new Size(500, 200),
27             };
28         }
29
30         [TearDown]
31         public void Destroy()
32         {
33             tlog.Info(tag, "Destroy() is being called!");
34             webview_.Dispose();
35             tlog.Info(tag, "Destroy() is called!");
36         }
37
38         //TODO... This TC will be blocked because web engine does not support it any longer.
39         //[Test]
40         //[Category("P1")]
41         //[Description("WebHitTestResult constructor.")]
42         //[Property("SPEC", "Tizen.NUI.WebHitTestResult.WebHitTestResult C")]
43         //[Property("SPEC_URL", "-")]
44         //[Property("CRITERIA", "CONSTR")]
45         //[Property("COVPARAM", "")]
46         //[Property("AUTHOR", "guowei.wang@samsung.com")]
47         //public async Task WebHitTestResultConstructor()
48         //{
49         //    tlog.Debug(tag, $"WebHitTestResultConstructor START");
50
51         //    TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
52
53         //    BaseComponents.WebView.HitTestFinishedCallback onHitTestFinished = (test) =>
54         //    {
55         //        tlog.Info("WebView", $"------------hit test finished-------");
56         //        tlog.Info("WebView", $"WebHitTestResult, TestResultContext: {test.TestResultContext}");
57         //        tlog.Info("WebView", $"WebHitTestResult, LinkUrl: {test.LinkUrl}");
58         //        tlog.Info("WebView", $"WebHitTestResult, LinkTitle: {test.LinkTitle}");
59         //        tlog.Info("WebView", $"WebHitTestResult, LinkLabel: {test.LinkLabel}");
60         //        tlog.Info("WebView", $"WebHitTestResult, ImageUrl: {test.ImageUrl}");
61         //        tlog.Info("WebView", $"WebHitTestResult, MediaUrl: {test.MediaUrl}");
62         //        tlog.Info("WebView", $"WebHitTestResult, TagName: {test.TagName}");
63         //        tlog.Info("WebView", $"WebHitTestResult, NodeValue: {test.NodeValue}");
64         //        if (test.Attributes != null)
65         //        {
66         //            tlog.Info("WebView", $"WebHitTestResult, Attributes: {test.Attributes}");
67         //        }
68         //        tlog.Info("WebView", $"WebHitTestResult, ImageFileNameExtension: {test.ImageFileNameExtension}");
69         //        ImageView imageView = test.Image;
70         //        if (imageView != null)
71         //        {
72         //            tlog.Info("WebView", $"WebHitTestResult, Got image view");
73         //        }
74         //        tcs.TrySetResult(true);
75         //    };
76
77         //    EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
78         //    {
79         //        tlog.Info(tag, "onLoadFinished is called!");
80                 
81         //        bool succeeded = webview_.HitTestAsynchronously(50, 50, BaseComponents.WebView.HitTestMode.Default, onHitTestFinished);
82         //        Assert.IsTrue(succeeded, "HitTestAsynchronously should be invoked");
83         //    };
84         //    webview_.PageLoadFinished += onLoadFinished;
85
86         //    webview_.LoadUrl(url);
87         //    var result = await tcs.Task;
88         //    Assert.IsTrue(result, "PageLoadFinished event & HitTestAsynchronously should be invoked");
89
90         //    // Make current thread (CPU) sleep...
91         //    await Task.Delay(1);
92
93         //    webview_.PageLoadFinished -= onLoadFinished;
94
95         //    tlog.Debug(tag, $"WebHitTestResultConstructor END (OK)");
96         //}
97     }
98 }