improve testing harness

main
Matthew Butterick 7 years ago
parent 3b77ff5ca7
commit a003b3ea6e

@ -1,63 +0,0 @@
%PDF-1.3
%ÿÿÿÿ
5 0 obj
<<
/Parent 1 0 R
/Resources 4 0 R
/Contents 3 0 R
/MediaBox [0 0 612 792]
/Type /Page
>>
endobj
4 0 obj
<<
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
>>
endobj
3 0 obj
<<
/Length 18
>>
stream
1 0 0 -1 0 792 cm
endstream
endobj
6 0 obj
<<
/CreationDate (D:19700101000000Z)
/Creator (PitfallKit)
/Producer (PitfallKit)
>>
endobj
2 0 obj
<<
/Pages 1 0 R
/Type /Catalog
>>
endobj
1 0 obj
<<
/Kids [5 0 R]
/Count 1
/Type /Pages
>>
endobj
xref
0 7
0000000000 65535 f
0000000403 00000 n
0000000354 00000 n
0000000186 00000 n
0000000119 00000 n
0000000015 00000 n
0000000254 00000 n
trailer
<<
/Info 6 0 R
/Root 2 0 R
/Size 7
>>
startxref
460
%%EOF

@ -1,63 +0,0 @@
%PDF-1.3
%ÿÿÿÿ
5 0 obj
<<
/Parent 1 0 R
/Resources 4 0 R
/Contents 3 0 R
/MediaBox [0 0 612 792]
/Type /Page
>>
endobj
4 0 obj
<<
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
>>
endobj
3 0 obj
<<
/Length 18
>>
stream
1 0 0 -1 0 792 cm
endstream
endobj
6 0 obj
<<
/CreationDate (D:20170514163610Z)
/Creator (PitfallKit)
/Producer (PitfallKit)
>>
endobj
2 0 obj
<<
/Pages 1 0 R
/Type /Catalog
>>
endobj
1 0 obj
<<
/Kids [5 0 R]
/Count 1
/Type /Pages
>>
endobj
xref
0 7
0000000000 65535 f
0000000403 00000 n
0000000354 00000 n
0000000186 00000 n
0000000119 00000 n
0000000015 00000 n
0000000254 00000 n
trailer
<<
/Info 6 0 R
/Root 2 0 R
/Size 7
>>
startxref
460
%%EOF

@ -0,0 +1,17 @@
#lang pitfall/racket
(provide (all-from-out pitfall/racket))
(test-mode #t)
(r+p rackunit racket/runtime-path pitfall/document)
(define (this->control this) (path-add-extension this #"" #" copy."))
(provide check-copy-equal?)
(define-syntax-rule (check-copy-equal? this)
(check-equal? (file->bytes this) (file->bytes (this->control this))))
(module reader syntax/module-reader
#:language 'pitfall/pdftest
#:read read
#:read-syntax read-syntax)

@ -1,5 +1,5 @@
#lang racket/base
(provide (all-from-out racket/base))
(provide (all-from-out racket/base) r+p)
(define-syntax-rule (r+p id ...) (begin (require id ...) (provide (all-from-out id ...))))

@ -1,14 +1,10 @@
#lang pitfall/racket
(require pitfall/document rackunit)
#lang pitfall/pdftest
(define-runtime-path this "test0rkt.pdf")
(test-mode #t)
(check-true
(let ()
(define doc (new PDFDocument))
(send doc pipe (open-output-file "test0rkt.pdf" #:exists 'replace))
(send doc pipe (open-output-file this #:exists 'replace))
(send doc end)))
(require racket/runtime-path)
(define-runtime-path this "test0rkt.pdf")
(define-runtime-path control "test0rkt copy.pdf")
(check-equal? (file->bytes this) (file->bytes control))
(check-copy-equal? this)

@ -1,16 +1,10 @@
#lang pitfall/racket
(require pitfall/document rackunit)
(require racket/runtime-path)
#lang pitfall/pdftest
(define-runtime-path this "test1rkt.pdf")
(define-runtime-path control "test1rkt copy.pdf")
;; Create a new PDFDocument
(test-mode #t)
(check-true
(let ([doc (new PDFDocument)])
(send doc pipe (open-output-file this #:exists 'replace))
;; Draw a triangle and a circle
(send* doc
[save]
@ -18,9 +12,11 @@
[lineTo 100 250]
[lineTo 200 250]
[fill "#FF3300"])
(send* doc
[circle 280 200 50]
[fill "#6600FF"])
(send doc end)))
(check-equal? (file->bytes this) (file->bytes control))
(check-copy-equal? this)

@ -1,63 +0,0 @@
%PDF-1.3
%ÿÿÿÿ
5 0 obj
<<
/Parent 1 0 R
/Resources 4 0 R
/Contents 3 0 R
/MediaBox [0 0 612 792]
/Type /Page
>>
endobj
4 0 obj
<<
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
>>
endobj
3 0 obj
<<
/Length 18
>>
stream
1 0 0 -1 0 792 cm
endstream
endobj
6 0 obj
<<
/CreationDate (D:19700101000000Z)
/Creator (PitfallKit)
/Producer (PitfallKit)
>>
endobj
2 0 obj
<<
/Pages 1 0 R
/Type /Catalog
>>
endobj
1 0 obj
<<
/Kids [5 0 R]
/Count 1
/Type /Pages
>>
endobj
xref
0 7
0000000000 65535 f
0000000403 00000 n
0000000354 00000 n
0000000186 00000 n
0000000119 00000 n
0000000015 00000 n
0000000254 00000 n
trailer
<<
/Info 6 0 R
/Root 2 0 R
/Size 7
>>
startxref
460
%%EOF

@ -1,91 +0,0 @@
%PDF-1.3
%ÿÿÿÿ
6 0 obj
<<
/ca 1
/Type /ExtGState
>>
endobj
5 0 obj
<<
/Parent 1 0 R
/Resources 4 0 R
/Contents 3 0 R
/MediaBox [0 0 612 792]
/Type /Page
>>
endobj
4 0 obj
<<
/ExtGState <<
/Gs1 6 0 R
>>
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
>>
endobj
3 0 obj
<<
/Length 238
>>
stream
1 0 0 -1 0 792 cm
q
100 150 m
100 250 l
200 250 l
/DeviceRGB cs
1 0.2 0 scn
/Gs1 gs
f
230 200 m
230 150 230 150 280 150 c
330 150 330 150 330 200 c
330 250 330 250 280 250 c
230 250 230 250 230 200 c
h
/DeviceRGB cs
0.4 0 1 scn
/Gs1 gs
f
endstream
endobj
7 0 obj
<<
/CreationDate (D:19700101000000Z)
/Creator (PitfallKit)
/Producer (PitfallKit)
>>
endobj
2 0 obj
<<
/Pages 1 0 R
/Type /Catalog
>>
endobj
1 0 obj
<<
/Kids [5 0 R]
/Count 1
/Type /Pages
>>
endobj
xref
0 8
0000000000 65535 f
0000000696 00000 n
0000000647 00000 n
0000000258 00000 n
0000000163 00000 n
0000000059 00000 n
0000000015 00000 n
0000000547 00000 n
trailer
<<
/Info 7 0 R
/Root 2 0 R
/Size 8
>>
startxref
753
%%EOF
Loading…
Cancel
Save