From 9d1db290b6c81afc6fad7ce49523be5d8e7c6dc5 Mon Sep 17 00:00:00 2001
From: Tor Lillqvist <tml@collabora.com>
Date: Wed, 22 Jul 2020 10:29:40 +0300
Subject: tdf#134832: Also run the BitmapTest from vcl

Required some fiddling with the SolarMutex.

Sadly running BitMapTest did not help finding the root cause for the
bug.

If you build and run UnitTest in a tree with --enable-dbgutil, you
need to manually add DBG_UTIL=1 to the preprocessor macros the
UnitTest Xcode project.

Change-Id: I92abb6db596868c112996a93d51cc37fb6ab6541
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99184
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
---
 ios/UnitTest/UnitTest.xcodeproj/project.pbxproj |  4 +++
 ios/UnitTest/UnitTest/ViewController.mm         | 38 +++++++++++++++++--------
 2 files changed, 30 insertions(+), 12 deletions(-)

(limited to 'ios')

diff --git a/ios/UnitTest/UnitTest.xcodeproj/project.pbxproj b/ios/UnitTest/UnitTest.xcodeproj/project.pbxproj
index aac3fafad016..a924640b500a 100644
--- a/ios/UnitTest/UnitTest.xcodeproj/project.pbxproj
+++ b/ios/UnitTest/UnitTest.xcodeproj/project.pbxproj
@@ -709,6 +709,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CLANG_CXX_LANGUAGE_STANDARD = "c++17";
 				CODE_SIGN_STYLE = Automatic;
 				DEVELOPMENT_TEAM = J4FQ687VJK;
 				ENABLE_BITCODE = NO;
@@ -721,6 +722,7 @@
 				);
 				HEADER_SEARCH_PATHS = (
 					../../include,
+					../../vcl/inc,
 					../../config_host,
 					../../workdir/UnoApiHeadersTarget/udkapi/comprehensive,
 					../../workdir/UnoApiHeadersTarget/offapi/comprehensive,
@@ -747,6 +749,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CLANG_CXX_LANGUAGE_STANDARD = "c++17";
 				CODE_SIGN_STYLE = Automatic;
 				DEVELOPMENT_TEAM = J4FQ687VJK;
 				ENABLE_BITCODE = NO;
@@ -757,6 +760,7 @@
 				);
 				HEADER_SEARCH_PATHS = (
 					../../include,
+					../../vcl/inc,
 					../../config_host,
 					../../workdir/UnoApiHeadersTarget/udkapi/comprehensive,
 					../../workdir/UnoApiHeadersTarget/offapi/comprehensive,
diff --git a/ios/UnitTest/UnitTest/ViewController.mm b/ios/UnitTest/UnitTest/ViewController.mm
index fa002f107f27..bcdfc492a016 100644
--- a/ios/UnitTest/UnitTest/ViewController.mm
+++ b/ios/UnitTest/UnitTest/ViewController.mm
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -15,6 +15,8 @@
 #include <cppuhelper/exc_hlp.hxx>
 #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
 #include <com/sun/star/uno/Any.hxx>
+#include <sfx2/app.hxx>
+#include <vcl/svapp.hxx>
 
 #include <cppunit/CompilerOutputter.h>
 #include <cppunit/TestResult.h>
@@ -44,6 +46,10 @@ extern "C" {
 #define CPPUNIT_PLUGIN_EXPORTED_NAME CppuUnourl
 #include "../../../cppuhelper/qa/unourl/cppu_unourl.cxx"
 
+#undef CPPUNIT_PLUGIN_EXPORTED_NAME
+#define CPPUNIT_PLUGIN_EXPORTED_NAME BitmapTest
+#include "../../../vcl/qa/cppunit/BitmapTest.cxx"
+
 #define main tilebench_main
 #include "../../../libreofficekit/qa/tilebench/tilebench.cxx"
 
@@ -52,22 +58,30 @@ extern "C" {
 - (void)viewDidLoad {
     [super viewDidLoad];
 
-    // First run some normal cppunit tests
+    // Simplest (?) way to do all the tedious initialization
+    lok_init_2(nullptr, nullptr);
+
+    {
+        // First run some normal cppunit tests. Seems that at least the BitmapTest needs to be run
+        // with the SolarMutex held.
+
+        SolarMutexGuard solarMutexGuard;
 
-    CppUnit::TestResult result;
+        CppUnit::TestResult result;
 
-    CppUnit::TextTestProgressListener logger;
-    result.addListener(&logger);
+        CppUnit::TextTestProgressListener logger;
+        result.addListener(&logger);
 
-    CppUnit::TestResultCollector collector;
-    result.addListener(&collector);
+        CppUnit::TestResultCollector collector;
+        result.addListener(&collector);
 
-    CppUnit::TestRunner runner;
-    runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
-    runner.run(result);
+        CppUnit::TestRunner runner;
+        runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
+        runner.run(result);
 
-    CppUnit::CompilerOutputter outputter(&collector, std::cerr);
-    outputter.write();
+        CppUnit::CompilerOutputter outputter(&collector, std::cerr);
+        outputter.write();
+    }
 
     // Then some more specific stuff
     tilebench_main(0, nullptr);
-- 
cgit