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

Unified Diff: ui/events/x/events_x_unittest.cc

Issue 1586653002: ui: Fix TouchEvent PointerDetails creation from NativeEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase following X event refactor Created 4 years, 11 months 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
« no previous file with comments | « ui/events/x/events_x.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/x/events_x_unittest.cc
diff --git a/ui/events/x/events_x_unittest.cc b/ui/events/x/events_x_unittest.cc
index c0206650671370bc34fc14d8b0e0953742f3ebfa..faac0e6eb253071fa99e6c6686fbe96b02871e83 100644
--- a/ui/events/x/events_x_unittest.cc
+++ b/ui/events/x/events_x_unittest.cc
@@ -239,9 +239,11 @@ TEST_F(EventsXTest, TouchEventBasic) {
EXPECT_EQ(ui::ET_TOUCH_PRESSED, ui::EventTypeFromNative(scoped_xevent));
EXPECT_EQ("10,10", ui::EventLocationFromNative(scoped_xevent).ToString());
EXPECT_EQ(GetTouchId(scoped_xevent), 0);
- EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 10);
EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.15f);
- EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.1f);
+ PointerDetails pointer_details =
+ GetTouchPointerDetailsFromNative(scoped_xevent);
+ EXPECT_FLOAT_EQ(pointer_details.radius_x(), 10.0f);
+ EXPECT_FLOAT_EQ(pointer_details.force(), 0.1f);
// Touch update, with new orientation info.
valuators.clear();
@@ -252,9 +254,10 @@ TEST_F(EventsXTest, TouchEventBasic) {
EXPECT_EQ(ui::ET_TOUCH_MOVED, ui::EventTypeFromNative(scoped_xevent));
EXPECT_EQ("20,20", ui::EventLocationFromNative(scoped_xevent).ToString());
EXPECT_EQ(GetTouchId(scoped_xevent), 0);
- EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 10);
EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.25f);
- EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.1f);
+ pointer_details = GetTouchPointerDetailsFromNative(scoped_xevent);
+ EXPECT_FLOAT_EQ(pointer_details.radius_x(), 10.0f);
+ EXPECT_FLOAT_EQ(pointer_details.force(), 0.1f);
// Another touch with tracking id 6, touch id 1.
valuators.clear();
@@ -267,9 +270,10 @@ TEST_F(EventsXTest, TouchEventBasic) {
EXPECT_EQ(ui::ET_TOUCH_PRESSED, ui::EventTypeFromNative(scoped_xevent));
EXPECT_EQ("200,200", ui::EventLocationFromNative(scoped_xevent).ToString());
EXPECT_EQ(GetTouchId(scoped_xevent), 1);
- EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 50);
EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.45f);
- EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.5f);
+ pointer_details = GetTouchPointerDetailsFromNative(scoped_xevent);
+ EXPECT_FLOAT_EQ(pointer_details.radius_x(), 50.0f);
+ EXPECT_FLOAT_EQ(pointer_details.force(), 0.5f);
// Touch with tracking id 5 should have old radius/angle value and new pressue
// value.
@@ -280,9 +284,10 @@ TEST_F(EventsXTest, TouchEventBasic) {
EXPECT_EQ(ui::ET_TOUCH_RELEASED, ui::EventTypeFromNative(scoped_xevent));
EXPECT_EQ("30,30", ui::EventLocationFromNative(scoped_xevent).ToString());
EXPECT_EQ(GetTouchId(scoped_xevent), 0);
- EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 10);
EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.25f);
- EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.05f);
+ pointer_details = GetTouchPointerDetailsFromNative(scoped_xevent);
+ EXPECT_FLOAT_EQ(pointer_details.radius_x(), 10.0f);
+ EXPECT_FLOAT_EQ(pointer_details.force(), 0.05f);
// Touch with tracking id 6 should have old angle/pressure value and new
// radius value.
@@ -293,9 +298,10 @@ TEST_F(EventsXTest, TouchEventBasic) {
EXPECT_EQ(ui::ET_TOUCH_RELEASED, ui::EventTypeFromNative(scoped_xevent));
EXPECT_EQ("200,200", ui::EventLocationFromNative(scoped_xevent).ToString());
EXPECT_EQ(GetTouchId(scoped_xevent), 1);
- EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 25);
EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.45f);
- EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.5f);
+ pointer_details = GetTouchPointerDetailsFromNative(scoped_xevent);
+ EXPECT_FLOAT_EQ(pointer_details.radius_x(), 25.0f);
+ EXPECT_FLOAT_EQ(pointer_details.force(), 0.5f);
}
int GetTouchIdForTrackingId(uint32_t tracking_id) {
« no previous file with comments | « ui/events/x/events_x.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698