3 class WrongColor < Exception
8 "Wrong color at #{@pixel}"
11 class AreaError < Exception
12 def initialize(area,problem)
13 @area,@problem = area,problem
16 "Area at #{@area} #{@problem}"
19 class PixelError < Exception
20 def initialize(p1, relation,p2)
21 @p1,@p2,@relation = p1,p2,relation
24 "Pixel #{@p1} #{@relation} #{@p2}"
29 def initialize(x1,y1,x2,y2)
30 @x1,@y1,@x2,@y2 = x1,y1,x2,y2
32 def should_be_plain_colored
33 raise AreaError.new(self,"is not plain colored")
35 def should_not_be_plain_colored
36 raise AreaError.new(self,"is plain colored")
39 "(#{@x1},#{@y1},#{@x2},#{@y2})"
47 def should_be_of_color(color)
48 raise WrongColor.new(self)
50 def should_be_brighter_than(pixel)
51 raise PixelError.new(self,"is not brighter than",pixel)
53 def should_be_less_bright_than(pixel)
54 raise PixelError.new(self,"is brighter than",pixel)
56 def should_be_the_same_as(pixel)
57 raise PixelError.new(self,"is not the same as",pixel)
64 def initialize(filename, options)
66 @page = (options[:page] or 1)
68 def area_at(x1,y1,x2,y2)
69 return Area.new(x1,y1,x2,y2)
85 def area_at(x1,y1,x2,y2)
86 @file.area_at(x1,y1,x2,y2)
97 def initialize(proxy,&impl)
99 @_implementation = impl
101 @file = DocFile.new(proxy.description, proxy.options)
104 module ExampleGroupMethods
105 alias :convert_file :example