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

Unified Diff: ash/display/display_manager_unittest.cc

Issue 485873002: Enable subpixel positioning for internal display with dsf larger than 1.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/display/display_manager_unittest.cc
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index 2d3fc3e185920c9ce9196ec2f3398dbc1d5b649f..36ad18edcb76f3f6ee6206e84e332216c5c854fe 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -4,6 +4,7 @@
#include "ash/display/display_manager.h"
+#include "ash/ash_switches.h"
#include "ash/display/display_controller.h"
#include "ash/display/display_layout_store.h"
#include "ash/screen_util.h"
@@ -11,6 +12,7 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/display_manager_test_api.h"
#include "ash/test/mirror_window_test_api.h"
+#include "base/command_line.h"
#include "base/format_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
@@ -20,6 +22,7 @@
#include "ui/events/test/event_generator.h"
#include "ui/gfx/display.h"
#include "ui/gfx/display_observer.h"
+#include "ui/gfx/font_render_params.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/screen_type_delegate.h"
@@ -1381,4 +1384,72 @@ TEST_F(ScreenShutdownTest, ScreenAfterShutdown) {
UpdateDisplay("500x300,800x400");
}
+#if defined(OS_CHROMEOS)
+template <const char* VALUE, bool INTERNAL>
+class DisplayManagerFontTest : public test::AshTestBase {
+ public:
+ DisplayManagerFontTest() {}
+ virtual ~DisplayManagerFontTest() {}
+
+ virtual void SetUp() OVERRIDE {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (INTERNAL)
+ command_line->AppendSwitch(switches::kAshUseFirstDisplayAsInternal);
+ command_line->AppendSwitchASCII(switches::kAshHostWindowBounds, VALUE);
+ test::AshTestBase::SetUp();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DisplayManagerFontTest);
+};
+
+const char DSF100[] = "1000x800*1.00";
+const char DSF125[] = "1000x800*1.25";
+const char DSF200[] = "1000x800*2.00";
+typedef DisplayManagerFontTest<DSF100, true> DisplayManagerFontTestInternal100;
+typedef DisplayManagerFontTest<DSF125, true> DisplayManagerFontTestInternal125;
+typedef DisplayManagerFontTest<DSF200, true> DisplayManagerFontTestInternal200;
+
+TEST_F(DisplayManagerFontTestInternal100, TestDsf100) {
+ ASSERT_EQ(1.0f,
+ Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ EXPECT_FALSE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
+}
+
+TEST_F(DisplayManagerFontTestInternal125, TestDsf125) {
+ ASSERT_EQ(1.25f,
+ Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ EXPECT_TRUE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
+}
+
+TEST_F(DisplayManagerFontTestInternal200, TestDsf200) {
+ ASSERT_EQ(2.0f,
+ Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ EXPECT_TRUE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
+}
+
+typedef DisplayManagerFontTest<DSF100, false> DisplayManagerFontTestExternal100;
+typedef DisplayManagerFontTest<DSF125, false> DisplayManagerFontTestExternal125;
+typedef DisplayManagerFontTest<DSF200, false> DisplayManagerFontTestExternal200;
+
+TEST_F(DisplayManagerFontTestExternal100, TestDsf100) {
+ ASSERT_EQ(1.0f,
+ Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ EXPECT_FALSE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
+}
+
+TEST_F(DisplayManagerFontTestExternal125, TestDsf125) {
+ ASSERT_EQ(1.25f,
+ Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ EXPECT_FALSE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
+}
+
+TEST_F(DisplayManagerFontTestExternal200, TestDsf200) {
+ ASSERT_EQ(2.0f,
+ Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ EXPECT_FALSE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
+}
+
+#endif // OS_CHROMEOS
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698