Преглед изворни кода

ENH: ctkCrosshairLabelTest2: Allow for small differences from baseline images

Allow for small differences from baseline images in ctkCrosshairLabelTest2.
Visual inspection of the differences show minimal differences in the background
pixmap, perhaps due to different scaling from when the baseline was created.
Max Smolens пре 7 година
родитељ
комит
bc1df16a89
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3 2
      Libs/Widgets/Testing/Cpp/ctkCrosshairLabelTest2.cpp

+ 3 - 2
Libs/Widgets/Testing/Cpp/ctkCrosshairLabelTest2.cpp

@@ -28,6 +28,7 @@
 // CTK includes
 #include "ctkCrosshairLabel.h"
 #include "ctkCommandLineParser.h"
+#include "ctkWidgetsTestingUtilities.h"
 
 // STD includes
 #include <cstdlib>
@@ -39,7 +40,8 @@ bool imageCompare(ctkCrosshairLabel& crosshair, QString baselineDirectory,
 {
   QImage output = QPixmap::grabWidget(&crosshair).toImage();
   QImage baseline(baselineDirectory + "/" + baselineFilename);
-  return output == baseline;
+  const float percentThreshold = 1.5f;
+  return ctkWidgetsTestingUtilities::CompareImages(output, baseline, percentThreshold);
 }
 
 //-----------------------------------------------------------------------------
@@ -116,7 +118,6 @@ int ctkCrosshairLabelTest2(int argc, char * argv [] )
   // Odd widget size
   crosshair.setMinimumSize(baseSize);
   crosshair.setPixmap(pixmap.scaled(baseSize));
-  crosshair.show();
 
   // Test bullsEyeWidth and line width with odd widget size
   crosshair.setCrosshairType(ctkCrosshairLabel::BullsEyeCrosshair);