예제 #1
0
    def test_set_drag_dest(self):
        x, y = self.c.convert_bin_window_to_widget_coords(0, 0)

        # empty model
        self.c.unset_rows_drag_dest()
        self.c.set_drag_dest(x, y)
        path, pos = self.c.get_drag_dest_row()
        self.assertTrue(path is None)

        # filled model but not realized, fall back to last path
        model = _fill_view(self.c)
        self.c.set_drag_dest(x, y)
        path, pos = self.c.get_drag_dest_row()
        self.assertEqual(model[-1].path, path)

        # realized now, so the first path
        with realized(self.c):
            x, y = self.c.convert_bin_window_to_widget_coords(0, 0)

            self.c.unset_rows_drag_dest()
            self.c.set_drag_dest(x, y, into_only=False)
            path, pos = self.c.get_drag_dest_row()
            self.assertEqual(model[0].path, path)
            self.assertEqual(pos, Gtk.TreeViewDropPosition.BEFORE)

            self.c.unset_rows_drag_dest()
            self.c.set_drag_dest(x, y, into_only=True)
            path, pos = self.c.get_drag_dest_row()
            self.assertEqual(model[0].path, path)
            self.assertEqual(pos, Gtk.TreeViewDropPosition.INTO_OR_BEFORE)
 def test_filter_text(self):
     with realized(self.b):
         self.b.filter("foo", ["bar"])
         self.b.filter("(((((##!!!!))),", ["(((((##!!!!))),"])
         if self.b.can_filter_text():
             self.b.filter_text("foo")
             self.b.filter_text("(((((##!!!!))),,,==")
예제 #3
0
 def test_can_filter(self):
     with realized(self.bar):
         self.failUnless(self.bar.can_filter(None))
         self.failUnless(self.bar.can_filter("album"))
         self.failUnless(self.bar.can_filter("foobar"))
         self.failIf(self.bar.can_filter("~#length"))
         self.failIf(self.bar.can_filter("title"))
 def test_can_filter(self):
     with realized(self.bar):
         self.failUnless(self.bar.can_filter(None))
         self.failUnless(self.bar.can_filter("album"))
         self.failUnless(self.bar.can_filter("foobar"))
         self.failIf(self.bar.can_filter("~#length"))
         self.failIf(self.bar.can_filter("title"))
예제 #5
0
    def test_set_drag_dest(self):
        x, y = self.c.convert_bin_window_to_widget_coords(0, 0)

        # empty model
        self.c.unset_rows_drag_dest()
        self.c.set_drag_dest(x, y)
        path, pos = self.c.get_drag_dest_row()
        self.assertTrue(path is None)

        # filled model but not realized, fall back to last path
        model = _fill_view(self.c)
        self.c.set_drag_dest(x, y)
        path, pos = self.c.get_drag_dest_row()
        self.assertEqual(model[-1].path, path)

        # realized now, so the first path
        with realized(self.c):
            x, y = self.c.convert_bin_window_to_widget_coords(0, 0)

            self.c.unset_rows_drag_dest()
            self.c.set_drag_dest(x, y, into_only=False)
            path, pos = self.c.get_drag_dest_row()
            self.assertEqual(model[0].path, path)
            self.assertEqual(pos, Gtk.TreeViewDropPosition.BEFORE)

            self.c.unset_rows_drag_dest()
            self.c.set_drag_dest(x, y, into_only=True)
            path, pos = self.c.get_drag_dest_row()
            self.assertEqual(model[0].path, path)
            self.assertEqual(pos, Gtk.TreeViewDropPosition.INTO_OR_BEFORE)
예제 #6
0
 def test_msic(self):
     with realized(self.b):
         self.b.activate()
         self.b.statusbar(1000)
         self.b.statusbar(1)
         song = AudioFile({"~filename": fsnative(u"/fake")})
         song.sanitize()
         self.b.scroll(song)
예제 #7
0
 def test_active_filter(self):
     with realized(self.bar):
         self.bar.filter("artist", ["piman"])
         self._wait()
         self.failUnless(self.bar.active_filter(self.songs[0]))
         for s in SONGS:
             if s is not self.songs[0]:
                 self.failIf(self.bar.active_filter(s))
예제 #8
0
 def test_msic(self):
     with realized(self.b):
         self.b.activate()
         self.b.statusbar(1000)
         self.b.statusbar(1)
         song = AudioFile({"~filename": fsnative(u"/fake")})
         song.sanitize()
         self.b.scroll(song)
예제 #9
0
 def test_set_text(self):
     with realized(self.bar):
         self.bar.filter_text("artist=piman")
         self._wait()
         self.failUnlessEqual(len(self.songs), 1)
         self.bar.filter_text("")
         self._wait()
         self.failUnlessEqual(set(self.songs), set(SONGS))
예제 #10
0
 def test_get_filter_text(self):
     with realized(self.b):
         if self.b.can_filter_text():
             self.assertEqual(self.b.get_filter_text(), u"")
             self.assertTrue(isinstance(self.b.get_filter_text(), unicode))
             self.b.filter_text(u"foo")
             self.assertEqual(self.b.get_filter_text(), u"foo")
             self.assertTrue(isinstance(self.b.get_filter_text(), unicode))
 def test_set_text(self):
     with realized(self.bar):
         self.bar.filter_text("artist=piman")
         self._wait()
         self.failUnlessEqual(len(self.songs), 1)
         self.bar.filter_text("")
         self._wait()
         self.failUnlessEqual(set(self.songs), set(SONGS))
 def test_active_filter(self):
     with realized(self.bar):
         self.bar.filter("artist", ["piman"])
         self._wait()
         self.failUnless(self.bar.active_filter(self.songs[0]))
         for s in SONGS:
             if s is not self.songs[0]:
                 self.failIf(self.bar.active_filter(s))
예제 #13
0
 def test_filter_text(self):
     with realized(self.b):
         if self.b.can_filter_tag("foo"):
             self.b.filter("foo", ["bar"])
         if self.b.can_filter_tag("(((((##!!!!))),"):
             self.b.filter("(((((##!!!!))),", ["(((((##!!!!))),"])
         if self.b.can_filter_text():
             self.b.filter_text("foo")
             self.b.filter_text("(((((##!!!!))),,,==")
예제 #14
0
 def test_filter_album(self):
     with realized(self.bar):
         self.bar.filter_text("dsagfsag")
         self._wait()
         self.failUnlessEqual(len(self.songs), 0)
         self.bar.filter_text("")
         self._wait()
         self.bar.filter("album", ["one", "three"])
         self._wait()
         self.failUnlessEqual(len(self.songs), 3)
 def test_filter_album(self):
     with realized(self.bar):
         self.bar.filter_text("dsagfsag")
         self._wait()
         self.failUnlessEqual(len(self.songs), 0)
         self.bar.filter_text("")
         self._wait()
         self.bar.filter("album", ["one", "three"])
         self._wait()
         self.failUnlessEqual(len(self.songs), 3)
    def setUp(self):
        config.init()

        library = SongLibrary()
        library.librarian = SongLibrarian()
        AlbumList.init(library)

        for af in SONGS:
            af.sanitize()
        library.add(SONGS)

        self.bar = AlbumList(library, True)

        self._id = self.bar.connect("songs-selected", self._selected)
        self._id2 = self.bar.connect("activated", self._activated)
        with realized(self.bar):
            self.bar.filter_text("")
            self._wait()
        self.songs = []
        self.activated = False
예제 #17
0
    def setUp(self):
        config.init()

        library = SongLibrary()
        library.librarian = SongLibrarian()
        AlbumList.init(library)

        for af in SONGS:
            af.sanitize()
        library.add(SONGS)

        self.bar = AlbumList(library)

        self._id = self.bar.connect("songs-selected", self._selected)
        self._id2 = self.bar.connect("songs-activated", self._activated)
        with realized(self.bar):
            self.bar.filter_text("")
            self._wait()
        self.songs = []
        self.activated = False
예제 #18
0
 def test_filter_albums(self):
     with realized(self.b):
         if self.b.can_filter_albums():
             self.b.filter_albums([])
             self.b.filter_albums([object])
             self.b.filter_albums(self.library.albums.values())
예제 #19
0
 def test_active_filter(self):
     with realized(self.b):
         if self.b.active_filter is not None:
             self.b.active_filter(SONGS[0])
 def test_activated(self):
     with realized(self.bar):
         view = self.bar.view
         view.row_activated(Gtk.TreePath((0, )), view.get_column(0))
         self.failUnless(self.activated)
예제 #21
0
 def test_add_remove_and_show(self):
     with realized(self.pane):
         self.pane.add(SONGS)
     with realized(self.pane):
         self.pane.remove(SONGS)
     self.assertFalse(self.pane.list("arist"))
예제 #22
0
 def test_filter_other(self):
     with realized(self.b):
         self.b.unfilter()
예제 #23
0
 def test_activated(self):
     with realized(self.bar):
         view = self.bar.view
         view.row_activated(Gtk.TreePath((0,)), view.get_column(0))
         self.failUnless(self.activated)
예제 #24
0
 def test_filter_albums(self):
     with realized(self.b):
         if self.b.can_filter_albums():
             self.b.filter_albums([])
             self.b.filter_albums([object])
             self.b.filter_albums(self.library.albums.values())
예제 #25
0
 def test_filters_caps(self):
     with realized(self.b):
         self.failUnless(isinstance(self.b.can_filter_tag("foo"), bool))
         self.failUnless(isinstance(self.b.can_filter_text(), bool))
         self.failUnless(isinstance(self.b.can_filter("foo"), bool))
예제 #26
0
 def test_filter_artist(self):
     with realized(self.bar):
         self.bar.filter("artist", ["piman"])
         self._wait()
         self.failUnlessEqual(len(self.songs), 1)
         self.failUnlessEqual(self.songs[0]("artist"), "piman")
예제 #27
0
 def test_filters_caps(self):
     with realized(self.b):
         self.failUnless(isinstance(self.b.can_filter_tag("foo"), bool))
         self.failUnless(isinstance(self.b.can_filter_text(), bool))
         self.failUnless(isinstance(self.b.can_filter("foo"), bool))
 def test_filter_artist(self):
     with realized(self.bar):
         self.bar.filter("artist", ["piman"])
         self._wait()
         self.failUnlessEqual(len(self.songs), 1)
         self.failUnlessEqual(self.songs[0]("artist"), "piman")
예제 #29
0
 def test_filter_other(self):
     with realized(self.b):
         self.b.unfilter()
예제 #30
0
 def test_add_remove_and_show(self):
     with realized(self.pane):
         self.pane.add(SONGS)
     with realized(self.pane):
         self.pane.remove(SONGS)
     self.assertFalse(self.pane.list("arist"))