Esempio n. 1
0
    def test_select_item_with_default(self):
        choices = ['PatientName', 'PatientID', 'SeriesDescription']
        selector = FieldSelector(self.frame, choices=choices)

        # Make sure we start with an empty list
        assert selector.selected.GetCount() == 0

        # Select the "default" SeriesDescription
        selector.options.SetSelection(2)

        # Trigger the SelectItem callback
        selector.SelectItem()

        assert selector.selected.GetStrings() == ['SeriesDescription']

        # Select another field
        selector.options.SetSelection(0)

        # Trigger the SelectItem callback
        selector.SelectItem()

        # SeriesDescription should remain at the bottom
        assert selector.selected.GetStrings() == ['PatientName', 'SeriesDescription']

        # Select another field
        selector.options.SetSelection(1)

        # Trigger the SelectItem callback
        selector.SelectItem()

        # SeriesDescription should remain at the bottom
        assert selector.selected.GetStrings() == ['PatientName', 'PatientID', 'SeriesDescription']
Esempio n. 2
0
    def test_select_item(self):
        choices = ['PatientName', 'PatientID', 'SeriesDescription']
        selector = FieldSelector(self.frame, choices=choices)

        # Make sure we start with an empty list
        assert selector.selected.GetCount() == 0

        # Select the item in the options
        selector.options.SetSelection(0)

        # Trigger the SelectItem callback
        selector.SelectItem()

        # Make sure that it added this item to the selected list
        items = selector.selected.GetStrings()

        assert items == ['PatientName']

        # Select another item in the options
        selector.options.SetSelection(1)

        # Trigger the SelectItem callback
        selector.SelectItem()

        # Make sure that it added this item to the selected list
        items = selector.selected.GetStrings()

        assert items == ['PatientName', 'PatientID']