Пример #1
0
    it "can return the i'th item in the theme":
        theme = Theme()
        theme.add_hsbk(320, 1, 0, 3500)
        theme.add_hsbk(100, 0.5, 0.3, 3400)

        self.assertEqual(theme[0], ThemeColor(320, 1, 0, 3500))
        self.assertEqual(theme[1], ThemeColor(100, 0.5, 0.3, 3400))

    it "can return the next item in the theme or the current if there is no next":
        theme = Theme()
        theme.add_hsbk(320, 1, 0, 3500)
        theme.add_hsbk(0, 0.5, 0, 4500)
        theme.add_hsbk(100, 0.5, 0.3, 3400)

        self.assertEqual(theme.get_next_bounds_checked(0), ThemeColor(0, 0.5, 0, 4500))
        self.assertEqual(theme.get_next_bounds_checked(1), ThemeColor(100, 0.5, 0.3, 3400))
        self.assertEqual(theme.get_next_bounds_checked(2), ThemeColor(100, 0.5, 0.3, 3400))

    it "can return a shuffled version of the theme":
        theme = Theme()
        ordered = []
        for i in range(0, 100, 5):
            theme.add_hsbk(i, 0.3, 0.4, 4500)
            ordered.append(i)

        shuffled = theme.shuffled()

        got = []
        for i in range(0, 20):
            theme[i].hue = i * 5
Пример #2
0
    it "can return the i'th item in the theme":
        theme = Theme()
        theme.add_hsbk(320, 1, 0, 3500)
        theme.add_hsbk(100, 0.5, 0.3, 3400)

        assert theme[0] == ThemeColor(320, 1, 0, 3500)
        assert theme[1] == ThemeColor(100, 0.5, 0.3, 3400)

    it "can return the next item in the theme or the current if there is no next":
        theme = Theme()
        theme.add_hsbk(320, 1, 0, 3500)
        theme.add_hsbk(0, 0.5, 0, 4500)
        theme.add_hsbk(100, 0.5, 0.3, 3400)

        assert theme.get_next_bounds_checked(0) == ThemeColor(0, 0.5, 0, 4500)
        assert theme.get_next_bounds_checked(1) == ThemeColor(100, 0.5, 0.3, 3400)
        assert theme.get_next_bounds_checked(2) == ThemeColor(100, 0.5, 0.3, 3400)

    it "can return a shuffled version of the theme":
        theme = Theme()
        ordered = []
        for i in range(0, 100, 5):
            theme.add_hsbk(i, 0.3, 0.4, 4500)
            ordered.append(i)

        shuffled = theme.shuffled()

        got = []
        for i in range(0, 20):
            theme[i].hue = i * 5