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

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
1388 #if defined(OS_CHROMEOS)
1389 template <const char* VALUE, bool INTERNAL>
Daniel Erat 2014/08/20 20:14:42 i thought that there's a general push to avoid tem
oshima 2014/08/20 21:54:40 okay, uploaded new patch. I hope you like it this
1390 class DisplayManagerFontTest : public test::AshTestBase {
1391 public:
1392 DisplayManagerFontTest() {}
1393 virtual ~DisplayManagerFontTest() {}
1394
1395 virtual void SetUp() OVERRIDE {
1396 gfx::ClearFontRenderParamsCacheForTest();
1397 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
1398 if (INTERNAL)
1399 command_line->AppendSwitch(switches::kAshUseFirstDisplayAsInternal);
1400 command_line->AppendSwitchASCII(switches::kAshHostWindowBounds, VALUE);
1401 test::AshTestBase::SetUp();
1402 }
1403
1404 private:
1405 DISALLOW_COPY_AND_ASSIGN(DisplayManagerFontTest);
1406 };
1407
1408 const char DSF100[] = "1000x800*1.00";
1409 const char DSF125[] = "1000x800*1.25";
1410 const char DSF200[] = "1000x800*2.00";
1411 typedef DisplayManagerFontTest<DSF100, true> DisplayManagerFontTestInternal100;
1412 typedef DisplayManagerFontTest<DSF125, true> DisplayManagerFontTestInternal125;
1413 typedef DisplayManagerFontTest<DSF200, true> DisplayManagerFontTestInternal200;
1414
1415 bool IsTextSubpixelPositioningEnabled() {
1416 gfx::FontRenderParams params =
1417 gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(false), NULL);
1418 return params.subpixel_positioning;
1419 }
1420
1421 TEST_F(DisplayManagerFontTestInternal100, TestDsf100) {
1422 ASSERT_DOUBLE_EQ(1.0f,
1423 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1424 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
1425 }
1426
1427 TEST_F(DisplayManagerFontTestInternal125, TestDsf125) {
1428 ASSERT_DOUBLE_EQ(1.25f,
1429 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1430 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
1431 }
1432
1433 TEST_F(DisplayManagerFontTestInternal200, TestDsf200) {
1434 ASSERT_DOUBLE_EQ(2.0f,
1435 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1436 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
1437 }
1438
1439 typedef DisplayManagerFontTest<DSF100, false> DisplayManagerFontTestExternal100;
1440 typedef DisplayManagerFontTest<DSF125, false> DisplayManagerFontTestExternal125;
1441 typedef DisplayManagerFontTest<DSF200, false> DisplayManagerFontTestExternal200;
1442
1443 TEST_F(DisplayManagerFontTestExternal100, TestDsf100) {
1444 ASSERT_DOUBLE_EQ(1.0f,
1445 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1446 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
1447 }
1448
1449 TEST_F(DisplayManagerFontTestExternal125, TestDsf125) {
1450 ASSERT_DOUBLE_EQ(1.25f,
1451 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1452 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
1453 }
1454
1455 TEST_F(DisplayManagerFontTestExternal200, TestDsf200) {
1456 ASSERT_DOUBLE_EQ(2.0f,
1457 Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1458 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
1459 }
1460
1461 #endif // OS_CHROMEOS
1462
1384 } // namespace ash 1463 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698