diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2014-01-22 15:43:40 +0000 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-23 18:13:04 +0100 |
commit | c4ffca21ff7c020c7df2c6de7cbd16fc20cac989 (patch) | |
tree | d3b0c8933d27e7aa76a2bc12ed3add15de2782f0 | |
parent | 38e26f75854e299333a731343ba9d81bfb45272f (diff) |
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
-rw-r--r-- | config_host/config_test.h.in | 10 | ||||
-rw-r--r-- | configure.ac | 47 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 4 |
3 files changed, 61 insertions, 0 deletions
diff --git a/config_host/config_test.h.in b/config_host/config_test.h.in new file mode 100644 index 000000000000..c310350bb494 --- /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 a6f5b42d86dd..04547a71d94d 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 ac5c8c65bf62..4dabefed6acf 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. |