1 // Copyright 2016 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "utc_blink_ewk_base.h"
7 static const char* kURL = "/ewk_view/index_big_red_square.html";
8 static const int kFirstTouchPosition = 500;
9 static const double kTouchEventInterval = 0.012;
11 class utc_blink_ewk_view_horizontal_panning_hold_set
12 : public utc_blink_ewk_base {
14 void LoadFinished(Evas_Object*) override { EventLoopStop(Success); }
16 // Move touch point from (500, 500) to (400, 400).
18 Ewk_Touch_Point* touch_point = new Ewk_Touch_Point;
20 touch_point->x = kFirstTouchPosition;
21 touch_point->y = kFirstTouchPosition;
22 touch_point->state = EVAS_TOUCH_POINT_DOWN;
24 Eina_List* list = nullptr;
25 list = eina_list_append(list, touch_point);
27 ewk_view_feed_touch_event(GetEwkWebView(), EWK_TOUCH_START, list, nullptr);
29 for (int i = 1; i <= 10; ++i) {
30 touch_point->x = kFirstTouchPosition - i * 10;
31 touch_point->y = kFirstTouchPosition - i * 10;
32 touch_point->state = EVAS_TOUCH_POINT_MOVE;
34 ewk_view_feed_touch_event(GetEwkWebView(), EWK_TOUCH_MOVE, list, nullptr);
35 EventLoopWait(kTouchEventInterval);
43 TEST_F(utc_blink_ewk_view_horizontal_panning_hold_set, POS_HOLD_TRUE) {
44 ASSERT_TRUE(ewk_view_url_set(GetEwkWebView(), GetResourceUrl(kURL).c_str()));
45 ASSERT_EQ(Success, EventLoopStart());
47 ewk_view_touch_events_enabled_set(GetEwkWebView(), EINA_TRUE);
48 ewk_view_horizontal_panning_hold_set(GetEwkWebView(), EINA_TRUE);
53 ASSERT_TRUE(ewk_view_scroll_pos_get(GetEwkWebView(), &x, &y));
58 TEST_F(utc_blink_ewk_view_horizontal_panning_hold_set, POS_HOLD_FALSE) {
59 ASSERT_TRUE(ewk_view_url_set(GetEwkWebView(), GetResourceUrl(kURL).c_str()));
60 ASSERT_EQ(Success, EventLoopStart());
62 ewk_view_touch_events_enabled_set(GetEwkWebView(), EINA_TRUE);
63 ewk_view_horizontal_panning_hold_set(GetEwkWebView(), EINA_FALSE);
68 ASSERT_TRUE(ewk_view_scroll_pos_get(GetEwkWebView(), &x, &y));
73 TEST_F(utc_blink_ewk_view_horizontal_panning_hold_set, NEG_INVALID_VIEW) {
74 ASSERT_TRUE(ewk_view_url_set(GetEwkWebView(), GetResourceUrl(kURL).c_str()));
75 ASSERT_EQ(Success, EventLoopStart());
77 ewk_view_touch_events_enabled_set(GetEwkWebView(), EINA_TRUE);
78 ewk_view_horizontal_panning_hold_set(nullptr, EINA_TRUE);
83 ASSERT_TRUE(ewk_view_scroll_pos_get(GetEwkWebView(), &x, &y));