3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Threading.Tasks;
8 namespace Tizen.NUI.Devel.Tests
10 using tlog = Tizen.Log;
13 [Description("internal/WebView/WebHitTestResult")]
14 public class InternalWebHitTestResultTest
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_;
23 tlog.Info(tag, "Init() is called!");
24 webview_ = new BaseComponents.WebView()
26 Size = new Size(500, 200),
33 tlog.Info(tag, "Destroy() is being called!");
35 tlog.Info(tag, "Destroy() is called!");
38 //TODO... This TC will be blocked because web engine does not support it any longer.
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()
49 // tlog.Debug(tag, $"WebHitTestResultConstructor START");
51 // TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
53 // BaseComponents.WebView.HitTestFinishedCallback onHitTestFinished = (test) =>
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)
66 // tlog.Info("WebView", $"WebHitTestResult, Attributes: {test.Attributes}");
68 // tlog.Info("WebView", $"WebHitTestResult, ImageFileNameExtension: {test.ImageFileNameExtension}");
69 // ImageView imageView = test.Image;
70 // if (imageView != null)
72 // tlog.Info("WebView", $"WebHitTestResult, Got image view");
74 // tcs.TrySetResult(true);
77 // EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
79 // tlog.Info(tag, "onLoadFinished is called!");
81 // bool succeeded = webview_.HitTestAsynchronously(50, 50, BaseComponents.WebView.HitTestMode.Default, onHitTestFinished);
82 // Assert.IsTrue(succeeded, "HitTestAsynchronously should be invoked");
84 // webview_.PageLoadFinished += onLoadFinished;
86 // webview_.LoadUrl(url);
87 // var result = await tcs.Task;
88 // Assert.IsTrue(result, "PageLoadFinished event & HitTestAsynchronously should be invoked");
90 // // Make current thread (CPU) sleep...
91 // await Task.Delay(1);
93 // webview_.PageLoadFinished -= onLoadFinished;
95 // tlog.Debug(tag, $"WebHitTestResultConstructor END (OK)");