calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / vcl / qa / cppunit / app / test_IconThemeScanner.cxx
blobd02fe752ce517de9375b23d14d0c5c4cdc4b3409
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <stdexcept>
12 #include <rtl/ustring.hxx>
13 #include <IconThemeScanner.hxx>
14 #include <vcl/IconThemeInfo.hxx>
16 #include <cppunit/TestAssert.h>
17 #include <cppunit/TestFixture.h>
18 #include <cppunit/extensions/HelperMacros.h>
20 class IconThemeScannerTest : public CppUnit::TestFixture
22 void
23 AddedThemeIsFoundById();
25 void
26 AddedThemeInfoIsReturned();
28 void
29 ExceptionIsThrownIfInvalidInfoIsRequested();
31 // Adds code needed to register the test suite
32 CPPUNIT_TEST_SUITE(IconThemeScannerTest);
33 CPPUNIT_TEST(AddedThemeIsFoundById);
34 CPPUNIT_TEST(AddedThemeInfoIsReturned);
35 CPPUNIT_TEST(ExceptionIsThrownIfInvalidInfoIsRequested);
37 // End of test suite definition
38 CPPUNIT_TEST_SUITE_END();
41 void
42 IconThemeScannerTest::AddedThemeIsFoundById()
44 vcl::IconThemeScanner scanner;
45 scanner.AddIconThemeByPath("file:://images_katze.zip");
46 OUString id = vcl::IconThemeInfo::FileNameToThemeId(u"images_katze.zip");
47 bool found = scanner.IconThemeIsInstalled(id);
48 CPPUNIT_ASSERT_EQUAL_MESSAGE("icon theme could be added by url", true, found);
51 void
52 IconThemeScannerTest::AddedThemeInfoIsReturned()
54 vcl::IconThemeScanner scanner;
55 OUString theme("file:://images_katze.zip");
56 scanner.AddIconThemeByPath(theme);
57 OUString id = vcl::IconThemeInfo::FileNameToThemeId(u"images_katze.zip");
58 const vcl::IconThemeInfo& info = scanner.GetIconThemeInfo(id);
59 CPPUNIT_ASSERT_EQUAL_MESSAGE("'katze' icon theme is found from id", theme, info.GetUrlToFile());
62 void
63 IconThemeScannerTest::ExceptionIsThrownIfInvalidInfoIsRequested()
65 vcl::IconThemeScanner scanner;
66 scanner.AddIconThemeByPath("file:://images_katze.zip");
67 bool thrown = false;
68 try
70 scanner.GetIconThemeInfo("hund");
72 catch (const std::runtime_error&)
74 thrown = true;
76 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception is thrown if invalid theme info is requested", true, thrown);
79 // Put the test suite in the registry
80 CPPUNIT_TEST_SUITE_REGISTRATION(IconThemeScannerTest);
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */