OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 |
| 5 #include "cc/input/layer_selection_bound.h" |
| 6 |
| 7 #include "cc/proto/layer_selection_bound.pb.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gfx/geometry/point.h" |
| 10 |
| 11 namespace cc { |
| 12 namespace { |
| 13 |
| 14 void VerifySerializeAndDeserializeProto(const LayerSelectionBound& bound1) { |
| 15 proto::LayerSelectionBound proto; |
| 16 bound1.ToProtobuf(&proto); |
| 17 LayerSelectionBound bound2; |
| 18 bound2.FromProtobuf(proto); |
| 19 EXPECT_EQ(bound1, bound2); |
| 20 } |
| 21 |
| 22 TEST(LayerSelectionBoundTest, AllTypePermutations) { |
| 23 LayerSelectionBound bound; |
| 24 bound.type = SelectionBoundType::SELECTION_BOUND_LEFT; |
| 25 bound.edge_top = gfx::Point(3, 14); |
| 26 bound.edge_bottom = gfx::Point(6, 28); |
| 27 bound.layer_id = 42; |
| 28 VerifySerializeAndDeserializeProto(bound); |
| 29 bound.type = SelectionBoundType::SELECTION_BOUND_RIGHT; |
| 30 VerifySerializeAndDeserializeProto(bound); |
| 31 bound.type = SelectionBoundType::SELECTION_BOUND_CENTER; |
| 32 VerifySerializeAndDeserializeProto(bound); |
| 33 bound.type = SelectionBoundType::SELECTION_BOUND_EMPTY; |
| 34 VerifySerializeAndDeserializeProto(bound); |
| 35 } |
| 36 |
| 37 } // namespace |
| 38 } // namespace cc |
OLD | NEW |