OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/input/layer_selection_bound.h" | 5 #include "cc/input/layer_selection_bound.h" |
6 | 6 |
7 #include "cc/proto/layer_selection_bound.pb.h" | 7 #include "cc/proto/layer_selection_bound.pb.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/gfx/geometry/point.h" | 9 #include "ui/gfx/geometry/point.h" |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 const LayerSelection& selection1) { | 23 const LayerSelection& selection1) { |
24 proto::LayerSelection proto; | 24 proto::LayerSelection proto; |
25 LayerSelectionToProtobuf(selection1, &proto); | 25 LayerSelectionToProtobuf(selection1, &proto); |
26 LayerSelection selection2; | 26 LayerSelection selection2; |
27 LayerSelectionFromProtobuf(&selection2, proto); | 27 LayerSelectionFromProtobuf(&selection2, proto); |
28 EXPECT_EQ(selection1, selection2); | 28 EXPECT_EQ(selection1, selection2); |
29 } | 29 } |
30 | 30 |
31 TEST(LayerSelectionBoundTest, AllTypePermutations) { | 31 TEST(LayerSelectionBoundTest, AllTypePermutations) { |
32 LayerSelectionBound bound; | 32 LayerSelectionBound bound; |
33 bound.type = SelectionBoundType::SELECTION_BOUND_LEFT; | 33 bound.type = gfx::SelectionBound::LEFT; |
34 bound.edge_top = gfx::Point(3, 14); | 34 bound.edge_top = gfx::Point(3, 14); |
35 bound.edge_bottom = gfx::Point(6, 28); | 35 bound.edge_bottom = gfx::Point(6, 28); |
36 bound.layer_id = 42; | 36 bound.layer_id = 42; |
37 | 37 |
38 VerifySerializeAndDeserializeProto(bound); | 38 VerifySerializeAndDeserializeProto(bound); |
39 bound.type = SelectionBoundType::SELECTION_BOUND_RIGHT; | 39 bound.type = gfx::SelectionBound::RIGHT; |
40 VerifySerializeAndDeserializeProto(bound); | 40 VerifySerializeAndDeserializeProto(bound); |
41 bound.type = SelectionBoundType::SELECTION_BOUND_CENTER; | 41 bound.type = gfx::SelectionBound::CENTER; |
42 VerifySerializeAndDeserializeProto(bound); | 42 VerifySerializeAndDeserializeProto(bound); |
43 bound.type = SelectionBoundType::SELECTION_BOUND_EMPTY; | 43 bound.type = gfx::SelectionBound::EMPTY; |
44 VerifySerializeAndDeserializeProto(bound); | 44 VerifySerializeAndDeserializeProto(bound); |
45 } | 45 } |
46 | 46 |
47 TEST(LayerSelectionTest, AllSelectionPermutations) { | 47 TEST(LayerSelectionTest, AllSelectionPermutations) { |
48 LayerSelectionBound start; | 48 LayerSelectionBound start; |
49 start.type = SelectionBoundType::SELECTION_BOUND_LEFT; | 49 start.type = gfx::SelectionBound::LEFT; |
50 start.edge_top = gfx::Point(3, 14); | 50 start.edge_top = gfx::Point(3, 14); |
51 start.edge_bottom = gfx::Point(6, 28); | 51 start.edge_bottom = gfx::Point(6, 28); |
52 start.layer_id = 42; | 52 start.layer_id = 42; |
53 | 53 |
54 LayerSelectionBound end; | 54 LayerSelectionBound end; |
55 end.type = SelectionBoundType::SELECTION_BOUND_RIGHT; | 55 end.type = gfx::SelectionBound::RIGHT; |
56 end.edge_top = gfx::Point(14, 3); | 56 end.edge_top = gfx::Point(14, 3); |
57 end.edge_bottom = gfx::Point(28, 6); | 57 end.edge_bottom = gfx::Point(28, 6); |
58 end.layer_id = 24; | 58 end.layer_id = 24; |
59 | 59 |
60 LayerSelection selection; | 60 LayerSelection selection; |
61 selection.start = start; | 61 selection.start = start; |
62 selection.end = end; | 62 selection.end = end; |
63 selection.is_editable = true; | 63 selection.is_editable = true; |
64 selection.is_empty_text_form_control = true; | 64 selection.is_empty_text_form_control = true; |
65 | 65 |
66 VerifySerializeAndDeserializeLayerSelectionProto(selection); | 66 VerifySerializeAndDeserializeLayerSelectionProto(selection); |
67 selection.is_empty_text_form_control = false; | 67 selection.is_empty_text_form_control = false; |
68 VerifySerializeAndDeserializeLayerSelectionProto(selection); | 68 VerifySerializeAndDeserializeLayerSelectionProto(selection); |
69 selection.is_editable = false; | 69 selection.is_editable = false; |
70 VerifySerializeAndDeserializeLayerSelectionProto(selection); | 70 VerifySerializeAndDeserializeLayerSelectionProto(selection); |
71 selection.is_empty_text_form_control = true; | 71 selection.is_empty_text_form_control = true; |
72 VerifySerializeAndDeserializeLayerSelectionProto(selection); | 72 VerifySerializeAndDeserializeLayerSelectionProto(selection); |
73 } | 73 } |
74 | 74 |
75 } // namespace | 75 } // namespace |
76 } // namespace cc | 76 } // namespace cc |
OLD | NEW |