1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #include "basictest.hxx"
14 class EnableTest
: public test::BootstrapFixture
17 EnableTest() : BootstrapFixture(true, false) {};
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"
37 "Enable = Enable + 2\n"
38 "doUnitTest = Enable\n"
42 OUString
sTestDimEnable(
44 "Dim Enable as String\n"
48 void EnableTest::testEnableRuntime()
50 MacroSnippet
myMacro(sTestEnableRuntime
);
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
);
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\""
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: */