config_host/config_test.h.in             |   10 ++++++
 configure.ac                             |   47 +++++++++++++++++++++++++++++++
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |    4 ++
 3 files changed, 61 insertions(+)

New commits:
commit c4ffca21ff7c020c7df2c6de7cbd16fc20cac989
Author: Jan-Marek Glogowski <glo...@fbihome.de>
Date:   Wed Jan 22 15:43:40 2014 +0000

    Depend unit test on existing font.
    
    Commit 734cf8395 introduced a unit test, which depends on a Calibri
    metric-compatible font. So this adds a fonctconfig based check to
    configure and just runs this test, if configure finds a correctly
    mapped font.
    
    Reviewed on:
        https://gerrit.libreoffice.org/7596
    
    Change-Id: I5255a4366684b115d88adca78ab2002864b63766

diff --git a/config_host/config_test.h.in b/config_host/config_test.h.in
new file mode 100644
index 0000000..c310350b
--- /dev/null
+++ b/config_host/config_test.h.in
@@ -0,0 +1,10 @@
+/*
+Settings for test suite dependencies.
+*/
+
+#ifndef CONFIG_TEST_H
+#define CONFIG_TEST_H
+
+#define TEST_FONTS_MISSING 0
+
+#endif
diff --git a/configure.ac b/configure.ac
index a6f5b42..04547a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11520,6 +11520,31 @@ AC_SUBST(SUNTEMPLATES_FR_PACK)
 AC_SUBST(SUNTEMPLATES_HU_PACK)
 AC_SUBST(SUNTEMPLATES_IT_PACK)
 
+TEST_FONTS_MISSING=0
+
+# $1  = font family
+# $2+ = accepted font mappings
+test_font_map()
+{
+    FONT=$1 ; shift
+    AC_MSG_CHECKING([Checking font mapping for '$FONT'])
+    FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
+
+    TESTEXPR="'${FONTFILE}' = '$1.ttf'"
+    while true ; do
+        MAPPING="$1" ; shift
+        test -n "$MAPPING" || break
+        TESTEXPR="${TESTEXPR} -o '$FONTFILE' = '$MAPPING-Regular.ttf'"
+    done
+    if test $TESTEXPR
+    then
+        AC_MSG_RESULT([ok])
+    else
+        AC_MSG_RESULT([unknown ($FONTFILE)])
+        TEST_FONTS_MISSING=1
+    fi
+}
+
 dnl ===================================================================
 dnl Test whether to include fonts
 dnl ===================================================================
@@ -11532,8 +11557,29 @@ else
     AC_MSG_RESULT([no])
     WITH_FONTS=NO
     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
+    if test "$test_fontconfig" = "yes"; then
+        AC_PATH_PROG([FCMATCH], [fc-match])
+        if test -z "$FCMATCH"; then
+            AC_MSG_WARN([Unable to query installed fonts - unit tests 
disabled.])
+            TEST_FONTS_MISSING=1
+        else
+#            test_font_map 'Arial' 'LiberationSans'
+#            test_font_map 'Arial Narrow' 'LiberationSansNarrow'
+            test_font_map 'Calibri' 'Carlito'
+#            test_font_map 'Cambria' 'Caladea'
+#            test_font_map 'Courier New' 'LiberationMono'
+#            test_font_map 'Times New Roman' 'LiberationSerif'
+            if test ${TEST_FONTS_MISSING} -eq 1
+            then
+                AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
+            fi
+        fi
+    else
+        TEST_FONTS_MISSING=0
+    fi
 fi
 AC_SUBST(WITH_FONTS)
+AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
 
 dnl ===================================================================
 dnl Test whether to include ppds
@@ -12762,6 +12808,7 @@ AC_CONFIG_HEADERS([config_host/config_orcus.h])
 AC_CONFIG_HEADERS([config_host/config_kde4.h])
 AC_CONFIG_HEADERS([config_host/config_mingw.h])
 AC_CONFIG_HEADERS([config_host/config_oox.h])
+AC_CONFIG_HEADERS([config_host/config_test.h])
 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index ac5c8c65..4dabefe 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -6,6 +6,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include "config_test.h"
+
 #include <swmodeltestbase.hxx>
 
 #if !defined(WNT)
@@ -972,9 +974,11 @@ DECLARE_OOXMLIMPORT_TEST(testGroupshapeChildRotation, 
"groupshape-child-rotation
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getPosition().X);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getPosition().Y);
 
+#if ! TEST_FONTS_MISSING
     xShape.set(xGroupShape->getByIndex(4), uno::UNO_QUERY);
     // This was 887, i.e. border distances were included in the height.
     CPPUNIT_ASSERT_EQUAL(sal_Int32(686), xShape->getSize().Height);
+#endif
 
     uno::Reference<drawing::XShapeDescriptor> 
xShapeDescriptor(xGroupShape->getByIndex(5), uno::UNO_QUERY);
     // This was com.sun.star.drawing.RectangleShape, all shape text in a 
single line.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to