summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-14 23:19:21 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-14 23:19:21 +0000
commita82301857259527dc0f48497fe8c93a359730ca4 (patch)
tree594a17d403a04fedec0e1bb60b17f153dc5edb3b
parent9a47855c02f699d96bf514e394df2b5a7f405ade (diff)
downloadchromium_src-a82301857259527dc0f48497fe8c93a359730ca4.zip
chromium_src-a82301857259527dc0f48497fe8c93a359730ca4.tar.gz
chromium_src-a82301857259527dc0f48497fe8c93a359730ca4.tar.bz2
Fix InfoBubble unittests to be more consistent in how they expect coordinate slop to work.
TBR=jcivelli BUG=none TEST=tests pass Review URL: http://codereview.chromium.org/2859001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49741 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/views/info_bubble_unittest.cc37
1 files changed, 20 insertions, 17 deletions
diff --git a/chrome/browser/views/info_bubble_unittest.cc b/chrome/browser/views/info_bubble_unittest.cc
index 8b55422..8d7f8ece 100644
--- a/chrome/browser/views/info_bubble_unittest.cc
+++ b/chrome/browser/views/info_bubble_unittest.cc
@@ -51,8 +51,8 @@ TEST_F(InfoBubbleTest, BorderContentsSizeAndGetBounds) {
EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location));
EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location));
EXPECT_GT(window_bounds.x(), 100);
- EXPECT_GT(window_bounds.y(), 140); // 140 because the arrow overlaps a bit on
- // the position_relative_to.
+ EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for
+ // arrow overlap.
// Test bubble not fitting on left.
border_contents.SizeAndGetBounds(
@@ -67,7 +67,8 @@ TEST_F(InfoBubbleTest, BorderContentsSizeAndGetBounds) {
EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location));
EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location));
EXPECT_GT(window_bounds.x(), 100);
- EXPECT_GT(window_bounds.y(), 140);
+ EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for
+ // arrow overlap.
// Test bubble not fitting on left or top.
border_contents.SizeAndGetBounds(
@@ -82,7 +83,8 @@ TEST_F(InfoBubbleTest, BorderContentsSizeAndGetBounds) {
EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location));
EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location));
EXPECT_GT(window_bounds.x(), 100);
- EXPECT_GT(window_bounds.y(), 140);
+ EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for
+ // arrow overlap.
// Test bubble not fitting on top.
border_contents.SizeAndGetBounds(
@@ -97,7 +99,8 @@ TEST_F(InfoBubbleTest, BorderContentsSizeAndGetBounds) {
EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location));
EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location));
EXPECT_GT(window_bounds.x(), 100);
- EXPECT_GT(window_bounds.y(), 140);
+ EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for
+ // arrow overlap.
// Test bubble not fitting on top and right.
border_contents.SizeAndGetBounds(
@@ -111,9 +114,9 @@ TEST_F(InfoBubbleTest, BorderContentsSizeAndGetBounds) {
EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location));
EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location));
EXPECT_FALSE(BubbleBorder::is_arrow_on_left(arrow_location));
- // The window should be right aligned with the position_relative_to.
- EXPECT_LT(window_bounds.x(), 900 + 50 / 2 - 500);
- EXPECT_GT(window_bounds.y(), 140);
+ EXPECT_LT(window_bounds.x(), 900 + 50 - 500);
+ EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for
+ // arrow overlap.
// Test bubble not fitting on right.
border_contents.SizeAndGetBounds(
@@ -127,9 +130,9 @@ TEST_F(InfoBubbleTest, BorderContentsSizeAndGetBounds) {
EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location));
EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location));
EXPECT_FALSE(BubbleBorder::is_arrow_on_left(arrow_location));
- // The window should be right aligned with the position_relative_to.
- EXPECT_LT(window_bounds.x(), 900 + 50 / 2 - 500);
- EXPECT_GT(window_bounds.y(), 140);
+ EXPECT_LT(window_bounds.x(), 900 + 50 - 500);
+ EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for
+ // arrow overlap.
// Test bubble not fitting on bottom and right.
border_contents.SizeAndGetBounds(
@@ -143,8 +146,7 @@ TEST_F(InfoBubbleTest, BorderContentsSizeAndGetBounds) {
EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location));
EXPECT_FALSE(BubbleBorder::is_arrow_on_top(arrow_location));
EXPECT_FALSE(BubbleBorder::is_arrow_on_left(arrow_location));
- // The window should be right aligned with the position_relative_to.
- EXPECT_LT(window_bounds.x(), 900 + 50 / 2 - 500);
+ EXPECT_LT(window_bounds.x(), 900 + 50 - 500);
EXPECT_LT(window_bounds.y(), 900 - 500 - 15); // -15 to roughly compensate
// for arrow height.
@@ -161,7 +163,7 @@ TEST_F(InfoBubbleTest, BorderContentsSizeAndGetBounds) {
EXPECT_FALSE(BubbleBorder::is_arrow_on_top(arrow_location));
EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location));
// The window should be right aligned with the position_relative_to.
- EXPECT_LT(window_bounds.x(), 900 + 50 / 2 - 500);
+ EXPECT_LT(window_bounds.x(), 900 + 50 - 500);
EXPECT_LT(window_bounds.y(), 900 - 500 - 15); // -15 to roughly compensate
// for arrow height.
@@ -178,7 +180,7 @@ TEST_F(InfoBubbleTest, BorderContentsSizeAndGetBounds) {
EXPECT_FALSE(BubbleBorder::is_arrow_on_top(arrow_location));
EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location));
// The window should be right aligned with the position_relative_to.
- EXPECT_LT(window_bounds.x(), 900 + 50 / 2 - 500);
+ EXPECT_LT(window_bounds.x(), 900 + 50 - 500);
EXPECT_LT(window_bounds.y(), 900 - 500 - 15); // -15 to roughly compensate
// for arrow height.
}
@@ -229,6 +231,7 @@ TEST_F(InfoBubbleTest, BorderContentsSizeAndGetBoundsAllowOffscreen) {
EXPECT_FALSE(BubbleBorder::is_arrow_on_left(arrow_location));
// The coordinates should be pointing to 'positive relative to' from
// TOP_RIGHT.
- EXPECT_LT(window_bounds.x(), 100 + 50 / 2 - 500);
- EXPECT_GT(window_bounds.y(), 900 + 50 - 10);
+ EXPECT_LT(window_bounds.x(), 100 + 50 - 500);
+ EXPECT_GT(window_bounds.y(), 900 + 50 - 10); // -10 to roughly compensate for
+ // arrow overlap.
}