Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
moved tests of IplImage#smoothness to test_iplimage.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
ser1zw committed Apr 16, 2011
1 parent 08a9655 commit b1c2178
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Binary file modified test/samples/smooth1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/samples/smooth2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions test/test_iplimage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

# Tests for OpenCV::IplImage
class TestIplImage < OpenCVTestCase
def should_classify_images_as(filename, classification)
assert_equal(OpenCV::IplImage::load(filename, OpenCV::CV_LOAD_IMAGE_GRAYSCALE).smoothness[0], classification)
end

def test_initialize
img = IplImage.new(10, 20)
assert_equal(10, img.width)
Expand Down Expand Up @@ -127,6 +131,26 @@ def test_coi
img.coi = 1
assert_equal(1, img.coi)
end

def test_smoothness
asset_path = File.join(File.dirname(__FILE__), 'samples')

for image in Array.new(7) { |e| e = File.join(asset_path, "smooth%d.jpg") % e } do
should_classify_images_as image, :smooth
end

for image in Array.new(2) { |e| e = File.join(asset_path, "messy%d.jpg") % e } do
should_classify_images_as image, :messy
end

for image in Array.new(10) { |e| e = File.join(asset_path, "blank%d.jpg") % e } do
should_classify_images_as image, :blank
end

for image in Array.new(2) { |e| e = File.join(asset_path, "partially_blank%d.jpg") % e } do
should_classify_images_as image, :blank
end
end
end


0 comments on commit b1c2178

Please sign in to comment.