Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 63 lines (53 sloc) 1.803 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
#! /usr/local/bin/ruby -w

require 'RMagick'
require 'test/unit'
require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'


class Preview_UT < Test::Unit::TestCase

    def test_preview
        preview_types = [
          Magick::RotatePreview,
          Magick::ShearPreview,
          Magick::RollPreview,
          Magick::HuePreview,
          Magick::SaturationPreview,
          Magick::BrightnessPreview,
          Magick::GammaPreview,
          Magick::SpiffPreview,
          Magick::DullPreview,
          Magick::GrayscalePreview,
          Magick::QuantizePreview,
          Magick::DespecklePreview,
          Magick::ReduceNoisePreview,
          Magick::AddNoisePreview,
          Magick::SharpenPreview,
          Magick::BlurPreview,
          Magick::ThresholdPreview,
          Magick::EdgeDetectPreview,
          Magick::SpreadPreview,
          Magick::SolarizePreview,
          Magick::ShadePreview,
          Magick::RaisePreview,
          Magick::SegmentPreview,
          Magick::SwirlPreview,
          Magick::ImplodePreview,
          Magick::WavePreview,
          Magick::OilPaintPreview,
          Magick::CharcoalDrawingPreview,
          Magick::JPEGPreview ]

        hat = Magick::Image.read(IMAGES_DIR+'/Flower_Hat.jpg').first
        assert_nothing_raised do
            prev = hat.preview(Magick::RotatePreview)
            assert_instance_of(Magick::Image, prev)
        end
        puts "\n"
        preview_types.each do |type|
            puts "testing #{type.to_s}..."
            assert_nothing_raised { prev = hat.preview(type) }
        end
        assert_raise(TypeError) { hat.preview(2) }
    end

end


if __FILE__ == $0
IMAGES_DIR = '../doc/ex/images'
Test::Unit::UI::Console::TestRunner.run(Preview_UT) if RUBY_VERSION != '1.9.1'
end

Something went wrong with that request. Please try again.