summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMatthias Kramm <kramm@quiss.org>2009-08-16 18:52:54 +0200
committerMatthias Kramm <kramm@quiss.org>2009-08-16 18:52:54 +0200
commitecd7c7248b9a93163090bfe7512b2a53d8da6d95 (patch)
treec07666fb6bc38051e17c50a56af61be298dd6e73 /spec
parentaa68d639ad8b19770257811b6765cb3b3ba7b16e (diff)
bugfixes
Diffstat (limited to 'spec')
-rw-r--r--spec/simpletext.spec.rb1
-rw-r--r--spec/smalltext.pdfbin2746 -> 2749 bytes
-rw-r--r--spec/smalltext.py2
-rw-r--r--spec/spec_helper.rb16
4 files changed, 14 insertions, 5 deletions
diff --git a/spec/simpletext.spec.rb b/spec/simpletext.spec.rb
index d5911ad4..874ce590 100644
--- a/spec/simpletext.spec.rb
+++ b/spec/simpletext.spec.rb
@@ -8,5 +8,6 @@ describe "pdf conversion" do
pixel_at(97,164).should_be_the_same_as pixel_at(208,256)
area_at(215,80,333,156).should_be_plain_colored
area_at(46,126,180,158).should_not_be_plain_colored
+ area_at(38,118,170,152).should_contain_text 'Hello World'
end
end
diff --git a/spec/smalltext.pdf b/spec/smalltext.pdf
index d7c7eeb5..7f2323fe 100644
--- a/spec/smalltext.pdf
+++ b/spec/smalltext.pdf
Binary files differ
diff --git a/spec/smalltext.py b/spec/smalltext.py
index a0ac9dfd..45fa2d78 100644
--- a/spec/smalltext.py
+++ b/spec/smalltext.py
@@ -10,7 +10,7 @@ PDF_begin_page(p, 612, 200)
font = PDF_load_font(p, "Helvetica", "host", "")
PDF_setfont(p, font, 6.0)
-PDF_set_text_pos(p, 40, 100);PDF_show(p, "|")
+PDF_set_text_pos(p, 40, 100);PDF_show(p, "'")
PDF_set_text_pos(p, 80, 100);PDF_show(p, "i")
PDF_set_text_pos(p, 120, 100);PDF_show(p, "l")
PDF_set_text_pos(p, 160, 100);PDF_show(p, "-")
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 1ee0b39d..cf9c9713 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -91,6 +91,14 @@ class Pixel
"(#{@x},#{@y})"
end
end
+
+$tempfiles = []
+Kernel.at_exit do
+ $tempfiles.each do |file|
+ `rm -f #{file}`
+ end
+end
+
class DocFile
def initialize(filename, page)
@filename = filename
@@ -99,6 +107,7 @@ class DocFile
def convert()
return if @swfname
@swfname = @filename.gsub(/.pdf$/i,"")+".swf"
+ $tempfiles += [@swfname]
`pdfinfo #{@filename}` =~ /Page size:\s*([0-9]+) x ([0-9]+) pts/
width,height = $1,$2
dpi = (72.0 * 612 / width.to_i).to_i
@@ -115,15 +124,14 @@ class DocFile
raise ConversionFailed.new(output,@pngname) unless File.exists?(@pngname)
@img = Magick::Image.read(@pngname).first
ensure
- `rm -f #{@swfname}`
`rm -f #{@pngname}`
end
end
def get_text(x1,y1,x2,y2)
self.convert()
- puts "swfstrings -x #{x1} -y #{y1} -W #{x2-x1} -H #{y2-y1} #{@swfname}"
- puts `swfstrings -x #{x1} -y #{y1} -W #{x2-x1} -H #{y2-y1} #{@swfname}`
- `swfstrings -x #{x1} -y #{y1} -W #{x2-x1} -H #{y2-y1} #{@swfname}`
+ #puts "swfstrings -x #{x1} -y #{y1} -W #{x2-x1} -H #{y2-y1} #{@swfname}"
+ #puts `swfstrings -x #{x1} -y #{y1} -W #{x2-x1} -H #{y2-y1} #{@swfname}`
+ `swfstrings -x #{x1} -y #{y1} -W #{x2-x1} -H #{y2-y1} #{@swfname}`.chomp
end
def get_area(x1,y1,x2,y2)
self.render()