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

Unified Diff: ui/gfx/mojo/struct_traits_unittest.cc

Issue 2040483003: Implement gfx::SelectionBound StructTraits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/gfx/mojo/selection_bound_struct_traits.h ('k') | ui/gfx/mojo/traits_test_service.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/mojo/struct_traits_unittest.cc
diff --git a/ui/gfx/mojo/struct_traits_unittest.cc b/ui/gfx/mojo/struct_traits_unittest.cc
index 9d43d601ceebccc8924b72f9399eef71ecaff699..bca2193c7f8e2dad39769aaaeef5309569e4ef6d 100644
--- a/ui/gfx/mojo/struct_traits_unittest.cc
+++ b/ui/gfx/mojo/struct_traits_unittest.cc
@@ -6,6 +6,7 @@
#include "mojo/public/cpp/bindings/binding_set.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/mojo/traits_test_service.mojom.h"
+#include "ui/gfx/selection_bound.h"
#include "ui/gfx/transform.h"
namespace gfx {
@@ -23,6 +24,11 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
private:
// TraitsTestService:
+ void EchoSelectionBound(const SelectionBound& s,
+ const EchoSelectionBoundCallback& callback) override {
+ callback.Run(s);
+ }
+
void EchoTransform(const Transform& t,
const EchoTransformCallback& callback) override {
callback.Run(t);
@@ -36,6 +42,26 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
} // namespace
+TEST_F(StructTraitsTest, SelectionBound) {
+ const gfx::SelectionBound::Type type = gfx::SelectionBound::CENTER;
+ const gfx::PointF edge_top(1234.5f, 5678.6f);
+ const gfx::PointF edge_bottom(910112.5f, 13141516.6f);
+ const bool visible = true;
+ gfx::SelectionBound input;
+ input.set_type(type);
+ input.SetEdge(edge_top, edge_bottom);
+ input.set_visible(visible);
+ mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
+ gfx::SelectionBound output;
+ proxy->EchoSelectionBound(input, &output);
+ EXPECT_EQ(type, output.type());
+ EXPECT_EQ(edge_top, output.edge_top());
+ EXPECT_EQ(edge_bottom, output.edge_bottom());
+ EXPECT_EQ(input.edge_top_rounded(), output.edge_top_rounded());
+ EXPECT_EQ(input.edge_bottom_rounded(), output.edge_bottom_rounded());
+ EXPECT_EQ(visible, output.visible());
+}
+
TEST_F(StructTraitsTest, Transform) {
const float col1row1 = 1.f;
const float col2row1 = 2.f;
« no previous file with comments | « ui/gfx/mojo/selection_bound_struct_traits.h ('k') | ui/gfx/mojo/traits_test_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698