diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/data/external.gschema.xml | 13 | ||||
| -rw-r--r-- | tests/test_em_converter.cpp | 26 | ||||
| -rw-r--r-- | tests/test_raw_pixel.cpp | 3 |
3 files changed, 21 insertions, 21 deletions
diff --git a/tests/data/external.gschema.xml b/tests/data/external.gschema.xml index 6d498e2a0..9b7c1a2d0 100644 --- a/tests/data/external.gschema.xml +++ b/tests/data/external.gschema.xml @@ -74,6 +74,19 @@ </key> </schema> + <schema path="/com/ubuntu/user-interface/desktop/" id="com.ubuntu.user-interface.desktop"> + <key type="u" name="scaling-factor"> + <default>0</default> + </key> + <key type="d" name="text-scaling-factor"> + <range min="0.5" max="3.0"/> + <default>1.0</default> + </key> + <key type="i" name="cursor-size"> + <default>24</default> + </key> + </schema> + <schema id="com.canonical.unity-greeter" path="/com/canonical/unity-greeter/"> <key type="s" name="logo"> <default>'/usr/share/unity-greeter/logo.png'</default> diff --git a/tests/test_em_converter.cpp b/tests/test_em_converter.cpp index 3936c08bc..44239263e 100644 --- a/tests/test_em_converter.cpp +++ b/tests/test_em_converter.cpp @@ -26,34 +26,19 @@ namespace unity { int const PIXEL_SIZE = 24; -int const FONT_SIZE = 13; double const DPI = 96.0; class TestEMConverter : public Test { public: TestEMConverter() - : em_converter(FONT_SIZE, DPI) + : em_converter(DPI) { } EMConverter em_converter; }; -TEST_F(TestEMConverter, TestCtor) -{ - EXPECT_EQ(FONT_SIZE, em_converter.GetFontSize()); - EXPECT_EQ(DPI, em_converter.GetDPI()); -} - -TEST_F(TestEMConverter, TestSetFontSize) -{ - int const font_size = 15; - - em_converter.SetFontSize(font_size); - EXPECT_EQ(font_size, em_converter.GetFontSize()); -} - TEST_F(TestEMConverter, TestSetDPI) { int const dpi = 120.0; @@ -79,10 +64,13 @@ TEST_F(TestEMConverter, TestDPIScale2) EXPECT_FLOAT_EQ(em_converter.DPIScale(), 2.0); } -TEST_F(TestEMConverter, TestPtToPx) +TEST_F(TestEMConverter, TestConvertPixelScaled) { - int pt = 12; - EXPECT_EQ(em_converter.PtToPx(pt), 16); + for (double scale : std::vector<double>({1.0, 1.25, 1.5, 1.75, 2})) + { + em_converter.SetDPI(DPI * scale); + EXPECT_EQ(std::round(PIXEL_SIZE * scale), em_converter.CP(PIXEL_SIZE)); + } } } // namespace unity diff --git a/tests/test_raw_pixel.cpp b/tests/test_raw_pixel.cpp index 140bf6010..c7cc9eef5 100644 --- a/tests/test_raw_pixel.cpp +++ b/tests/test_raw_pixel.cpp @@ -25,14 +25,13 @@ using namespace testing; namespace unity { -int const FONT_SIZE = 13; double const DPI = 96.0; class TestRawPixel : public Test { public: TestRawPixel() - : cv(std::make_shared<EMConverter>(FONT_SIZE, DPI)) + : cv(std::make_shared<EMConverter>(DPI)) , p_i(10_em) , p_f(10.0_em) { |
