def test_compare(self):
     diffs = imageOps.compare(self.imageFname1, self.imageFname1_dup)
     self.assertAlmostEqual(diffs[0], 0)
     self.assertAlmostEqual(diffs[1], 0)
     diffs = imageOps.compare(self.imageFname1, self.imageFname2)
     self.assertTrue(0 < diffs[0] < 0.005)
     self.assertTrue(0 < diffs[1] < 0.02)
Ejemplo n.º 2
0
 def test_compare_rayTay(self):
     """Added as a result of unexpected high error results when
     comparing images from multiple procs in Underworld."""
     imgNp1_10 = os.path.join(self.imgPath, 'rayTay',
                              'window.00010_np1.png')
     imgNp1_11 = os.path.join(self.imgPath, 'rayTay',
                              'window.00011_np1.png')
     imgNp2_10 = os.path.join(self.imgPath, 'rayTay',
                              'window.00010_np2.png')
     imgNp2_11 = os.path.join(self.imgPath, 'rayTay',
                              'window.00011_np2.png')
     diffs = imageOps.compare(imgNp1_10, imgNp1_11)
     self.assertTrue(0 < diffs[0] < 0.1)
     self.assertTrue(0 < diffs[1] < 0.1)
     diffs = imageOps.compare(imgNp2_10, imgNp2_11)
     self.assertTrue(0 < diffs[0] < 0.1)
     self.assertTrue(0 < diffs[1] < 0.1)
     diffs = imageOps.compare(imgNp1_10, imgNp2_10)
     #import pdb
     #pdb.set_trace()
     self.assertTrue(0 < diffs[0] < 0.1)
     self.assertTrue(0 < diffs[1] < 0.1)
     diffs = imageOps.compare(imgNp1_10, imgNp2_11)
     self.assertTrue(0 < diffs[0] < 0.2)
     self.assertTrue(0 < diffs[1] < 0.2)
Ejemplo n.º 3
0
 def test_compare(self):
     diffs = imageOps.compare(self.imageFname1, self.imageFname1_dup)
     self.assertAlmostEqual(diffs[0], 0)
     self.assertAlmostEqual(diffs[1], 0)
     diffs = imageOps.compare(self.imageFname1, self.imageFname2)
     self.assertTrue(0 < diffs[0] < 0.005)
     self.assertTrue(0 < diffs[1] < 0.02)
Ejemplo n.º 4
0
 def check(self, mResult):
     """Implements base class
     :meth:`credo.systest.api.SingleRunTestComponent.check`."""
     self.imageResults = []
     self.imageErrors = []
     statusMsg = ""
     overallResult = True
     refImageFname = os.path.join(self.refPath, self.imageFilename)
     #print refImageFname
     assert os.path.exists(refImageFname)
     if self.genPath is not None:
         genPath = self.genPath
     else:
         genPath = mResult.outputPath
     genImageFname = os.path.join(genPath, self.imageFilename)
     #print genImageFname
     assert os.path.exists(genImageFname)
     self.imageErrors = imageAnalysis.compare(refImageFname, genImageFname)
     self.imageResults = []
     for diff, tol in zip(self.imageErrors, self.tol):
         self.imageResults.append(diff <= tol)
     overallResult = all(self.imageResults)
     if not overallResult:
         statusMsg += "Image comp for image file '%s' errors %s not"\
             " within tol %s of reference image\n"\
             % (self.imageFilename, floatsToStr(self.imageErrors),
                 floatsToStr(self.tol))
     else:
         statusMsg = "Image comp error within tolerances %s"\
             " of ref image.\n"\
             % (floatsToStr(self.tol))
     print statusMsg
     self._setStatus(overallResult, statusMsg)
     return overallResult
 def test_compare_rayTay(self):
     """Added as a result of unexpected high error results when
     comparing images from multiple procs in Underworld."""
     imgNp1_10 = os.path.join(self.imgPath, 'rayTay', 'window.00010_np1.png')
     imgNp1_11 = os.path.join(self.imgPath, 'rayTay', 'window.00011_np1.png')
     imgNp2_10 = os.path.join(self.imgPath, 'rayTay', 'window.00010_np2.png')
     imgNp2_11 = os.path.join(self.imgPath, 'rayTay', 'window.00011_np2.png')
     diffs = imageOps.compare(imgNp1_10, imgNp1_11)
     self.assertTrue(0 < diffs[0] < 0.1)
     self.assertTrue(0 < diffs[1] < 0.1)
     diffs = imageOps.compare(imgNp2_10, imgNp2_11)
     self.assertTrue(0 < diffs[0] < 0.1)
     self.assertTrue(0 < diffs[1] < 0.1)
     diffs = imageOps.compare(imgNp1_10, imgNp2_10)
     #import pdb
     #pdb.set_trace()
     self.assertTrue(0 < diffs[0] < 0.1)
     self.assertTrue(0 < diffs[1] < 0.1)
     diffs = imageOps.compare(imgNp1_10, imgNp2_11)
     self.assertTrue(0 < diffs[0] < 0.2)
     self.assertTrue(0 < diffs[1] < 0.2)
    def check(self, mResult):
        """Implements base class
        :meth:`credo.systest.api.SingleRunTestComponent.check`."""
        self.imageResults = []
        self.imageErrors = []
        statusMsg = ""
        overallResult = True
        refImageFname = os.path.join(self.refPath, self.imageFilename)
        if not os.path.exists(refImageFname):
            statusMsg += "Reference image '%s' not found!\n" % refImageFname
            print statusMsg
            self._setStatus(False, statusMsg)
            return False

        if self.genPath is not None:
            genPath = self.genPath
        else:
            genPath = mResult.outputPath
        genImageFname = os.path.join(genPath, self.imageFilename)
        if not os.path.exists(genImageFname):
            statusMsg += "Generated image '%s' not found!\n" % genImageFname
            print statusMsg
            self._setStatus(False, statusMsg)
            return False

        self.imageErrors = imageAnalysis.compare(refImageFname, genImageFname)
        self.imageResults = []
        for diff, tol in zip(self.imageErrors, self.tol):
            self.imageResults.append(diff <= tol)
        overallResult = all(self.imageResults)
        if not overallResult:
            statusMsg += "Image comp for image file '%s' errors %s not"\
                " within tol %s of reference image\n"\
                % (self.imageFilename, floatsToStr(self.imageErrors),
                    floatsToStr(self.tol))
        else:
            statusMsg = "Image comp error within tolerances %s"\
                " of ref image.\n"\
                % (floatsToStr(self.tol))
        print statusMsg
        self._setStatus(overallResult, statusMsg)
        return overallResult