示例#1
0
    def test_set_gradient_type_int(self):
        """
        Test the gradient_type setter with an int
        """
        # GIVEN: A BackgroundPage instance
        page = BackgroundPage()

        # WHEN: The property is set
        page.gradient_type = BackgroundGradientType.Horizontal

        # THEN: The combobox should be correct
        assert page.gradient_combo_box.currentIndex() == 0
示例#2
0
    def test_set_gradient_type_exception(self):
        """
        Test the gradient_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='gradient_type must either be a string or an int'):
            page.gradient_type = []
示例#3
0
    def test_set_gradient_type_str(self):
        """
        Test the gradient_type setter with a str
        """
        # GIVEN: A BackgroundPage instance
        page = BackgroundPage()

        # WHEN: The property is set
        page.gradient_type = BackgroundGradientType.to_string(
            BackgroundGradientType.Circular)

        # THEN: The combobox should be correct
        assert page.gradient_combo_box.currentIndex() == 2