Kaydet (Commit) c4ffca21 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski Kaydeden (comit) Miklos Vajna

Depend unit test on existing font.

Commit 734cf839 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
üst 38e26f75
/*
Settings for test suite dependencies.
*/
#ifndef CONFIG_TEST_H
#define CONFIG_TEST_H
#define TEST_FONTS_MISSING 0
#endif
......@@ -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])
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment