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

Unified Diff: cc/trees/layer_tree_impl_unittest.cc

Issue 2030033003: Replace cc::ViewportSelectionBound with gfx::SelectionBound (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use gfx::SelectionBound 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
Index: cc/trees/layer_tree_impl_unittest.cc
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 4c4769bbc1c17d485aa5f5f622423c7718a76938..bda25b6b9ecf6eadf85737b1aba4da68d007027b 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -2181,24 +2181,24 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) {
input.end.edge_bottom = gfx::Point(50, 30);
input.end.layer_id = root_layer_id;
- ViewportSelection output;
+ Selection<gfx::SelectionBound> output;
// Empty input bounds should produce empty output bounds.
host_impl().active_tree()->GetViewportSelection(&output);
- EXPECT_EQ(ViewportSelectionBound(), output.start);
- EXPECT_EQ(ViewportSelectionBound(), output.end);
+ EXPECT_EQ(gfx::SelectionBound(), output.start);
+ EXPECT_EQ(gfx::SelectionBound(), output.end);
// Selection bounds should produce distinct left and right bounds.
host_impl().active_tree()->RegisterSelection(input);
host_impl().active_tree()->GetViewportSelection(&output);
- EXPECT_EQ(input.start.type, output.start.type);
- EXPECT_EQ(gfx::PointF(input.start.edge_bottom), output.start.edge_bottom);
- EXPECT_EQ(gfx::PointF(input.start.edge_top), output.start.edge_top);
- EXPECT_TRUE(output.start.visible);
- EXPECT_EQ(input.end.type, output.end.type);
- EXPECT_EQ(gfx::PointF(input.end.edge_bottom), output.end.edge_bottom);
- EXPECT_EQ(gfx::PointF(input.end.edge_top), output.end.edge_top);
- EXPECT_TRUE(output.end.visible);
+ // EXPECT_EQ(input.start.type(), output.start.type());
+ EXPECT_EQ(gfx::PointF(input.start.edge_bottom), output.start.edge_bottom());
+ EXPECT_EQ(gfx::PointF(input.start.edge_top), output.start.edge_top());
+ EXPECT_TRUE(output.start.visible());
+ // EXPECT_EQ(input.end.type(), output.end.type());
+ EXPECT_EQ(gfx::PointF(input.end.edge_bottom), output.end.edge_bottom());
+ EXPECT_EQ(gfx::PointF(input.end.edge_top), output.end.edge_top());
+ EXPECT_TRUE(output.end.visible());
EXPECT_EQ(input.is_editable, output.is_editable);
EXPECT_EQ(input.is_empty_text_form_control,
output.is_empty_text_form_control);
@@ -2214,14 +2214,15 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) {
insertion_input.end = insertion_input.start;
host_impl().active_tree()->RegisterSelection(insertion_input);
host_impl().active_tree()->GetViewportSelection(&output);
- EXPECT_EQ(insertion_input.start.type, output.start.type);
+ // EXPECT_EQ(insertion_input.start.type(), output.start.type);
EXPECT_EQ(gfx::PointF(insertion_input.start.edge_bottom),
- output.start.edge_bottom);
- EXPECT_EQ(gfx::PointF(insertion_input.start.edge_top), output.start.edge_top);
+ output.start.edge_bottom());
+ EXPECT_EQ(gfx::PointF(insertion_input.start.edge_top),
+ output.start.edge_top());
EXPECT_EQ(insertion_input.is_editable, output.is_editable);
EXPECT_EQ(insertion_input.is_empty_text_form_control,
output.is_empty_text_form_control);
- EXPECT_TRUE(output.start.visible);
+ EXPECT_TRUE(output.start.visible());
EXPECT_EQ(output.start, output.end);
}
@@ -2284,44 +2285,44 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
host_impl().active_tree()->RegisterSelection(input);
// The left bound should be occluded by the clip layer.
- ViewportSelection output;
+ Selection<gfx::SelectionBound> output;
host_impl().active_tree()->GetViewportSelection(&output);
- EXPECT_EQ(input.start.type, output.start.type);
+ // EXPECT_EQ(input.start.type, output.start.type);
auto expected_output_start_top = gfx::PointF(input.start.edge_top);
auto expected_output_edge_botom = gfx::PointF(input.start.edge_bottom);
expected_output_start_top.Offset(clipping_offset.x(), clipping_offset.y());
expected_output_edge_botom.Offset(clipping_offset.x(), clipping_offset.y());
- EXPECT_EQ(expected_output_start_top, output.start.edge_top);
- EXPECT_EQ(expected_output_edge_botom, output.start.edge_bottom);
- EXPECT_TRUE(output.start.visible);
- EXPECT_EQ(input.end.type, output.end.type);
+ EXPECT_EQ(expected_output_start_top, output.start.edge_top());
+ EXPECT_EQ(expected_output_edge_botom, output.start.edge_bottom());
+ EXPECT_TRUE(output.start.visible());
+ // EXPECT_EQ(input.end.type, output.end.type());
auto expected_output_end_top = gfx::PointF(input.end.edge_top);
auto expected_output_end_bottom = gfx::PointF(input.end.edge_bottom);
expected_output_end_bottom.Offset(clipping_offset.x(), clipping_offset.y());
expected_output_end_top.Offset(clipping_offset.x(), clipping_offset.y());
- EXPECT_EQ(expected_output_end_top, output.end.edge_top);
- EXPECT_EQ(expected_output_end_bottom, output.end.edge_bottom);
- EXPECT_FALSE(output.end.visible);
+ EXPECT_EQ(expected_output_end_top, output.end.edge_top());
+ EXPECT_EQ(expected_output_end_bottom, output.end.edge_bottom());
+ EXPECT_FALSE(output.end.visible());
// Handles outside the viewport bounds should be marked invisible.
input.start.edge_top = gfx::Point(-25, 0);
input.start.edge_bottom = gfx::Point(-25, 20);
host_impl().active_tree()->RegisterSelection(input);
host_impl().active_tree()->GetViewportSelection(&output);
- EXPECT_FALSE(output.start.visible);
+ EXPECT_FALSE(output.start.visible());
input.start.edge_top = gfx::Point(0, -25);
input.start.edge_bottom = gfx::Point(0, -5);
host_impl().active_tree()->RegisterSelection(input);
host_impl().active_tree()->GetViewportSelection(&output);
- EXPECT_FALSE(output.start.visible);
+ EXPECT_FALSE(output.start.visible());
// If the handle bottom is partially visible, the handle is marked visible.
input.start.edge_top = gfx::Point(0, -20);
input.start.edge_bottom = gfx::Point(0, 1);
host_impl().active_tree()->RegisterSelection(input);
host_impl().active_tree()->GetViewportSelection(&output);
- EXPECT_TRUE(output.start.visible);
+ EXPECT_TRUE(output.start.visible());
}
TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
@@ -2385,17 +2386,17 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
// The viewport bounds should be properly scaled by the page scale, but should
// remain in DIP coordinates.
- ViewportSelection output;
+ Selection<gfx::SelectionBound> output;
host_impl().active_tree()->GetViewportSelection(&output);
- EXPECT_EQ(input.start.type, output.start.type);
+ // EXPECT_EQ(input.start.type, output.start.type);
auto expected_output_start_top = gfx::PointF(input.start.edge_top);
auto expected_output_edge_bottom = gfx::PointF(input.start.edge_bottom);
expected_output_start_top.Scale(page_scale_factor);
expected_output_edge_bottom.Scale(page_scale_factor);
- EXPECT_EQ(expected_output_start_top, output.start.edge_top);
- EXPECT_EQ(expected_output_edge_bottom, output.start.edge_bottom);
- EXPECT_TRUE(output.start.visible);
- EXPECT_EQ(input.end.type, output.end.type);
+ EXPECT_EQ(expected_output_start_top, output.start.edge_top());
+ EXPECT_EQ(expected_output_edge_bottom, output.start.edge_bottom());
+ EXPECT_TRUE(output.start.visible());
+ // EXPECT_EQ(input.end.type, output.end.type);
auto expected_output_end_top = gfx::PointF(input.end.edge_top);
auto expected_output_end_bottom = gfx::PointF(input.end.edge_bottom);
@@ -2403,9 +2404,9 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
expected_output_end_bottom.Offset(sub_layer_offset.x(), sub_layer_offset.y());
expected_output_end_top.Scale(page_scale_factor);
expected_output_end_bottom.Scale(page_scale_factor);
- EXPECT_EQ(expected_output_end_top, output.end.edge_top);
- EXPECT_EQ(expected_output_end_bottom, output.end.edge_bottom);
- EXPECT_TRUE(output.end.visible);
+ EXPECT_EQ(expected_output_end_top, output.end.edge_top());
+ EXPECT_EQ(expected_output_end_bottom, output.end.edge_bottom());
+ EXPECT_TRUE(output.end.visible());
}
TEST_F(LayerTreeImplTest, SelectionBoundsWithLargeTransforms) {
@@ -2462,13 +2463,13 @@ TEST_F(LayerTreeImplTest, SelectionBoundsWithLargeTransforms) {
host_impl().active_tree()->RegisterSelection(input);
- ViewportSelection output;
+ Selection<gfx::SelectionBound> output;
host_impl().active_tree()->GetViewportSelection(&output);
// edge_bottom and edge_top aren't allowed to have NaNs, so the selection
// should be empty.
- EXPECT_EQ(ViewportSelectionBound(), output.start);
- EXPECT_EQ(ViewportSelectionBound(), output.end);
+ EXPECT_EQ(gfx::SelectionBound(), output.start);
+ EXPECT_EQ(gfx::SelectionBound(), output.end);
}
TEST_F(LayerTreeImplTest, NumLayersTestOne) {

Powered by Google App Engine
This is Rietveld 408576698