Ejemplo n.º 1
0
    def test_promote_selection_with_default(self):
        choices = ['one', 'two', 'SeriesDescription']
        selector = FieldSelector(self.frame, choices=choices)

        selector.selected.SetItems(choices)

        # Try to promote the default
        selector.selected.SetStringSelection(choices[2])
        selector.PromoteSelection()

        # The ordering remained unchanged
        assert selector.selected.GetStrings() == choices
Ejemplo n.º 2
0
    def test_promote_selection(self):
        choices = ['one', 'two', 'three']
        selector = FieldSelector(self.frame, choices=choices)

        selector.selected.SetItems(choices)

        # Promote the last one
        selector.selected.SetStringSelection(choices[2])
        selector.PromoteSelection()

        assert selector.selected.GetStrings() == ['one', 'three', 'two']

        # Promote again
        selector.PromoteSelection()

        assert selector.selected.GetStrings() == ['three', 'one', 'two']

        # Try to Promote again
        selector.PromoteSelection()

        assert selector.selected.GetStrings() == ['three', 'one', 'two']