Beispiel #1
0
    def is_not_image_with_image_file_test(self):
        """
        Test the method handles an image file
        """
        # Given and empty string
        file_name = os.path.join(TEST_RESOURCES_PATH, 'church.jpg')

        # WHEN testing for it
        result = is_not_image_file(file_name)

        # THEN the result is false
        assert result is False, 'The file is present so the test should return False'
Beispiel #2
0
    def is_not_image_with_none_image_file_test(self):
        """
        Test the method handles a non image file
        """
        # Given and empty string
        file_name = os.path.join(TEST_RESOURCES_PATH, 'serviceitem_custom_1.osj')

        # WHEN testing for it
        result = is_not_image_file(file_name)

        # THEN the result is false
        assert result is True, 'The file is not an image file so the test should return True'
Beispiel #3
0
    def is_not_image_empty_test(self):
        """
        Test the method handles an empty string
        """
        # Given and empty string
        file_name = ""

        # WHEN testing for it
        result = is_not_image_file(file_name)

        # THEN the result is false
        assert result is True, 'The missing file test should return True'
Beispiel #4
0
    def is_not_image_with_none_image_file_test(self):
        """
        Test the method handles a non image file
        """
        # Given and empty string
        file_name = os.path.join(TEST_RESOURCES_PATH, 'serviceitem_custom_1.osj')

        # WHEN testing for it
        result = is_not_image_file(file_name)

        # THEN the result is false
        assert result is True, 'The file is not an image file so the test should return True'
Beispiel #5
0
    def is_not_image_with_image_file_test(self):
        """
        Test the method handles an image file
        """
        # Given and empty string
        file_name = os.path.join(TEST_RESOURCES_PATH, 'church.jpg')

        # WHEN testing for it
        result = is_not_image_file(file_name)

        # THEN the result is false
        assert result is False, 'The file is present so the test should return False'
Beispiel #6
0
    def is_not_image_empty_test(self):
        """
        Test the method handles an empty string
        """
        # Given and empty string
        file_name = ""

        # WHEN testing for it
        result = is_not_image_file(file_name)

        # THEN the result is false
        assert result is True, 'The missing file test should return True'
Beispiel #7
0
 def validateCurrentPage(self):
     """
     Validate the current page
     """
     background_image = BackgroundType.to_string(BackgroundType.Image)
     if self.page(self.currentId()) == self.background_page and \
             self.theme.background_type == background_image and is_not_image_file(self.theme.background_filename):
         QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'),
                                    translate('OpenLP.ThemeWizard', 'You have not selected a '
                                              'background image. Please select one before continuing.'))
         return False
     else:
         return True
Beispiel #8
0
 def validateCurrentPage(self):
     """
     Validate the current page
     """
     background_image = BackgroundType.to_string(BackgroundType.Image)
     if self.page(self.currentId()) == self.background_page and \
             self.theme.background_type == background_image and is_not_image_file(self.theme.background_filename):
         QtGui.QMessageBox.critical(
             self, translate('OpenLP.ThemeWizard',
                             'Background Image Empty'),
             translate(
                 'OpenLP.ThemeWizard', 'You have not selected a '
                 'background image. Please select one before continuing.'))
         return False
     else:
         return True