Exemplo n.º 1
0
    def play(self):
        from recorder import Recorder
        if len(self.filenames) == 1:
            img = Recorder.imageFileToPath(self.filenames[0])
            if not os.path.exists(img):
                snapshot.snapWindow(self.title, img)
                return "message: " + "check point image file " + img + \
                       " doesn't exist and has been created"

            tempfile = 'snapshots/checkpoint.png'
            snapshot.snapWindow(self.title, tempfile)

            if not snapshot.compareSnapshots(img, tempfile):
                return "error: " + "checkpoint fails: " + tempfile + \
                       " is inconsistent with " + img

            # delete temp file
            os.remove(os.path.realpath(tempfile))
            
        else: # this is a temporary behavior modification
            match = False
            tempfile = 'snapshots/checkpoint.png'
            snapshot.snapWindow(self.title, tempfile)
            
            for i in self.filenames:
                img = Recorder.imageFileToPath(i)
                if not os.path.exists(img):
                    return "message: check point image file " + img + \
                           " doesn't exist"

                if snapshot.compareSnapshots(img, tempfile):
                   match = True
                   break
                
            if not match:
                return "error: checkpoint fails: " + tempfile + \
                       " matches none of the image files"
Exemplo n.º 2
0
 def play(self):
     from recorder import Recorder
     img = Recorder.imageFileToPath(self.filename)
     snapshot.snapWindow(self.title, img)