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

Commit b1c2178

Browse files
committed
moved tests of IplImage#smoothness to test_iplimage.rb
1 parent 08a9655 commit b1c2178

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

test/samples/smooth1.jpg

-196 KB
Loading

test/samples/smooth2.jpg

97.6 KB
Loading

test/test_iplimage.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
# Tests for OpenCV::IplImage
1010
class TestIplImage < OpenCVTestCase
11+
def should_classify_images_as(filename, classification)
12+
assert_equal(OpenCV::IplImage::load(filename, OpenCV::CV_LOAD_IMAGE_GRAYSCALE).smoothness[0], classification)
13+
end
14+
1115
def test_initialize
1216
img = IplImage.new(10, 20)
1317
assert_equal(10, img.width)
@@ -127,6 +131,26 @@ def test_coi
127131
img.coi = 1
128132
assert_equal(1, img.coi)
129133
end
134+
135+
def test_smoothness
136+
asset_path = File.join(File.dirname(__FILE__), 'samples')
137+
138+
for image in Array.new(7) { |e| e = File.join(asset_path, "smooth%d.jpg") % e } do
139+
should_classify_images_as image, :smooth
140+
end
141+
142+
for image in Array.new(2) { |e| e = File.join(asset_path, "messy%d.jpg") % e } do
143+
should_classify_images_as image, :messy
144+
end
145+
146+
for image in Array.new(10) { |e| e = File.join(asset_path, "blank%d.jpg") % e } do
147+
should_classify_images_as image, :blank
148+
end
149+
150+
for image in Array.new(2) { |e| e = File.join(asset_path, "partially_blank%d.jpg") % e } do
151+
should_classify_images_as image, :blank
152+
end
153+
end
130154
end
131155

132156

0 commit comments

Comments
 (0)