test/test_mixed.rb in rocrad-0.1.3 vs test/test_mixed.rb in rocrad-0.1.4
- old
+ new
@@ -1,7 +1,10 @@
-require 'helper'
-require 'pathname'
+begin
+ require "helper"
+rescue LoadError
+ require File.dirname(__FILE__) + '/helper'
+end
class TestMixed < Test::Unit::TestCase
def setup
@path = Pathname.new(__FILE__.gsub("test_mixed.rb", "")).expand_path
@@ -19,19 +22,19 @@
image.add_area(28, 19, 25, 25) #position of 4
image.add_area(180, 22, 20, 28) # position of 3
image.add_area(218, 22, 24, 28) # position of z
image.add_area(248, 24, 22, 22) # position of z
end
- assert_equal @txt_tif, mix_block.to_s_without_spaces
+ assert_equal @txt_tif, mix_block.to_s.gsub(/[ \n\r]/, "")
mix_block = Rocrad::Mixed.new(@tif, {:areas => [
{:x => 28, :y=>19, :w=>25, :h=>25}, #position of 4
{:x => 180, :y=>22, :w=>20, :h=>28}, # position of 3
{:x => 218, :y=>22, :w=>24, :h=>28}, # position of z
{:x => 248, :y=>24, :w=>22, :h=>22} # position of z
]})
- assert_equal @txt_tif, mix_block.to_s_without_spaces
+ assert_equal @txt_tif, mix_block.to_s.gsub(/[ \n\r]/, "")
end
def test_show_areas
mix_block = Rocrad::Mixed.new(@tif) do |image|
@@ -74,18 +77,18 @@
mix_block.areas = mix_block.areas[1..3]
areas = [{:x=>180, :h=>28, :w=>20, :y=>22},
{:x=>218, :h=>28, :w=>24, :y=>22},
{:x=>248, :h=>22, :w=>22, :y=>24}]
assert_equal(areas, mix_block.areas)
- assert_equal @txt_tif[1..3], mix_block.to_s_without_spaces
+ assert_equal @txt_tif[1..3], mix_block.to_s.gsub(/[ \n\r]/, "")
mix_block.areas = []
assert_equal([], mix_block.areas)
- assert_equal "", mix_block.to_s_without_spaces
+ assert_equal "", mix_block.to_s.gsub(/[ \n\r]/, "")
mix_block.areas = nil
- #assert_equal([], mix_block.areas)
- assert_equal "", mix_block.to_s_without_spaces
+ assert_equal([], mix_block.areas)
+ assert_equal "", mix_block.to_s.gsub(/[ \n\r]/, "")
end
end