Ignore:
Timestamp:
10/11/12 20:11:24 (18 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixed scheme's annotation signal signatures and added tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/scheme/tests/test_scheme.py

    r11101 r11111  
    1111 
    1212 
    13 class TestScheme(test.QAppTestCase): 
     13class TestScheme(test.QCoreAppTestCase): 
    1414    def test_scheme(self): 
    1515        import Orange 
     
    2828        nodes_added = [] 
    2929        links_added = [] 
     30        annotations_added = [] 
    3031 
    3132        scheme.node_added.connect(nodes_added.append) 
     33        scheme.node_removed.connect(nodes_added.remove) 
     34 
    3235        scheme.link_added.connect(links_added.append) 
    3336        scheme.link_removed.connect(links_added.remove) 
     37 
     38        scheme.annotation_added.connect(annotations_added.append) 
     39        scheme.annotation_removed.connect(annotations_added.remove) 
    3440 
    3541        w1 = scheme.new_node(file_desc) 
     
    8187        self.assertRaises(ValueError, scheme.new_link, 
    8288                          w2, "Data", w1, "Data") 
     89 
     90        text_annot = SchemeTextAnnotation((0, 0, 100, 20), "Text") 
     91        scheme.add_annotation(text_annot) 
     92        self.assertSequenceEqual(annotations_added, [text_annot]) 
     93        self.assertSequenceEqual(scheme.annotations, annotations_added) 
     94 
     95        arrow_annot = SchemeTextAnnotation((0, 100), (100, 100)) 
     96        scheme.add_annotation(arrow_annot) 
     97        self.assertSequenceEqual(annotations_added, [text_annot, arrow_annot]) 
     98        self.assertSequenceEqual(scheme.annotations, annotations_added) 
     99 
     100        scheme.remove_annotation(text_annot) 
     101        self.assertSequenceEqual(annotations_added, [arrow_annot]) 
     102        self.assertSequenceEqual(scheme.annotations, annotations_added) 
     103 
Note: See TracChangeset for help on using the changeset viewer.