예제 #1
0
파일: test_tree.py 프로젝트: nbbull/RIDE
class _BaseSuiteTreeTest(unittest.TestCase):
    def setUp(self):
        frame = _FakeMainFrame(None)
        self._model = self._create_model()
        self._tree = Tree(frame, ActionRegisterer(MenuBar(frame), ToolBar(frame), ShortcutRegistry(frame)))
        images = TreeImageList()
        self._tree._images = images
        self._tree.SetImageList(images)
        self._tree.populate(self._model)
        self._expand_all()

    def tearDown(self):
        PUBLISHER.unsubscribe_all()

    def _create_model(self):
        suite = self._create_directory_suite("/top_suite")
        suite.children = [self._create_file_suite("sub_suite_%d.txt" % i) for i in range(3)]
        res = ResourceFile()
        res.source = "resource.txt"
        res.keyword_table.keywords.append(UserKeyword(res, "Resource Keyword"))
        model = ChiefController(Namespace(FakeSettings()))
        model._controller = TestDataDirectoryController(suite)
        rfc = ResourceFileController(res)
        model.resources.append(rfc)
        model._insert_into_suite_structure(rfc)
        return model

    def _create_directory_suite(self, source):
        return self._create_suite(TestDataDirectory, source, is_dir=True)

    def _create_file_suite(self, source):
        suite = self._create_suite(TestCaseFile, source)
        suite.testcase_table.tests = [TestCase(suite, "%s Fake Test %d" % (suite.name, i)) for i in range(5)]
        return suite

    def _create_suite(self, suite_class, source, is_dir=False):
        suite = suite_class()
        suite.source = source
        if is_dir:
            suite.directory = source
        suite.keyword_table.keywords = [
            UserKeyword(suite.keyword_table, "%s Fake UK %d" % (suite.name, i)) for i in range(5)
        ]
        return suite

    def _expand_all(self):
        for node in self._tree._datafile_nodes[1:]:
            self._tree._expand_and_render_children(node)

    def _get_selected_label(self):
        return self._tree.GetItemText(self._tree.GetSelection())

    def _get_node(self, label):
        node = self._tree._controller.find_node_with_label(self._tree._root, label)
        return node or self._tree._controller.find_node_with_label(self._tree._root, "*" + label)

    def _select_node(self, label):
        self._tree.SelectItem(self._get_node(label))
예제 #2
0
 def setUp(self):
     frame = _FakeMainFrame(None)
     self._model = self._create_model()
     self._tree = Tree(frame, ActionRegisterer(
         MenuBar(frame), ToolBar(frame), ShortcutRegistry(frame)))
     images = TreeImageList()
     self._tree._images = images
     self._tree.SetImageList(images)
     self._tree.populate(self._model)
     self._expand_all()
예제 #3
0
 def setUp(self):
     # frame = _FakeMainFrame()
     settings = FakeSettings()
     self.app = wx.App()
     self.frame = wx.Frame(None)
     self.frame.tree = Tree(
         self.frame,
         ActionRegisterer(AuiManager(self.frame), MenuBar(self.frame),
                          ToolBar(self.frame),
                          ShortcutRegistry(self.frame)), settings)
     self.frame.Show()
     self._tags_list = utils.NormalizedDict()
     self._tags_list = {
         "tag-11": [1, 2],
         "tag-02": [3],
         "tag-12": [4, 8, 12],
         "tag-2": [5, 6, 7],
         "tag-3": [9],
         "tag-21": [10, 11, 12],
         "tag-22": [10],
         "tag-1": [14],
         "tag-03": [15],
         "a-01-a2": [1],
         "08-b": [2],
         "3-2-1-tag-2c": [3, 6, 8],
         "8-B-1": [3, 4, 5],
         "2-b": [7, 3],
         "a-1-a3": [8, 9, 10, 11],
         "3-2-03-tag-2a": [12],
         "a-01-a03": [1],
         "b-1-a01": [2],
         "b-01-a01": [15]
     }
     self.model = self._create_model()
     self._tagsdialog = _ViewAllTagsDialog(self.frame, self.model)
예제 #4
0
파일: test_tree.py 프로젝트: nbbull/RIDE
 def setUp(self):
     frame = _FakeMainFrame(None)
     self._model = self._create_model()
     self._tree = Tree(frame, ActionRegisterer(MenuBar(frame), ToolBar(frame), ShortcutRegistry(frame)))
     images = TreeImageList()
     self._tree._images = images
     self._tree.SetImageList(images)
     self._tree.populate(self._model)
     self._expand_all()
예제 #5
0
class _BaseSuiteTreeTest(unittest.TestCase):

    def setUp(self):
        frame = _FakeMainFrame(None)
        self._model = self._create_model()
        self._tree = Tree(frame, ActionRegisterer(
            MenuBar(frame), ToolBar(frame), ShortcutRegistry(frame)))
        images = TreeImageList()
        self._tree._images = images
        self._tree.SetImageList(images)
        self._tree.populate(self._model)
        self._expand_all()

    def tearDown(self):
        PUBLISHER.unsubscribe_all()

    def _create_model(self):
        suite = self._create_directory_suite('/top_suite')
        suite.children = [self._create_file_suite('sub_suite_%d.txt' % i)
                          for i in range(3)]
        res = ResourceFile()
        res.source = 'resource.txt'
        res.keyword_table.keywords.append(UserKeyword(res, 'Resource Keyword'))
        library_manager = LibraryManager(':memory:')
        library_manager.create_database()
        model = Project(
            Namespace(FakeSettings()), library_manager=library_manager)
        model._controller = TestDataDirectoryController(suite)
        rfc = ResourceFileController(res, project=model)
        model.resources.append(rfc)
        model.insert_into_suite_structure(rfc)
        return model

    def _create_directory_suite(self, source):
        return self._create_suite(TestDataDirectory, source, is_dir=True)

    def _create_file_suite(self, source):
        suite = self._create_suite(TestCaseFile, source)
        suite.testcase_table.tests = [TestCase(
            suite, '%s Fake Test %d' % (suite.name, i)) for i in range(5)]
        return suite

    def _create_suite(self, suite_class, source, is_dir=False):
        suite = suite_class()
        suite.source = source
        if is_dir:
            suite.directory = source
        suite.keyword_table.keywords = [
            UserKeyword(suite.keyword_table, '%s Fake UK %d' % (suite.name, i))
            for i in range(5)]
        return suite

    def _expand_all(self):
        for node in self._tree._datafile_nodes[1:]:
            self._tree._expand_and_render_children(node)

    def _get_selected_label(self):
        return self._tree.GetItemText(self._tree.GetSelection())

    def _get_node(self, label):
        node = self._tree._controller.find_node_with_label(
            self._tree._root, label)
        return node or self._tree._controller.find_node_with_label(
            self._tree._root, '*' + label)

    def _select_node(self, label):
        self._tree.SelectItem(self._get_node(label))