forked from zeitkunst/quill_utils
-
Notifications
You must be signed in to change notification settings - Fork 12
/
test.py
executable file
·88 lines (69 loc) · 2.78 KB
/
test.py
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
#!/usr/bin/env python
import doctest
import sys
import os
sys.path.append('src')
def test_xournal_import():
from quill.importer.xournal import Xournal
infile = os.path.abspath('test/Example_Notebook.xoj')
import quill.importer.xournal
doctest.testmod(quill.importer.xournal, globs={'xournal_file': infile})
def test_converter():
infile = os.path.abspath('test/Example_Notebook.quill')
import quill.converter
doctest.testmod(quill.converter, globs={'quill_file': infile})
def test_notebook_data_model():
from quill.importer.quill_importer import QuillImporter
infile = 'test/Example_Notebook.quill'
imp = QuillImporter(infile)
book = imp.get_book()
page = book.get_page(0)
import quill.book
doctest.testmod(quill.book, globs={'sample_book': book})
import quill.page
doctest.testmod(quill.page, globs={'sample_page': page})
import quill.graphics_object
doctest.testmod(quill.graphics_object, globs={'sample_stroke': page.strokes()[0]})
import quill.stroke
doctest.testmod(quill.stroke, globs={'sample_stroke': page.strokes()[0]})
import quill.line
doctest.testmod(quill.line, globs={'sample_line': page.lines()[0]})
import quill.image
doctest.testmod(quill.image, globs={'sample_image': page.images()[0]})
def test_import_export():
from quill.importer.quill_importer import QuillImporter
infile = 'test/Example_Notebook.quill'
imp = QuillImporter(infile)
book_quill = imp.get_book()
import quill.importer.base
doctest.testmod(quill.importer.base, globs={'sample_importer': imp})
from quill.importer.xournal import Xournal
infile = 'test/Example_Notebook.xoj'
imp = Xournal(infile)
book_xoj = imp.get_book()
globs = {'sample_book': book_quill, 'sample_book_xoj': book_xoj }
import quill.exporter.base
doctest.testmod(quill.exporter.base, globs=globs)
import quill.exporter.base2
doctest.testmod(quill.exporter.base2, globs=globs)
import quill.exporter.cairo_context
doctest.testmod(quill.exporter.cairo_context, globs=globs)
import quill.exporter.cairo_surface_paginated
doctest.testmod(quill.exporter.cairo_surface_paginated, globs=globs)
import quill.exporter.pdf
doctest.testmod(quill.exporter.pdf, globs=globs)
import quill.exporter.ps
doctest.testmod(quill.exporter.ps, globs=globs)
import quill.exporter.svg
doctest.testmod(quill.exporter.svg, globs=globs)
import quill.exporter.quill_exporter
doctest.testmod(quill.exporter.quill_exporter, globs=globs)
import quill.exporter.xournal
doctest.testmod(quill.exporter.xournal, globs=globs)
def run_doctests():
test_notebook_data_model()
test_xournal_import()
test_import_export()
test_converter()
if __name__ == '__main__':
run_doctests()