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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/display/display_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include "ash/ash_switches.h"
7 #include "ash/display/display_controller.h" 8 #include "ash/display/display_controller.h"
8 #include "ash/display/display_layout_store.h" 9 #include "ash/display/display_layout_store.h"
9 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
12 #include "ash/test/display_manager_test_api.h" 13 #include "ash/test/display_manager_test_api.h"
13 #include "ash/test/mirror_window_test_api.h" 14 #include "ash/test/mirror_window_test_api.h"
15 #include "base/command_line.h"
14 #include "base/format_macros.h" 16 #include "base/format_macros.h"
15 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
17 #include "ui/aura/env.h" 19 #include "ui/aura/env.h"
18 #include "ui/aura/window_observer.h" 20 #include "ui/aura/window_observer.h"
19 #include "ui/aura/window_tree_host.h" 21 #include "ui/aura/window_tree_host.h"
20 #include "ui/events/test/event_generator.h" 22 #include "ui/events/test/event_generator.h"
21 #include "ui/gfx/display.h" 23 #include "ui/gfx/display.h"
22 #include "ui/gfx/display_observer.h" 24 #include "ui/gfx/display_observer.h"
25 #include "ui/gfx/font_render_params.h"
23 #include "ui/gfx/screen.h" 26 #include "ui/gfx/screen.h"
24 #include "ui/gfx/screen_type_delegate.h" 27 #include "ui/gfx/screen_type_delegate.h"
25 28
26 namespace ash { 29 namespace ash {
27 30
28 using std::vector; 31 using std::vector;
29 using std::string; 32 using std::string;
30 33
31 using base::StringPrintf; 34 using base::StringPrintf;
32 35
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 private: 1377 private:
1375 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest); 1378 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest);
1376 }; 1379 };
1377 1380
1378 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) { 1381 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) {
1379 if (!SupportsMultipleDisplays()) 1382 if (!SupportsMultipleDisplays())
1380 return; 1383 return;
1381 UpdateDisplay("500x300,800x400"); 1384 UpdateDisplay("500x300,800x400");
1382 } 1385 }
1383 1386
1387 #if defined(OS_CHROMEOS)
1388 template <const char* VALUE, bool INTERNAL>
1389 class DisplayManagerFontTest : public test::AshTestBase {
1390 public:
1391 DisplayManagerFontTest() {}
1392 virtual ~DisplayManagerFontTest() {}
1393
1394 virtual void SetUp() OVERRIDE {
1395 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
1396 if (INTERNAL)
1397 command_line->AppendSwitch(switches::kAshUseFirstDisplayAsInternal);
1398 command_line->AppendSwitchASCII(switches::kAshHostWindowBounds, VALUE);
1399 test::AshTestBase::SetUp();
1400 }
1401
1402 private:
1403 DISALLOW_COPY_AND_ASSIGN(DisplayManagerFontTest);
1404 };
1405
1406 const char DSF100[] = "1000x800*1.00";
1407 const char DSF125[] = "1000x800*1.25";
1408 const char DSF200[] = "1000x800*2.00";
1409 typedef DisplayManagerFontTest<DSF100, true> DisplayManagerFontTestInternal100;
1410 typedef DisplayManagerFontTest<DSF125, true> DisplayManagerFontTestInternal125;
1411 typedef DisplayManagerFontTest<DSF200, true> DisplayManagerFontTestInternal200;
1412
1413 TEST_F(DisplayManagerFontTestInternal100, TestDsf100) {
1414 ASSERT_EQ(1.0f,
1415 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1416 EXPECT_FALSE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
1417 }
1418
1419 TEST_F(DisplayManagerFontTestInternal125, TestDsf125) {
1420 ASSERT_EQ(1.25f,
1421 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1422 EXPECT_TRUE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
1423 }
1424
1425 TEST_F(DisplayManagerFontTestInternal200, TestDsf200) {
1426 ASSERT_EQ(2.0f,
1427 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1428 EXPECT_TRUE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
1429 }
1430
1431 typedef DisplayManagerFontTest<DSF100, false> DisplayManagerFontTestExternal100;
1432 typedef DisplayManagerFontTest<DSF125, false> DisplayManagerFontTestExternal125;
1433 typedef DisplayManagerFontTest<DSF200, false> DisplayManagerFontTestExternal200;
1434
1435 TEST_F(DisplayManagerFontTestExternal100, TestDsf100) {
1436 ASSERT_EQ(1.0f,
1437 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1438 EXPECT_FALSE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
1439 }
1440
1441 TEST_F(DisplayManagerFontTestExternal125, TestDsf125) {
1442 ASSERT_EQ(1.25f,
1443 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1444 EXPECT_FALSE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
1445 }
1446
1447 TEST_F(DisplayManagerFontTestExternal200, TestDsf200) {
1448 ASSERT_EQ(2.0f,
1449 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1450 EXPECT_FALSE(gfx::test::GetBrowserTextSubpixelPoisitioningEnabled());
1451 }
1452
1453 #endif // OS_CHROMEOS
1454
1384 } // namespace ash 1455 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698