summaryrefslogtreecommitdiff
path: root/tests/meson.build
blob: a4df3bc0eb2c3d6c5016403184d4a7215de42ddf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
test_cflags = [
  '-DSRCDIR=@0@'.format(meson.current_source_dir()),
]

if xft_dep.found()
  test_cflags += [ '-DHAVE_X', '-DHAVE_XFT' ]
endif

if host_system == 'windows'
  test_cflags += '-DHAVE_WIN32'
endif

test_env = [
  'srcdir=@0@'.format(meson.current_source_dir()),
  'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
  'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
]

tests = [
  [ 'testboundaries' ],
  [ 'testboundaries_ucd' ],
  [ 'testcolor' ],
  [ 'testscript' ],
  [ 'cxx-test', [ 'cxx-test.cpp' ] ],
]

if freetype_dep.found()
  test_cflags += '-DHAVE_FREETYPE'
  tests += [
    [ 'test-ot-tags', [ 'test-ot-tags.c' ], [ libpangoft2_dep ] ],
  ]
endif

if cairo_dep.found()
  test_cflags += '-DHAVE_CAIRO'
  tests += [
    [ 'testiter', [ 'testiter.c' ], [ libpangocairo_dep ] ],
    [ 'test-pangocairo-threads', [ 'test-pangocairo-threads.c' ], [ libpangocairo_dep, cairo_dep ] ],
    [ 'markup-parse', [ 'markup-parse.c' ], [ libpangocairo_dep ] ],
    [ 'test-layout', [ 'test-layout.c', 'test-common.c' ], [ libpangocairo_dep ] ],
    [ 'test-font', [ 'test-font.c' ], [ libpangocairo_dep ] ],
    [ 'testattributes', [ 'testattributes.c', 'test-common.c' ], [ libpangocairo_dep ] ],
  ]
endif

installed_test_data = [
  'boundaries.utf8',
  'GraphemeBreakTest.txt',
]

test_layouts_data = [
  'layouts/valid-1',
  'layouts/valid-2',
]

test_markups_data = [
  'markups/fail-1',
  'markups/fail-2',
  'markups/fail-3',
  'markups/fail-4',
  'markups/fail-5',
  'markups/valid-1',
  'markups/valid-2',
  'markups/valid-3',
  'markups/valid-4',
  'markups/valid-5',
  'markups/valid-6',
  'markups/valid-7',
  'markups/valid-8',
  'markups/valid-9',
]

installed_test_layouts_data = []
foreach d: test_layouts_data
  installed_test_layouts_data += d + '.markup'
  installed_test_layouts_data += d + '.expected'
endforeach

installed_test_markups_data = []
foreach d: test_markups_data
  installed_test_markups_data += d + '.markup'
  installed_test_markups_data += d + '.expected'
endforeach

installed_test_datadir = join_paths(pango_datadir, 'installed-tests', 'pango')
installed_test_bindir = join_paths(pango_libexecdir, 'installed-tests', 'pango')

install_data(installed_test_data, install_dir: installed_test_bindir)
install_data(installed_test_layouts_data, install_dir: join_paths(installed_test_bindir, 'layouts'))
install_data(installed_test_markups_data, install_dir: join_paths(installed_test_bindir, 'markups'))

python = import('python3').find_python()
gen_installed_test = files([ 'gen-installed-test.py' ])
gen_all_unicode = files([ 'gen-all-unicode.py' ])

custom_target('all-unicode',
              output: 'all-unicode.txt',
              command: [
                python, gen_all_unicode, '@OUTPUT@'
              ],
              install: true,
              install_dir: installed_test_bindir)

foreach t: tests
  name = t[0]
  src = t.get(1, [ '@0@.c'.format(name) ])
  deps = t.get(2, [ libpango_dep ])

  custom_target(name + '.test',
                output: name + '.test',
                command: [
                  python, gen_installed_test,
                  installed_test_bindir,
                  name,
                  '@OUTDIR@',
                ],
                install: true,
                install_dir: installed_test_datadir)

  bin = executable(name, src,
                   dependencies: deps,
                   include_directories: root_inc,
                   c_args: common_cflags + pango_debug_cflags + test_cflags,
                   cpp_args: common_cppflags + pango_debug_cflags + test_cflags,
                   install: true,
                   install_dir: installed_test_bindir)

  test(name, bin, env: test_env)
endforeach