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

Unified Diff: ash/launcher/launcher_view_unittest.cc

Issue 14574009: Use correctly mirrored points for ideal bounds of launcher item icons. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add RTL icon reordering test. Created 7 years, 8 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: ash/launcher/launcher_view_unittest.cc
diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc
index d1e2e768c164c6a6df29944b88f0eab248ffcca4..7637ef5887366a74cdf434b2ca4c2b41902643df 100644
--- a/ash/launcher/launcher_view_unittest.cc
+++ b/ash/launcher/launcher_view_unittest.cc
@@ -31,6 +31,7 @@
#include "ui/base/events/event.h"
#include "ui/base/events/event_constants.h"
#include "ui/compositor/layer.h"
+#include "ui/views/view_model.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
@@ -377,6 +378,47 @@ class LauncherViewTest : public AshTestBase {
DISALLOW_COPY_AND_ASSIGN(LauncherViewTest);
};
+class LauncherViewRTLTest : public LauncherViewTest {
+ public:
+ LauncherViewRTLTest() {}
+ virtual ~LauncherViewRTLTest() {}
+
+ virtual void SetUp() OVERRIDE {
+ base::i18n::SetICUDefaultLocale("ar");
+ LauncherViewTest::SetUp();
+ ASSERT_TRUE(base::i18n::IsRTL());
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(LauncherViewRTLTest);
+};
+
+// Checks that the ideal item icon bounds match the view's bounds in the screen.
+TEST_F(LauncherViewTest, IdealBoundsOfItemIcon) {
+ LauncherID id = AddTabbedBrowser();
+ internal::LauncherButton* button = GetButtonByID(id);
+ gfx::Rect item_bounds = button->GetBoundsInScreen();
+ gfx::Rect ideal_bounds = launcher_view_->GetIdealBoundsOfItemIcon(id);
+ gfx::Point screen_origin;
+ views::View::ConvertPointToScreen(launcher_view_, &screen_origin);
+ ideal_bounds.Offset(screen_origin.x(), screen_origin.y());
+ EXPECT_EQ(item_bounds.x(), ideal_bounds.x());
+ EXPECT_EQ(item_bounds.y(), ideal_bounds.y());
+}
+
+// Checks that the ideal item icon bounds are correct in RTL.
+TEST_F(LauncherViewRTLTest, IdealBoundsOfItemIcon) {
+ LauncherID id = AddTabbedBrowser();
+ internal::LauncherButton* button = GetButtonByID(id);
+ gfx::Rect item_bounds = button->GetBoundsInScreen();
+ gfx::Rect ideal_bounds = launcher_view_->GetIdealBoundsOfItemIcon(id);
+ gfx::Point screen_origin;
+ views::View::ConvertPointToScreen(launcher_view_, &screen_origin);
+ ideal_bounds.Offset(screen_origin.x(), screen_origin.y());
+ EXPECT_EQ(item_bounds.x(), ideal_bounds.x());
+ EXPECT_EQ(item_bounds.y(), ideal_bounds.y());
+}
+
// Checks that the icon positions do not shift with a state change.
TEST_F(LauncherViewTest, NoStateChangeIconMovement) {
LauncherID last_added = AddAppShortcut();

Powered by Google App Engine
This is Rietveld 408576698