Skip to content

Commit 519e5b6

Browse files
committed
Modifying testcases for 0.7
1 parent 53b6015 commit 519e5b6

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

test/debugIO.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,9 @@ function testfiles(filename)
9393
name, ext = splitext(filename)
9494
return (name*".res", joinpath(Pkg.dir("PDFIO"), "test", "files", name*".txt"))
9595
end
96+
97+
function local_testfiles(filename)
98+
name, ext = splitext(filename)
99+
return (name*".res", joinpath(Pkg.dir("PDFIO"), "test", "files", name*".txt"),
100+
joinpath(Pkg.dir("PDFIO"), "test", "files", filename))
101+
end
File renamed without changes.
File renamed without changes.

test/runtests.jl

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,14 @@ include("debugIO.jl")
195195
@testset "Symbol Fonts test" begin
196196
@test begin
197197
filename="431.pdf"
198+
result, template_file = local_testfiles(filename)
198199
DEBUG && println(filename)
199200
isfile(filename) ||
200201
download("http://www.stillhq.com/pdfdb/000431/data.pdf",filename)
201202
doc = pdDocOpen(filename)
202203
(npage = pdDocGetPageCount(doc)) == 54
203204
try
204-
open("431.res", "w") do io
205+
open(result, "w") do io
205206
for i=1:npage
206207
page = pdDocGetPage(doc, i)
207208
if pdPageIsEmpty(page) == false
@@ -210,7 +211,7 @@ include("debugIO.jl")
210211
end
211212
end
212213
end
213-
@test files_equal("431.res", "files/431.txt")
214+
@test files_equal(result, template_file)
214215
finally
215216
pdDocClose(doc)
216217
end
@@ -220,12 +221,13 @@ include("debugIO.jl")
220221

221222
@testset "Inline Image test" begin
222223
@test begin
223-
filename="files/Pratham\ Sanskaran.pdf"
224-
DEBUG && println(filename)
225-
doc = pdDocOpen(filename)
226-
(npage = pdDocGetPageCount(doc)) == 54
224+
filename="Pratham-Sanskaran.pdf"
225+
result, template_file, src = local_testfiles(filename)
226+
DEBUG && println(src)
227+
doc = pdDocOpen(src)
228+
(npage = pdDocGetPageCount(doc)) == 3
227229
try
228-
open("Pratham\ Sanskaran.res", "w") do io
230+
open(result, "w") do io
229231
for i=1:npage
230232
page = pdDocGetPage(doc, i)
231233
if pdPageIsEmpty(page) == false
@@ -234,7 +236,7 @@ include("debugIO.jl")
234236
end
235237
end
236238
end
237-
@test files_equal("Pratham\ Sanskaran.res", "files/Pratham\ Sanskaran.txt")
239+
@test files_equal(result, template_file)
238240
finally
239241
pdDocClose(doc)
240242
end
@@ -244,12 +246,13 @@ include("debugIO.jl")
244246

245247
@testset "MacRomanEncoding Fonts test" begin
246248
@test begin
247-
filename="files/spec-2.pdf"
248-
DEBUG && println(filename)
249-
doc = pdDocOpen(filename)
249+
filename="spec-2.pdf"
250+
result, template_file, src = local_testfiles(filename)
251+
DEBUG && println(src)
252+
doc = pdDocOpen(src)
250253
@assert (npage = pdDocGetPageCount(doc)) == 1
251254
try
252-
open("spec-2.res", "w") do io
255+
open(result, "w") do io
253256
for i=1:npage
254257
page = pdDocGetPage(doc, i)
255258
if pdPageIsEmpty(page) == false
@@ -258,7 +261,7 @@ include("debugIO.jl")
258261
end
259262
end
260263
end
261-
@test files_equal("spec-2.res", "files/spec-2.txt")
264+
@test files_equal(result, template_file)
262265
finally
263266
pdDocClose(doc)
264267
end

0 commit comments

Comments
 (0)