Beispiel #1
0
    def testPrevNextSelection(self):
        b1 = Mock(spec=Buffer)
        b2 = Mock(spec=Buffer)
        b3 = Mock(spec=Buffer)
        blist = BufferList()

        blist.replaceAndSelect(blist.current, b1)
        blist.add(b2)
        blist.add(b3)

        blist.select(b2)
        self.assertEqual(blist.selectNext(), b3)

        blist.select(b2)
        self.assertEqual(blist.selectPrev(), b1)

        blist.select(b3)
        self.assertEqual(blist.selectNext(), b1)

        blist.select(b3)
        self.assertEqual(blist.selectPrev(), b2)

        blist.select(b1)
        self.assertEqual(blist.selectNext(), b2)

        blist.select(b1)
        self.assertEqual(blist.selectPrev(), b3)
Beispiel #2
0
    def testPrevNextSelection(self):
        b1 = Mock(spec=Buffer)
        b2 = Mock(spec=Buffer)
        b3 = Mock(spec=Buffer)
        blist = BufferList()

        blist.replaceAndSelect(blist.current, b1)
        blist.add(b2)
        blist.add(b3)

        blist.select(b2)
        self.assertEqual(blist.selectNext(), b3)

        blist.select(b2)
        self.assertEqual(blist.selectPrev(), b1)

        blist.select(b3)
        self.assertEqual(blist.selectNext(), b1)

        blist.select(b3)
        self.assertEqual(blist.selectPrev(), b2)

        blist.select(b1)
        self.assertEqual(blist.selectNext(), b2)

        blist.select(b1)
        self.assertEqual(blist.selectPrev(), b3)
Beispiel #3
0
    def testReplaceAndSelect(self):
        b1 = Mock(spec=Buffer)
        b2 = Mock(spec=Buffer)
        b3 = Mock(spec=Buffer)
        blist = BufferList()

        blist.add(b1)
        blist.add(b2)
        self.assertIsNotNone(blist.current)

        self.assertEqual(blist.replaceAndSelect(b2, b3), b3)
        self.assertEqual(blist.current, b3)

        self.assertNotIn(b2, blist.buffers)
Beispiel #4
0
    def testReplaceAndSelect(self):
        b1 = Mock(spec=Buffer)
        b2 = Mock(spec=Buffer)
        b3 = Mock(spec=Buffer)
        blist = BufferList()

        blist.add(b1)
        blist.add(b2)
        self.assertIsNotNone(blist.current)

        self.assertEqual(blist.replaceAndSelect(b2, b3), b3)
        self.assertEqual(blist.current, b3)

        self.assertNotIn(b2, blist.buffers)