diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2017-09-22 04:36:33 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2017-09-22 04:36:33 +0200 |
| commit | 9827be183c04917fc0908733a0c7dfab8d905dd0 (patch) | |
| tree | 2b481e50a79ebd4ffe82510c4f1eaf5b9649bcd9 /tests | |
| parent | 9be8ff33679ff128d43eb76d2f3ca9651e85be4a (diff) | |
EMConverter: remove unneeded font size management
(bzr r4253.4.1)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_em_converter.cpp | 26 | ||||
| -rw-r--r-- | tests/test_raw_pixel.cpp | 3 |
2 files changed, 8 insertions, 21 deletions
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) { |
