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 16 matching lines...) Expand all Loading... | |
27 bound.layer_id = 42; | 27 bound.layer_id = 42; |
28 VerifySerializeAndDeserializeProto(bound); | 28 VerifySerializeAndDeserializeProto(bound); |
29 bound.type = SelectionBoundType::SELECTION_BOUND_RIGHT; | 29 bound.type = SelectionBoundType::SELECTION_BOUND_RIGHT; |
30 VerifySerializeAndDeserializeProto(bound); | 30 VerifySerializeAndDeserializeProto(bound); |
31 bound.type = SelectionBoundType::SELECTION_BOUND_CENTER; | 31 bound.type = SelectionBoundType::SELECTION_BOUND_CENTER; |
32 VerifySerializeAndDeserializeProto(bound); | 32 VerifySerializeAndDeserializeProto(bound); |
33 bound.type = SelectionBoundType::SELECTION_BOUND_EMPTY; | 33 bound.type = SelectionBoundType::SELECTION_BOUND_EMPTY; |
34 VerifySerializeAndDeserializeProto(bound); | 34 VerifySerializeAndDeserializeProto(bound); |
35 } | 35 } |
36 | 36 |
37 void VerifySerializeAndDeserializeLayerSelectionProto( | |
vmpstr
2015/12/18 07:50:02
Move this after the other function above please. I
nyquist
2015/12/18 18:54:35
Done.
| |
38 const LayerSelection& selection1) { | |
39 proto::LayerSelection proto; | |
40 LayerSelectionToProtobuf(selection1, &proto); | |
41 LayerSelection selection2; | |
42 LayerSelectionFromProtobuf(&selection2, proto); | |
43 EXPECT_EQ(selection1, selection2); | |
44 } | |
45 | |
46 TEST(LayerSelectionTest, AllSelectionPermutations) { | |
47 LayerSelectionBound start; | |
48 start.type = SelectionBoundType::SELECTION_BOUND_LEFT; | |
49 start.edge_top = gfx::Point(3, 14); | |
50 start.edge_bottom = gfx::Point(6, 28); | |
51 start.layer_id = 42; | |
vmpstr
2015/12/18 07:50:02
blank after this line please
nyquist
2015/12/18 18:54:35
Done.
| |
52 LayerSelectionBound end; | |
53 end.type = SelectionBoundType::SELECTION_BOUND_RIGHT; | |
54 end.edge_top = gfx::Point(14, 3); | |
55 end.edge_bottom = gfx::Point(28, 6); | |
56 end.layer_id = 24; | |
vmpstr
2015/12/18 07:50:02
blank after this line please
nyquist
2015/12/18 18:54:35
Done.
| |
57 LayerSelection selection; | |
58 selection.start = start; | |
59 selection.end = end; | |
60 selection.is_editable = true; | |
61 selection.is_empty_text_form_control = true; | |
vmpstr
2015/12/18 07:50:02
blank after this line please
nyquist
2015/12/18 18:54:35
Done.
| |
62 VerifySerializeAndDeserializeLayerSelectionProto(selection); | |
63 selection.is_empty_text_form_control = false; | |
64 VerifySerializeAndDeserializeLayerSelectionProto(selection); | |
65 selection.is_editable = false; | |
66 VerifySerializeAndDeserializeLayerSelectionProto(selection); | |
67 selection.is_empty_text_form_control = true; | |
68 VerifySerializeAndDeserializeLayerSelectionProto(selection); | |
69 } | |
70 | |
37 } // namespace | 71 } // namespace |
38 } // namespace cc | 72 } // namespace cc |
OLD | NEW |