kmuto / review

Re:VIEW is flexible document format/conversion system
http://reviewml.org/
GNU Lesser General Public License v2.1
1.33k stars 214 forks source link

ImgMathTestが失敗する #1917

Closed takahashim closed 1 month ago

takahashim commented 1 month ago

ImgMathTest#test_defer_math_imageが環境によって失敗するようでした。

$ bundle exec ruby test/run_test.rb test_img_math.rb
Loaded suite ImgMathTest
Started
pdftocairo version 24.04.0
Copyright 2005-2024 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2011, 2022 Glyph & Cog, LLC
/Users/maki/git/review/test/test_img_math.rb:91: warning: constant MiniMagick::Tool::Compare is deprecated
F
==============================================================================================================================================================================
Failure: test_defer_math_image(ImgMathTest)
/Users/maki/git/review/test/test_img_math.rb:50:in `test_defer_math_image'
     47:     assert File.exist?(img_path2)
     48: 
     49:     val1 = compare_images(img_path1, File.join(assets_dir, 'img_math/img1.png'))
  => 50:     assert_equal 0, val1
     51: 
     52:     val2 = compare_images(img_path2, File.join(assets_dir, 'img_math/img2.png'))
     53:     assert_equal 0, val2
<0> expected but was
<672>
==============================================================================================================================================================================
|/Users/maki/git/review/test/test_img_math.rb:91: warning: constant MiniMagick::Tool::Compare is deprecated
Finished in 1.27723 seconds.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4 tests, 7 assertions, 1 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
75% passed
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3.13 tests/s, 5.48 assertions/s
Coverage report generated for Unit Tests to /Users/maki/git/review/coverage. 1558 / 4563 LOC (34.14%) covered.
Stopped processing SimpleCov as a previous error not related to SimpleCov has been detected

確かに生成される画像が微妙に違いそうでした。うーん…。

img_path1の画像:

img1a

img_math/img1.pngの画像:

img1b

kmuto commented 1 month ago

あぁ…。これどうしようかなと思っていたのでした。@takahashim のお手元だと、val1、val2はいくつになってますか。 (あと、deprecatedなのもなんとかしないとかな…)

takahashim commented 1 month ago

val1, val2, val3はそれぞれ以下のようになります。

-fuzzの次の行をcompare << '25%'とかにすると、

くらいになりました。

deprecatedなのはすぐ治るのですが、比較方法自体をもうちょっとなんとかしたいところですね…。

kmuto commented 1 month ago

うむむ、差がだいぶでかいですね…… 存在する、crop後の縦・横のピクセルサイズが異常に大きかったり小さかったりしない あたりのテストでよしとすべきか…。

kmuto commented 1 month ago

1921 で対応