Exemple #1
0
    def test_set_background_type_int(self):
        """
        Test the background_type setter with an int
        """
        # GIVEN: A BackgroundPage instance
        page = BackgroundPage()

        # WHEN: The property is set
        page.background_type = BackgroundType.Image

        # THEN: The combobox should be correct
        assert page.background_combo_box.currentIndex() == 2
Exemple #2
0
    def test_set_background_type_str(self):
        """
        Test the background_type setter with a str
        """
        # GIVEN: A BackgroundPage instance
        page = BackgroundPage()

        # WHEN: The property is set
        page.background_type = BackgroundType.to_string(
            BackgroundType.Gradient)

        # THEN: The combobox should be correct
        assert page.background_combo_box.currentIndex() == 1
Exemple #3
0
    def test_set_background_type_exception(self):
        """
        Test the background_type setter with something other than a str or int
        """
        # GIVEN: A BackgroundPage instance
        page = BackgroundPage()

        # WHEN: The property is set
        # THEN: An exception is raised
        with pytest.raises(
                TypeError,
                match='background_type must either be a string or an int'):
            page.background_type = []