summaryrefslogtreecommitdiffstats
path: root/debian/jstest/run-tests
blob: 1310ebfabf783db6d4c0a3439ceb83353d451ffa (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
#!/usr/bin/python3

import os
import sys

import jstest

from PyQt6.QtWidgets import QApplication

class t1:
    search_term = 'example'
    n_results = 93
    n_links = 93
    n_highlights = 109

class t2:
    search_term = 'examples'
    n_results = 84
    n_links = 84
    n_highlights = 22

class t3:
    search_term = 'graph'
    n_results = 33
    n_links = 33
    n_highlights = 125

if __name__ == '__main__':
    if not os.getenv('DISPLAY'):
        raise RuntimeError('These tests require access to an X server')
    app = QApplication(sys.argv)
    [build_directory] = sys.argv[1:]
    build_directory = os.path.abspath(build_directory)
    n_failures = 0
    for testcase in t1, t2, t3:
        failures = jstest.test_directory(build_directory, testcase).failures
        n_failures += len(failures)
    sys.exit(n_failures > 0)

# vim:ts=4 sw=4 et