Chromium Code Reviews| Index: ui/base/l10n/l10n_util_win_unittest.cc |
| diff --git a/ui/base/l10n/l10n_util_win_unittest.cc b/ui/base/l10n/l10n_util_win_unittest.cc |
| index 2f1da59247164f7734cf15ee4d6661993991e6ac..efa8b62b40e0f20f621661b8aecae17cd332d5ce 100644 |
| --- a/ui/base/l10n/l10n_util_win_unittest.cc |
| +++ b/ui/base/l10n/l10n_util_win_unittest.cc |
| @@ -6,9 +6,13 @@ |
| #include <windows.h> |
| +#include "base/command_line.h" |
| #include "base/win/win_util.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| #include "testing/platform_test.h" |
| +#include "ui/display/display.h" |
| +#include "ui/display/display_switches.h" |
| +#include "ui/display/win/dpi.h" |
| typedef PlatformTest L10nUtilWinTest; |
| @@ -34,3 +38,19 @@ TEST_F(L10nUtilWinTest, TestDPIScaling) { |
| l10n_util::AdjustUIFontForDIP(1.8f, &lf); |
| EXPECT_NEAR(size, lf.lfHeight, 1); |
| } |
| + |
| +// Test for crbug.com/675933. Since font size is a Windows metric we need to |
| +// normalize to DIPs based on the real device scale factor, not the forced one. |
| +TEST_F(L10nUtilWinTest, TestForcedScaling) { |
| + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| + switches::kForceDeviceScaleFactor, "4"); |
| + display::Display::ResetForceDeviceScaleFactorForTesting(); |
| + |
| + NONCLIENTMETRICS_XP metrics; |
| + base::win::GetNonClientMetrics(&metrics); |
| + LOGFONT lf = metrics.lfMessageFont; |
| + |
| + lf.lfHeight = 18; |
|
robliao
2017/02/15 18:43:15
Document where 18 originated (even if it's arbitra
Bret
2017/02/15 20:43:16
Done.
|
| + l10n_util::AdjustUIFont(&lf); |
| + EXPECT_EQ(18 / display::win::GetUnforcedDeviceScaleFactor(), lf.lfHeight); |
| +} |