Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: ui/events/test/event_generator.cc

Issue 2560633002: exo: Implement v6 of touch protocol including shape and frame event (Closed)
Patch Set: extend event_generator to test touch radius Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« components/exo/touch_delegate.h ('K') | « ui/events/test/event_generator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/test/event_generator.cc
diff --git a/ui/events/test/event_generator.cc b/ui/events/test/event_generator.cc
index 4a85eaa65e0577e611bcc34e952957eac5e4df10..297d8b0f1c99a7fa3f65916e7590d56378153c22 100644
--- a/ui/events/test/event_generator.cc
+++ b/ui/events/test/event_generator.cc
@@ -274,6 +274,11 @@ void EventGenerator::ExitPenPointerMode() {
pen_pointer_mode_ = false;
}
+void EventGenerator::SetTouchRadius(float x, float y) {
+ touch_pointer_details_.radius_x = x;
+ touch_pointer_details_.radius_y = y;
+}
+
void EventGenerator::PressTouch() {
PressTouchId(0);
}
@@ -585,6 +590,9 @@ void EventGenerator::Init(gfx::NativeWindow root_window,
if (window_context)
current_location_ = delegate()->CenterOfWindow(window_context);
current_target_ = delegate()->GetTargetAt(current_location_);
+ touch_pointer_details_ =
+ PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1.0, 1.0,
+ std::numeric_limits<float>::quiet_NaN(), 0.0, 0.0);
}
void EventGenerator::DispatchKeyEvent(bool is_press,
@@ -663,6 +671,11 @@ void EventGenerator::DoDispatchEvent(ui::Event* event, bool async) {
if (pen_pointer_mode_ && event->IsMouseEvent())
ConvertToPenPointerEvent(static_cast<ui::MouseEvent*>(event));
+ if (event->IsTouchEvent()) {
+ static_cast<ui::TouchEvent*>(event)->set_pointer_details(
+ touch_pointer_details_);
+ }
+
if (async) {
std::unique_ptr<ui::Event> pending_event = ui::Event::Clone(*event);
if (pending_events_.empty()) {
« components/exo/touch_delegate.h ('K') | « ui/events/test/event_generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698