[dia: 61/105] #19: Add xmllint_test.



commit dcc81d10f485347f7bd8b70d9d024a72d9af2a2f
Author: Eduard Nicodei <eddnicodei gmail com>
Date:   Fri Jan 4 18:59:28 2019 +0000

    #19: Add xmllint_test.
    
      - Also #def HAVE_CAIRO to avoid complaints regarding
        'Standard - Outline' object (which requires CAIRO).

 meson.build           |  4 +++-
 tests/meson.build     | 19 +++++++++++++++++++
 tests/xmllint_test.sh | 16 ++++++++++++++++
 3 files changed, 38 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index 360b4d4a..348e2e09 100644
--- a/meson.build
+++ b/meson.build
@@ -17,8 +17,10 @@ libxml_dep  = dependency('libxml-2.0', version : '>= 2.6.27')
 #TODO: what are the minimum versions?
 gmodule_dep = dependency('gmodule-2.0')
 libzlib_dep = dependency('zlib')
-#TODO: this is optional.  Should it be a disabler?
 libcairo_dep = dependency('cairo')
+#TODO: this will become a hard dependency as part of GTK3 port.
+# Therefore, remove all references to HAVE_CAIRO
+conf.set('HAVE_CAIRO', 1)
 libm_dep = cc.find_library('m')
 libc_dep = cc.find_library('c', required : false)
 
diff --git a/tests/meson.build b/tests/meson.build
index 025316a5..a7caa136 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -32,4 +32,23 @@ if host_machine.system() != 'windows'
   test('boundingbox', bb)
   test('objects', objs, args: [join_paths(meson.build_root(), 'objects')])
 endif
+
+xmllint_test = find_program('xmllint_test.sh')
+render_test_dia = files(join_paths('..', 'samples', 'render-test.dia'))[0]
+shape_dtd = files(join_paths('..', 'doc', 'shape.dtd'))[0]
+
+find_program('xmllint', required: true)
+test('xmllint',
+    xmllint_test,
+    args: [
+        run_dia.path(),
+        shape_dtd,
+        render_test_dia
+    ],
+    env: [
+        'MESON_BUILD_ROOT=' + meson.build_root(),
+        'MESON_SOURCE_ROOT=' + meson.source_root(),
+    ],
+)
+
 test('testsvg', tsvg)
diff --git a/tests/xmllint_test.sh b/tests/xmllint_test.sh
new file mode 100755
index 00000000..474ce533
--- /dev/null
+++ b/tests/xmllint_test.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env sh
+
+RUN_DIA=$1
+SHAPE_DTD=$2
+DIAGRAM=$3
+
+FAILED=0
+
+set -x
+
+# TODO: can we use mktemp instead of rt.shape?
+${RUN_DIA} ${DIAGRAM} --export=rt.shape || exit 1
+xmllint --dtdvalid ${SHAPE_DTD} rt.shape || exit 2
+rm -f rt.shape
+
+exit 0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]