Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / basic / qa / cppunit / test_append.cxx
blobaa3280a4ad86d9dfa0b56daaaabb624f4fdc30b0
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 "basictest.hxx"
12 namespace
14 class EnableTest : public test::BootstrapFixture
16 public:
17 EnableTest() : BootstrapFixture(true, false) {};
18 void testDimEnable();
19 void testWin64();
20 void testEnableRuntime();
21 // Adds code needed to register the test suite
22 CPPUNIT_TEST_SUITE(EnableTest);
24 // Declares the method as a test to call
25 CPPUNIT_TEST(testDimEnable);
26 CPPUNIT_TEST(testWin64);
27 CPPUNIT_TEST(testEnableRuntime);
29 // End of test suite definition
30 CPPUNIT_TEST_SUITE_END();
33 OUString sTestEnableRuntime(
34 "Function doUnitTest as Integer\n"
35 "Dim Enable as Integer\n"
36 "Enable = 1\n"
37 "Enable = Enable + 2\n"
38 "doUnitTest = Enable\n"
39 "End Function\n"
42 OUString sTestDimEnable(
43 "Sub doUnitTest\n"
44 "Dim Enable as String\n"
45 "End Sub\n"
48 void EnableTest::testEnableRuntime()
50 MacroSnippet myMacro(sTestEnableRuntime);
51 myMacro.Compile();
52 CPPUNIT_ASSERT_MESSAGE("testEnableRuntime fails with compile error",!myMacro.HasError() );
53 SbxVariableRef pNew = myMacro.Run();
54 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(3), pNew->GetInteger());
57 void EnableTest::testDimEnable()
59 MacroSnippet myMacro(sTestDimEnable);
60 myMacro.Compile();
61 CPPUNIT_ASSERT_MESSAGE("Dim causes compile error", !myMacro.HasError() );
64 void EnableTest::testWin64()
66 MacroSnippet myMacro(" #If Win64\n"
67 "Declare PtrSafe Function aht_apiGetOpenFileName Lib \"comdlg32.dll\""
68 "\n"
69 "#End if\n");
70 myMacro.Compile();
71 CPPUNIT_ASSERT_MESSAGE("#if Win64 Declare PtrSafe causes compile error", !myMacro.HasError() );
74 // Put the test suite in the registry
75 CPPUNIT_TEST_SUITE_REGISTRATION(EnableTest);
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */