コード例 #1
0
 def test_initial(self):
     for path in ["/", "/home", os.environ["HOME"], "/usr/bin"]:
         dirlist = DirectoryTree(path)
         model, rows = dirlist.get_selection().get_selected_rows()
         selected = [model[row][0] for row in rows]
         dirlist.destroy()
         self.failUnlessEqual([path], selected)
コード例 #2
0
 def test_bad_initial(self):
     for path in ["/", os.environ["HOME"]]:
         newpath = os.path.join(path, "bin/file/does/not/exist")
         dirlist = DirectoryTree(newpath)
         model, rows = dirlist.get_selection().get_selected_rows()
         selected = [model[row][0] for row in rows]
         dirlist.destroy()
         self.failUnlessEqual([path], selected)
コード例 #3
0
 def test_bad_initial(self):
     invalid = os.path.join("bin", "file", "does", "not", "exist")
     for path in self.ROOTS:
         newpath = os.path.join(path, invalid)
         dirlist = DirectoryTree(newpath, folders=self.ROOTS)
         selected = dirlist.get_selected_paths()
         dirlist.destroy()
         # select the last valid parent directory
         self.assertEqual(len(selected), 1)
         self.assertTrue(selected[0].startswith(path))
コード例 #4
0
 def test_bad_initial(self):
     invalid = os.path.join("bin", "file", "does", "not", "exist")
     for path in self.ROOTS:
         newpath = os.path.join(path, invalid)
         dirlist = DirectoryTree(newpath, folders=self.ROOTS)
         selected = dirlist.get_selected_paths()
         dirlist.destroy()
         # select the last valid parent directory
         self.assertEqual(len(selected), 1)
         self.assertTrue(selected[0].startswith(path))
コード例 #5
0
ファイル: test_qltk_filesel.py プロジェクト: qwence/quodlibet
    def test_initial(self):
        paths = ["/", get_home_dir(), "/usr/bin"]
        if os.name == "nt":
            paths = [u"C:\\", get_home_dir()]

        for path in paths:
            dirlist = DirectoryTree(path, folders=self.ROOTS)
            model, rows = dirlist.get_selection().get_selected_rows()
            selected = [model[row][0] for row in rows]
            dirlist.destroy()
            self.failUnlessEqual([path], selected)
コード例 #6
0
    def test_initial(self):
        paths = ["/", get_home_dir(), "/usr/bin"]
        if os.name == "nt":
            paths = [u"C:\\", get_home_dir()]

        for path in paths:
            dirlist = DirectoryTree(path, folders=self.ROOTS)
            model, rows = dirlist.get_selection().get_selected_rows()
            selected = [model[row][0] for row in rows]
            dirlist.destroy()
            self.failUnlessEqual([path], selected)
コード例 #7
0
    def test_initial(self):
        if os.name == "nt":
            paths = [u"C:\\", get_home_dir()]
        else:
            paths = ["/", get_home_dir(), sys.prefix]

        for path in paths:
            dirlist = DirectoryTree(path, folders=self.ROOTS)
            model, rows = dirlist.get_selection().get_selected_rows()
            selected = [model[row][0] for row in rows]
            dirlist.destroy()
            self.failUnlessEqual([os.path.normpath(path)], selected)
コード例 #8
0
 def test_bad_go_to(self):
     newpath = fsnative(u"/woooooo/bar/fun/broken")
     dirlist = DirectoryTree(fsnative(u"/"), folders=self.ROOTS)
     dirlist.go_to(newpath)
     dirlist.destroy()
コード例 #9
0
 def test_bad_go_to(self):
     newpath = fsnative(u"/woooooo/bar/fun/broken")
     dirlist = DirectoryTree(fsnative(u"/"), folders=self.ROOTS)
     dirlist.go_to(newpath)
     dirlist.destroy()
コード例 #10
0
 def test_bad_go_to(self):
     newpath = "/woooooo/bar/fun/broken"
     dirlist = DirectoryTree("/")
     dirlist.go_to(newpath)
     dirlist.destroy()
コード例 #11
0
 def test_bad_go_to(self):
     newpath = "/woooooo/bar/fun/broken"
     dirlist = DirectoryTree("/", folders=self.ROOTS)
     dirlist.go_to(newpath)
     dirlist.destroy()