Commit 2cd14f02 authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

split view: Consolidate two closely related unit tests into one

Bug: 987031
Change-Id: Ibb305be230b9a1cfa17cbdbc374b1fe37bd2d38c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1848795Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704662}
parent 9266aee3
......@@ -393,6 +393,40 @@ TEST_F(SplitViewDragIndicatorsTest, SplitViewDragIndicatorsVisibility) {
check_helper(indicator.get(), to_int(IndicatorType::kLeftHighlight));
indicator->SetIndicatorState(IndicatorState::kPreviewAreaRight, gfx::Point());
check_helper(indicator.get(), to_int(IndicatorType::kRightHighlight));
const int left_with_text =
to_int(IndicatorType::kLeftHighlight) | to_int(IndicatorType::kLeftText);
const int right_with_text = to_int(IndicatorType::kRightHighlight) |
to_int(IndicatorType::kRightText);
// Verify that only one highlight shows up for each one-sided dragging or
// cannot snap state, if the previous state is |IndicatorState::kNone|.
indicator->SetIndicatorState(IndicatorState::kNone, gfx::Point());
indicator->SetIndicatorState(IndicatorState::kDragAreaLeft, gfx::Point());
check_helper(indicator.get(), left_with_text);
indicator->SetIndicatorState(IndicatorState::kNone, gfx::Point());
indicator->SetIndicatorState(IndicatorState::kDragAreaRight, gfx::Point());
check_helper(indicator.get(), right_with_text);
indicator->SetIndicatorState(IndicatorState::kNone, gfx::Point());
indicator->SetIndicatorState(IndicatorState::kCannotSnapLeft, gfx::Point());
check_helper(indicator.get(), left_with_text);
indicator->SetIndicatorState(IndicatorState::kNone, gfx::Point());
indicator->SetIndicatorState(IndicatorState::kCannotSnapRight, gfx::Point());
check_helper(indicator.get(), right_with_text);
// Verify that only one highlight shows up for each one-sided dragging or
// cannot snap state, if the previous state is of a preview on the same side.
indicator->SetIndicatorState(IndicatorState::kPreviewAreaLeft, gfx::Point());
indicator->SetIndicatorState(IndicatorState::kDragAreaLeft, gfx::Point());
check_helper(indicator.get(), left_with_text);
indicator->SetIndicatorState(IndicatorState::kPreviewAreaRight, gfx::Point());
indicator->SetIndicatorState(IndicatorState::kDragAreaRight, gfx::Point());
check_helper(indicator.get(), right_with_text);
indicator->SetIndicatorState(IndicatorState::kPreviewAreaLeft, gfx::Point());
indicator->SetIndicatorState(IndicatorState::kCannotSnapLeft, gfx::Point());
check_helper(indicator.get(), left_with_text);
indicator->SetIndicatorState(IndicatorState::kPreviewAreaRight, gfx::Point());
indicator->SetIndicatorState(IndicatorState::kCannotSnapRight, gfx::Point());
check_helper(indicator.get(), right_with_text);
}
// Verify that the split view drag indicators widget reparents when starting a
......
......@@ -207,40 +207,4 @@ TEST_F(SplitViewHighlightViewTest, RightBounds) {
EXPECT_TRUE(GetTransform(test_api.GetRightBottomView()).IsIdentity());
}
// Test when there is only one indicator is visible, the other indicator should
// always have 0 opacity.
TEST_F(SplitViewHighlightViewTest, SingleIndicatorOpacityTest) {
const gfx::Rect bounds(100, 0, 100, 100);
left_highlight()->SetBounds(bounds, /*landscape=*/false,
/*animation_type=*/base::nullopt);
left_highlight()->SetPaintToLayer();
left_highlight()->layer()->SetOpacity(0.f);
right_highlight()->SetBounds(bounds, /*landscape=*/false,
/*animation_type=*/base::nullopt);
right_highlight()->SetPaintToLayer();
right_highlight()->layer()->SetOpacity(0.f);
left_highlight()->OnIndicatorTypeChanged(IndicatorState::kDragAreaRight,
IndicatorState::kNone);
EXPECT_EQ(0.f, left_highlight()->layer()->opacity());
right_highlight()->OnIndicatorTypeChanged(IndicatorState::kDragAreaRight,
IndicatorState::kNone);
EXPECT_EQ(kHighlightOpacity, right_highlight()->layer()->opacity());
left_highlight()->OnIndicatorTypeChanged(IndicatorState::kPreviewAreaRight,
IndicatorState::kDragAreaRight);
EXPECT_EQ(0.f, left_highlight()->layer()->opacity());
right_highlight()->OnIndicatorTypeChanged(IndicatorState::kPreviewAreaRight,
IndicatorState::kDragAreaRight);
EXPECT_EQ(kPreviewAreaHighlightOpacity,
right_highlight()->layer()->opacity());
left_highlight()->OnIndicatorTypeChanged(IndicatorState::kDragAreaRight,
IndicatorState::kPreviewAreaRight);
EXPECT_EQ(0.f, left_highlight()->layer()->opacity());
right_highlight()->OnIndicatorTypeChanged(IndicatorState::kDragAreaRight,
IndicatorState::kPreviewAreaRight);
EXPECT_EQ(kHighlightOpacity, right_highlight()->layer()->opacity());
}
} // namespace ash
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment