[dia: 63/105] #19: Port "exports" test.



commit f5386845fb5b111d02c8fe7d60027af6f6131526
Author: Eduard Nicodei <eddnicodei gmail com>
Date:   Fri Jan 4 19:39:20 2019 +0000

    #19: Port "exports" test.
    
      - Note that currently it fails.  This is not a problem ATM since
        it also fails when using autotools.

 tests/exports/exports_test.sh | 32 ++++++++++++++++++++++++++++++++
 tests/exports/meson.build     | 11 +++++++++++
 tests/meson.build             |  3 +++
 3 files changed, 46 insertions(+)
---
diff --git a/tests/exports/exports_test.sh b/tests/exports/exports_test.sh
new file mode 100755
index 00000000..de7f269e
--- /dev/null
+++ b/tests/exports/exports_test.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env sh
+
+EXPORT_PLUGINS="cgm dxf eps eps-builtin eps-pango fig mp plt hpgl png png-libart pixbuf-png jpg shape svg 
tex wpg"
+
+RUN_DIA=$1
+
+if [ ! -f "$RUN_DIA" ]; then
+    echo Please specify run_dia.sh path.
+    exit 1
+fi
+
+FAILED=0
+TEMP_DIR=$(mktemp -d)
+for FILTER in ${EXPORT_PLUGINS}; do
+       for FILE in *.dia; do
+        DIA_BASENAME=$(basename "${FILE}" .dia)
+               OUTPUT=${TEMP_DIR}/${DIA_BASENAME}.${FILTER}
+               EXPECTED_OUTPUT=${FILTER}/${DIA_BASENAME}.${FILTER}
+               if ! ${RUN_DIA} -t ${FILTER} -e ${OUTPUT} ${FILE}; then
+                       echo ${FILTER} failed for ${FILE};
+            exit 1
+               elif ! diff -q ${OUTPUT} ${EXPECTED_OUTPUT}; then
+                       echo "FAILED: ${FILTER} output different from expected for ${FILE}" 
+            #TODO: currently this fails almost all testcases.  Why?
+            FAILED=1
+               fi;
+       done;
+done
+
+rm -r ${TEMP_DIR}
+
+exit ${FAILED}
diff --git a/tests/exports/meson.build b/tests/exports/meson.build
new file mode 100644
index 00000000..8dadf0ed
--- /dev/null
+++ b/tests/exports/meson.build
@@ -0,0 +1,11 @@
+exports_test = find_program('exports_test.sh')
+
+test('exports',
+    exports_test,
+    args: [run_dia.path()],
+    workdir: meson.current_source_dir(),
+    env: [
+        'MESON_BUILD_ROOT=' + meson.build_root(),
+        'MESON_SOURCE_ROOT=' + meson.source_root(),
+    ],
+)
diff --git a/tests/meson.build b/tests/meson.build
index 776c779c..22ce41e0 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -20,6 +20,7 @@ if host_machine.system() != 'windows'
       include_directories: [configuration_inc, libdia_inc],
   )
 endif
+
 tsvg = executable(
     'testsvg',
     'test-svg.c',
@@ -64,3 +65,5 @@ test('xmllint',
 )
 
 test('testsvg', tsvg)
+
+subdir('exports')


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