test/hexapdf/image_loader/test_jpeg.rb in hexapdf-0.9.3 vs test/hexapdf/image_loader/test_jpeg.rb in hexapdf-0.10.0

- old
+ new

@@ -64,9 +64,19 @@ assert_equal(:DeviceCMYK, image[:ColorSpace]) assert_equal([1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0], image[:Decode]) assert_equal(File.binread(jpeg), image.stream) end + it "works for a YCCK jpeg" do + jpeg = @images.grep(/ycck\.jpg/).first + image = @loader.load(@doc, jpeg) + assert_equal(5, image[:Width]) + assert_equal(5, image[:Height]) + assert_equal(:DeviceCMYK, image[:ColorSpace]) + refute(image.key?(:Decode)) + assert_equal(File.binread(jpeg), image.stream) + end + it "fails if the JPEG is corrupt" do exp = assert_raises(HexaPDF::Error) do @loader.load(@doc, StringIO.new("some non JPEG data")) end assert_match(/marker code/, exp.message)