Exemple #1
0
    def testBlockComments(self):
        b = BlockInfo(None, "/Foo", True, "")
        c = "some comments"
        e = BlockEditor(b, self.tree.app_info.type_to_block_map)
        self.checkWidget(e)
        self.assertEqual(b.comments, "")
        e.comment_edit.setComments(c)
        self.checkWidget(e, apply_enabled=True, reset_enabled=True, comments=c)
        # This should get updated after apply is pressed
        self.assertEqual(b.comments, "")
        e.applyChanges()
        self.assertEqual(b.comments, c)
        self.checkWidget(e, comments=c)

        e.resetChanges()
        self.checkWidget(e, comments=c)

        e.comment_edit.setComments("")
        self.checkWidget(e,
                         apply_enabled=True,
                         reset_enabled=True,
                         comments="")
        self.assertEqual(b.comments, c)
        e.resetChanges()
        self.checkWidget(e, comments=c)
        self.assertEqual(b.comments, c)
 def newWidget(self, path):
     b = self.tree.getBlockInfo(path)
     e = BlockEditor(b, self.tree.app_info.type_to_block_map)
     e.needBlockList.connect(lambda paths: self.needBlockList(e, paths))
     e.removeBlock.connect(self.removeBlock)
     e.cloneBlock.connect(self.cloneBlock)
     e.blockChanged.connect(self.blockChanged)
     e.editingFinished.connect(self.editingFinished)
     self.editing_finished = False
     return e
    def testUserParams(self):
        b = BlockInfo(None, "/Foo", True, "")
        e = BlockEditor(b, self.tree.app_info.type_to_block_map)
        self.checkWidget(e)
        self.assertEqual(len(b.parameters_list), 0)
        e.addUserParamPressed()
        self.checkWidget(e, apply_enabled=True, reset_enabled=True)
        self.assertEqual(len(b.parameters_list), 0)

        e.applyChanges()
        self.checkWidget(e)
        self.assertEqual(len(b.parameters_list), 1)

        e.addUserParamPressed()
        self.checkWidget(e, apply_enabled=True, reset_enabled=True)
        self.assertEqual(len(b.parameters_list), 1)

        e.resetChanges()
        self.checkWidget(e)
        self.assertEqual(len(b.parameters_list), 1)
    def testBlockComments(self):
        b = BlockInfo(None, "/Foo", True, "")
        c = "some comments"
        e = BlockEditor(b, self.tree.app_info.type_to_block_map)
        self.checkWidget(e)
        self.assertEqual(b.comments, "")
        e.comment_edit.setComments(c)
        self.checkWidget(e, apply_enabled=True, reset_enabled=True, comments=c)
        # This should get updated after apply is pressed
        self.assertEqual(b.comments, "")
        e.applyChanges()
        self.assertEqual(b.comments, c)
        self.checkWidget(e, comments=c)

        e.resetChanges()
        self.checkWidget(e, comments=c)

        e.comment_edit.setComments("")
        self.checkWidget(e, apply_enabled=True, reset_enabled=True, comments="")
        self.assertEqual(b.comments, c)
        e.resetChanges()
        self.checkWidget(e, comments=c)
        self.assertEqual(b.comments, c)