@@ -168,7 +168,7 @@ public void pngRoundTripTest() throws IOException {
168168 BufferedImage roundTrippedImage = ImageIO .read (dupe );
169169 Assertions .assertEquals (originalImage .getWidth (), roundTrippedImage .getWidth ());
170170 Assertions .assertEquals (originalImage .getHeight (), roundTrippedImage .getHeight ());
171- double accuracy = TestResults2DLinePlot .getAccuracyPercentage (originalImage , roundTrippedImage );
171+ double accuracy = TestResults2DLinePlot .getAccuracy (originalImage , roundTrippedImage ). product ( );
172172 Assertions .assertTrue (accuracy > ACCURACY_THRESHOLD , String .format ("accuracy: %f !> %f; file: %s" , accuracy , ACCURACY_THRESHOLD , dupe .getCanonicalPath ()));
173173 }
174174
@@ -189,7 +189,7 @@ public void pngLibraryLevelTest() throws IOException {
189189 BufferedImage currentImage = chart .createBufferedImage (1000 ,1000 );
190190 Assertions .assertEquals (currentImage .getWidth (), standardImage .getWidth ());
191191 Assertions .assertEquals (currentImage .getHeight (), standardImage .getHeight ());
192- double accuracy = TestResults2DLinePlot .getAccuracyPercentage (standardImage , currentImage );
192+ double accuracy = TestResults2DLinePlot .getAccuracy (standardImage , currentImage ). product ( );
193193 Assertions .assertTrue (accuracy > ACCURACY_THRESHOLD , String .format ("accuracy: %f !> %f" , accuracy , ACCURACY_THRESHOLD ));
194194 }
195195
@@ -237,14 +237,16 @@ public void pngExecutionLevelTest() throws IOException {
237237 Assertions .assertEquals (standardImage1 .getWidth (), generatedImage1 .getWidth ());
238238 Assertions .assertEquals (standardImage1 .getHeight (), generatedImage1 .getHeight ());
239239
240-
241- double accuracy0 = TestResults2DLinePlot .getAccuracyPercentage (standardImage0 , generatedImage0 );
242- double accuracy1 = TestResults2DLinePlot .getAccuracyPercentage (standardImage1 , generatedImage1 );
243- String errMsg = String .format ("Values Threshold (%f):\n \t Test0 - accuracy: %f; file: %s\n \t Test1 - accuracy: %f; file: %s" , ACCURACY_THRESHOLD , accuracy0 , generatedPlot0 .getCanonicalPath (), accuracy1 , generatedPlot1 .getCanonicalPath ());
244- Assertions .assertTrue (accuracy0 > ACCURACY_THRESHOLD && accuracy1 > ACCURACY_THRESHOLD , errMsg );
240+ SSIMComparisonTool .Results results0 = TestResults2DLinePlot .getAccuracy (standardImage0 , generatedImage0 );
241+ SSIMComparisonTool .Results results1 = TestResults2DLinePlot .getAccuracy (standardImage1 , generatedImage1 );
242+ String errMsg = String .format ("Values Threshold (%f):\n \t Test0 - accuracy: %f (%f/%f/%f); file: %s\n \t Test1 - accuracy: %f ((%f/%f/%f)); file: %s" ,
243+ ACCURACY_THRESHOLD ,
244+ results0 .product (), results0 .luminanceComponent (), results0 .contrastComponent (), results0 .structureComponent (), generatedPlot0 .getCanonicalPath (),
245+ results1 .product (), results1 .luminanceComponent (), results1 .contrastComponent (), results1 .structureComponent (), generatedPlot1 .getCanonicalPath ());
246+ Assertions .assertTrue (results0 .product () > ACCURACY_THRESHOLD && results1 .product () > ACCURACY_THRESHOLD , errMsg );
245247 }
246248
247- private static double getAccuracyPercentage (BufferedImage original , BufferedImage generated ){
249+ private static SSIMComparisonTool . Results getAccuracy (BufferedImage original , BufferedImage generated ){
248250 SSIMComparisonTool ssim = new SSIMComparisonTool ();
249251 return ssim .performSSIMComparison (original , generated );
250252 }
0 commit comments