本文整理汇总了C++中WebViewImpl::linkHighlight方法的典型用法代码示例。如果您正苦于以下问题:C++ WebViewImpl::linkHighlight方法的具体用法?C++ WebViewImpl::linkHighlight怎么用?C++ WebViewImpl::linkHighlight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebViewImpl
的用法示例。
在下文中一共展示了WebViewImpl::linkHighlight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: baseURL
TEST(LinkHighlightImplTest, verifyWebViewImplIntegration)
{
FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
const std::string baseURL("http://www.test.com/");
const std::string fileName("test_touch_link_highlight.html");
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("test_touch_link_highlight.html"));
FrameTestHelpers::WebViewHelper webViewHelper;
WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileName, true);
int pageWidth = 640;
int pageHeight = 480;
webViewImpl->resize(WebSize(pageWidth, pageHeight));
webViewImpl->updateAllLifecyclePhases();
WebGestureEvent touchEvent;
touchEvent.type = WebInputEvent::GestureShowPress;
touchEvent.sourceDevice = WebGestureDeviceTouchscreen;
// The coordinates below are linked to absolute positions in the referenced .html file.
touchEvent.x = 20;
touchEvent.y = 20;
ASSERT_TRUE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEvent)));
touchEvent.y = 40;
EXPECT_FALSE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEvent)));
touchEvent.y = 20;
// Shouldn't crash.
webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEvent));
EXPECT_TRUE(webViewImpl->linkHighlight(0));
EXPECT_TRUE(webViewImpl->linkHighlight(0)->contentLayer());
EXPECT_TRUE(webViewImpl->linkHighlight(0)->clipLayer());
// Find a target inside a scrollable div
touchEvent.y = 100;
webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEvent));
ASSERT_TRUE(webViewImpl->linkHighlight(0));
// Don't highlight if no "hand cursor"
touchEvent.y = 220; // An A-link with cross-hair cursor.
webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEvent));
ASSERT_EQ(0U, webViewImpl->numLinkHighlights());
touchEvent.y = 260; // A text input box.
webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEvent));
ASSERT_EQ(0U, webViewImpl->numLinkHighlights());
Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
}