From 56d44e10dfc54bd9296fb0cdfe5b0772022be0b4 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Tue, 21 Feb 2017 21:28:58 +0300 Subject: VBA: unit test for PtrSafe and compiler directives #If Vba7 Declare PtrSafe Function xx #Else Declare Function xx #End if Change-Id: I807efb9fa68b5ac50f2bd59ba7cfa45c499af189 Reviewed-on: https://gerrit.libreoffice.org/34522 Reviewed-by: Justin Luth Tested-by: Justin Luth Reviewed-by: Markus Mohrhard --- basic/qa/cppunit/test_append.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'basic') diff --git a/basic/qa/cppunit/test_append.cxx b/basic/qa/cppunit/test_append.cxx index 986c94119fd7..1bda71d37287 100644 --- a/basic/qa/cppunit/test_append.cxx +++ b/basic/qa/cppunit/test_append.cxx @@ -20,12 +20,14 @@ namespace public: EnableTest() : BootstrapFixture(true, false) {}; void testDimEnable(); + void testWin64(); void testEnableRuntime(); // Adds code needed to register the test suite CPPUNIT_TEST_SUITE(EnableTest); // Declares the method as a test to call CPPUNIT_TEST(testDimEnable); + CPPUNIT_TEST(testWin64); CPPUNIT_TEST(testEnableRuntime); // End of test suite definition @@ -63,6 +65,21 @@ void EnableTest::testDimEnable() CPPUNIT_ASSERT_MESSAGE("Dim causes compile error", !myMacro.HasError() ); } +void EnableTest::testWin64() +{ + OUStringBuffer aSource1(" #If Win64\n"); + aSource1.append("Declare PtrSafe Function aht_apiGetOpenFileName Lib "); + aSource1.append('"'); + aSource1.append("comdlg32.dll"); + aSource1.append('"'); + aSource1.append("\n"); + aSource1.append("#End if\n"); + + MacroSnippet myMacro(aSource1.toString()); + myMacro.Compile(); + CPPUNIT_ASSERT_MESSAGE("#if Win64 Declare PtrSafe causes compile error", !myMacro.HasError() ); +} + // Put the test suite in the registry CPPUNIT_TEST_SUITE_REGISTRATION(EnableTest); } -- cgit