Sha256: 1fa07fadc66c00db40d9fe6f5d9ed4355aeaaaabc77024437ae7a5e83e4af3d8

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

#!/usr/bin/env ruby -w

require 'rmagick'
require 'test/unit'
require 'test/unit/ui/console/testrunner' unless RUBY_VERSION[/^1\.9|^2/]

class PreviewUT < 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}..."
      assert_nothing_raised { hat.preview(type) }
    end
    assert_raise(TypeError) { hat.preview(2) }
  end
end

if $PROGRAM_NAME == __FILE__
  IMAGES_DIR = '../doc/ex/images'
  Test::Unit::UI::Console::TestRunner.run(PreviewUT) unless RUBY_VERSION[/^1\.9|^2/]
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rmagick-3.1.0 test/Preview.rb
rmagick-3.0.0 test/Preview.rb