diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-15 18:40:01 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-15 18:40:01 +1100 |
commit | 21af07a8bb152adfebf7dfea83ac7e698e37cb4b (patch) | |
tree | 48923b18e44f383570e1eed94ee5a21017f73078 /vcl/qa | |
parent | 9a790ca414ccc7f330e20af7ad76fe16cc0259b1 (diff) |
vcl: forgot to add the unit test file...
Change-Id: Ifd598baaad1c70d0f1b7bd776c94b08520e5dca4
Diffstat (limited to 'vcl/qa')
-rw-r--r-- | vcl/qa/cppunit/font.cxx | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx new file mode 100644 index 000000000000..0e70ee329369 --- /dev/null +++ b/vcl/qa/cppunit/font.cxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <test/bootstrapfixture.hxx> +#include <cppunit/TestAssert.h> +#include <cppunit/TestFixture.h> + +#include <osl/file.hxx> +#include <osl/process.h> + +#include <vcl/font.hxx> + +class VclFontTest : public test::BootstrapFixture +{ +public: + VclFontTest() : BootstrapFixture(true, false) {} + + void testSymbolFlagAndCharSet(); + + CPPUNIT_TEST_SUITE(VclFontTest); + CPPUNIT_TEST(testSymbolFlagAndCharSet); + CPPUNIT_TEST_SUITE_END(); +}; + +void VclFontTest::testSymbolFlagAndCharSet() +{ + // default constructor should set scalable flag to false + vcl::Font aFont; + + CPPUNIT_ASSERT_MESSAGE( "Should not be seen as a symbol font after default constructor called", !aFont.IsSymbolFont() ); + CPPUNIT_ASSERT_MESSAGE( "Character set should be RTL_TEXTENCODING_DONTKNOW after default constructor called", + aFont.GetCharSet() == RTL_TEXTENCODING_DONTKNOW ); + + aFont.SetSymbolFlag(true); + + CPPUNIT_ASSERT_MESSAGE( "Test 1: Symbol font flag should be on", aFont.IsSymbolFont() ); + CPPUNIT_ASSERT_MESSAGE( "Test 1: Character set should be RTL_TEXTENCODING_SYMBOL", + aFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL ); + + aFont.SetSymbolFlag(false); + + CPPUNIT_ASSERT_MESSAGE( "Test 2: Symbol font flag should be off", !aFont.IsSymbolFont() ); + CPPUNIT_ASSERT_MESSAGE( "Test 2: Character set should be RTL_TEXTENCODING_DONTKNOW", + aFont.GetCharSet() == RTL_TEXTENCODING_DONTKNOW ); + + aFont.SetCharSet( RTL_TEXTENCODING_SYMBOL ); + + CPPUNIT_ASSERT_MESSAGE( "Test 3: Symbol font flag should be on", aFont.IsSymbolFont() ); + CPPUNIT_ASSERT_MESSAGE( "Test 3: Character set should be RTL_TEXTENCODING_SYMBOL", + aFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL ); + + aFont.SetCharSet( RTL_TEXTENCODING_UNICODE ); + + CPPUNIT_ASSERT_MESSAGE( "Test 4: Symbol font flag should be off", !aFont.IsSymbolFont() ); + CPPUNIT_ASSERT_MESSAGE( "Test 4: Character set should be RTL_TEXTENCODING_UNICODE", + aFont.GetCharSet() == RTL_TEXTENCODING_UNICODE ); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(VclFontTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |