예제 #1
0
                timer.seconds()))

        # Run this test from within the shell event loop
        self.exec_in_shell(impl)

    def test_4_SwitchSlice(self):
        """
        Move the z-window by 1 slice.  The data should already be cached, so this is really measuring the performance of cache access.
        """
        def impl():
            workflow = self.shell.projectManager.workflow
            pixClassApplet = workflow.pcApplet
            gui = pixClassApplet.getMultiLaneGui()

            with Timer() as timer:
                gui.currentGui().editor.posModel.slicingPos = (0, 0, 1)

                # Do to the way we wait for the views to finish rendering, the GUI hangs while we wait.
                self.waitForViews(gui.currentGui().editor.imageViews)

            logger.debug("New Slice Rendering Time: {}".format(
                timer.seconds()))

        # Run this test from within the shell event loop
        self.exec_in_shell(impl)


if __name__ == "__main__":
    from tests.helpers.shellGuiTestCaseBase import run_shell_nosetest
    run_shell_nosetest(__file__)
                observedColor = self.getPixelColor(imgView, self.LABEL_SAMPLE)
                oldColor = originalLabelColors[i]
                assert observedColor != oldColor, "Label should not be presnt on the second image in this test."

            # Select the first image again
            self.shell.imageSelectionCombo.setCurrentIndex(0)
            gui.currentGui().editor.posModel.slicingPos = (0,0,0)
            self.waitForViews(gui.currentGui().editor.imageViews)

            # Verify the actual rendering of each view.  Labels should re-appear.
            for i in range(3):
                imgView = gui.currentGui().editor.imageViews[i]
                observedColor = self.getPixelColor(imgView, self.LABEL_SAMPLE)
                expectedColor = gui.currentGui()._colorTable16[i+1]
                assert observedColor == expectedColor, "Label is missing (should have been drawn in a previous test).  Expected {}, got {}".format( hex(expectedColor), hex(observedColor) )                

        # Run this test from within the shell event loop
        self.exec_in_shell(impl)

if __name__ == "__main__":
    from tests.helpers.shellGuiTestCaseBase import run_shell_nosetest
    run_shell_nosetest(__file__)