ax_relative_bounds_mojom_traits_unittest.cc 1.1 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright 2018 The Chromium Authors. 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.
  4. #include "ui/accessibility/mojom/ax_relative_bounds_mojom_traits.h"
  5. #include "mojo/public/cpp/test_support/test_utils.h"
  6. #include "testing/gtest/include/gtest/gtest.h"
  7. #include "ui/accessibility/ax_relative_bounds.h"
  8. #include "ui/accessibility/mojom/ax_relative_bounds.mojom.h"
  9. using mojo::test::SerializeAndDeserialize;
  10. TEST(AXRelativeBoundsMojomTraitsTest, RoundTrip) {
  11. ui::AXRelativeBounds input;
  12. input.offset_container_id = 111;
  13. input.bounds = gfx::RectF(1, 2, 3, 4);
  14. input.transform = std::make_unique<gfx::Transform>();
  15. input.transform->Scale(1.0, 2.0);
  16. ui::AXRelativeBounds output;
  17. EXPECT_TRUE(
  18. SerializeAndDeserialize<ax::mojom::AXRelativeBounds>(input, output));
  19. EXPECT_EQ(111, output.offset_container_id);
  20. EXPECT_EQ(1, output.bounds.x());
  21. EXPECT_EQ(2, output.bounds.y());
  22. EXPECT_EQ(3, output.bounds.width());
  23. EXPECT_EQ(4, output.bounds.height());
  24. EXPECT_FALSE(output.transform->IsIdentity());
  25. }