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

Unified Diff: ui/gfx/geometry/mojo/geometry_struct_traits_unittest.cc

Issue 2033583002: Implement gfx::Vector2d and gfx::Vector2dF StructTraits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary deps Created 4 years, 7 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
Index: ui/gfx/geometry/mojo/geometry_struct_traits_unittest.cc
diff --git a/ui/gfx/geometry/mojo/geometry_struct_traits_unittest.cc b/ui/gfx/geometry/mojo/geometry_struct_traits_unittest.cc
index abeff23299c7f8635791030f61d099c11ba76045..d59579443aac5956130092ba269fe1e141b7fecb 100644
--- a/ui/gfx/geometry/mojo/geometry_struct_traits_unittest.cc
+++ b/ui/gfx/geometry/mojo/geometry_struct_traits_unittest.cc
@@ -59,6 +59,16 @@ class GeometryStructTraitsTest : public testing::Test,
callback.Run(i);
}
+ void EchoVector2d(const Vector2d& v,
+ const EchoVector2dCallback& callback) override {
+ callback.Run(v);
+ }
+
+ void EchoVector2dF(const Vector2dF& v,
+ const EchoVector2dFCallback& callback) override {
+ callback.Run(v);
+ }
+
base::MessageLoop loop_;
mojo::BindingSet<GeometryTraitsTestService> traits_test_bindings_;
@@ -171,4 +181,26 @@ TEST_F(GeometryStructTraitsTest, InsetsF) {
EXPECT_EQ(right, output.right());
}
+TEST_F(GeometryStructTraitsTest, Vector2d) {
+ const int32_t x = 1234;
+ const int32_t y = -5678;
+ gfx::Vector2d input(x, y);
+ mojom::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy();
+ gfx::Vector2d output;
+ proxy->EchoVector2d(input, &output);
+ EXPECT_EQ(x, output.x());
+ EXPECT_EQ(y, output.y());
+}
+
+TEST_F(GeometryStructTraitsTest, Vector2dF) {
+ const float x = 1234.5f;
+ const float y = 6789.6f;
+ gfx::Vector2dF input(x, y);
+ mojom::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy();
+ gfx::Vector2dF output;
+ proxy->EchoVector2dF(input, &output);
+ EXPECT_EQ(x, output.x());
+ EXPECT_EQ(y, output.y());
+}
+
} // namespace gfx
« no previous file with comments | « ui/gfx/geometry/mojo/geometry_struct_traits.h ('k') | ui/gfx/geometry/mojo/geometry_traits_test_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698