Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImgMathTestが失敗する #1917

Closed
takahashim opened this issue Aug 14, 2024 · 4 comments
Closed

ImgMathTestが失敗する #1917

takahashim opened this issue Aug 14, 2024 · 4 comments

Comments

@takahashim
Copy link
Collaborator

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
Copy link
Owner

kmuto commented Aug 14, 2024

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

@takahashim
Copy link
Collaborator Author

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

  • val1: 672
  • val2: 720
  • val3: 813

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

  • val1: 339
  • val2: 352
  • val3: 670

くらいになりました。

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

@kmuto
Copy link
Owner

kmuto commented Aug 15, 2024

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

@kmuto
Copy link
Owner

kmuto commented Aug 19, 2024

#1921 で対応

@kmuto kmuto closed this as completed Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants