From d1a49df6833ff16f5cbaf98534eaae62693e520b Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Thu, 28 Jan 2016 16:31:30 +1100 Subject: vcl: add text alignment functions to ImplFont and FontAttributes ImplFont and FontAttributes now have GetAlignment and SetAlignment, and I have renamed Font::GetAlign to Font::GetAlignment, and Font::SetAlign to Font::SetAlignment. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit test added to vcl/qa/cppunit/font.cxx to test text alignment. Change-Id: I6272c84fc9416c90616d957d1897eba9469fe7ba Reviewed-on: https://gerrit.libreoffice.org/21876 Tested-by: Jenkins Reviewed-by: Chris Sherlock --- vcl/qa/cppunit/font.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'vcl/qa') diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx index 5a8ad8384523..d496ebe418d3 100644 --- a/vcl/qa/cppunit/font.cxx +++ b/vcl/qa/cppunit/font.cxx @@ -26,6 +26,7 @@ public: void testWidthType(); void testPitch(); void testItalic(); + void testAlignment(); void testQuality(); void testBuiltInFontFlag(); void testEmbeddableFontFlag(); @@ -39,6 +40,7 @@ public: CPPUNIT_TEST(testWidthType); CPPUNIT_TEST(testPitch); CPPUNIT_TEST(testItalic); + CPPUNIT_TEST(testAlignment); CPPUNIT_TEST(testQuality); CPPUNIT_TEST(testBuiltInFontFlag); CPPUNIT_TEST(testEmbeddableFontFlag); @@ -91,6 +93,18 @@ void VclFontTest::testItalic() CPPUNIT_ASSERT_EQUAL_MESSAGE( "Italic should be EXPANDED", FontItalic::ITALIC_NORMAL, aFont.GetItalic()); } + +void VclFontTest::testAlignment() +{ + vcl::Font aFont; + + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Text alignment should be ALIGN_TOP", TextAlign::ALIGN_TOP, aFont.GetAlignment()); + + aFont.SetAlignment(TextAlign::ALIGN_BASELINE); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Text alignment should be ALIGN_BASELINE", TextAlign::ALIGN_BASELINE, aFont.GetAlignment()); +} + + void VclFontTest::testPitch() { vcl::Font aFont; -- cgit