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

Unified Diff: ash/display/display_manager_unittest.cc

Issue 789583002: Updates subpixel positioning and hinting when DSF is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GN Created 6 years 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 7a0b0a2b2b955edc4c18fb30602c2c9324ea518a..3761223a311ca2f8424a49e1fe71247c7fa3fa60 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -1572,10 +1572,16 @@ class FontTestHelper : public test::AshTestBase {
bool IsTextSubpixelPositioningEnabled() {
gfx::FontRenderParams params =
- gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(false), NULL);
+ gfx::GetCurrentFontRenderParams(gfx::FontRenderParamsQuery(false), NULL);
return params.subpixel_positioning;
}
+gfx::FontRenderParams::Hinting GetFontHintingParams() {
+ gfx::FontRenderParams params =
+ gfx::GetCurrentFontRenderParams(gfx::FontRenderParamsQuery(false), NULL);
+ return params.hinting;
+}
+
} // namespace
typedef testing::Test DisplayManagerFontTest;
@@ -1585,6 +1591,7 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100Internal) {
ASSERT_DOUBLE_EQ(
1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
+ EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125Internal) {
@@ -1592,6 +1599,7 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125Internal) {
ASSERT_DOUBLE_EQ(
1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
+ EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) {
@@ -1599,6 +1607,15 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) {
ASSERT_DOUBLE_EQ(
2.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
+ EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
+
+ Shell::GetInstance()->display_manager()->SetDisplayUIScale(
+ Shell::GetScreen()->GetPrimaryDisplay().id(), 2.0f);
+
+ ASSERT_DOUBLE_EQ(
+ 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
+ EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100External) {
@@ -1606,6 +1623,7 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100External) {
ASSERT_DOUBLE_EQ(
1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
+ EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125External) {
@@ -1613,6 +1631,7 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125External) {
ASSERT_DOUBLE_EQ(
1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
+ EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200External) {
@@ -1620,6 +1639,7 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200External) {
ASSERT_DOUBLE_EQ(
2.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
+ EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
}
TEST_F(DisplayManagerFontTest,
@@ -1629,6 +1649,16 @@ TEST_F(DisplayManagerFontTest,
ASSERT_DOUBLE_EQ(
1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
+ EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
+
+ Shell::GetInstance()->display_manager()->SetDisplayUIScale(
+ Shell::GetScreen()->GetPrimaryDisplay().id(), 0.8f);
+
+ ASSERT_DOUBLE_EQ(
+ 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
+ EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
+ EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
+
DisplayInfo::SetUse125DSFForUIScaling(false);
}

Powered by Google App Engine
This is Rietveld 408576698