예제 #1
0
파일: test_util.py 프로젝트: khairy/editxt
def test_recent_items_queue_remove():
    ris = RecentItemStack(4)
    ris.push(1)
    ris.push(2)
    eq_(list(ris), [1, 2])
    ris.discard(1)
    eq_(list(ris), [2])
예제 #2
0
파일: test_util.py 프로젝트: khairy/editxt
def test_recent_items_queue_reset():
    items = list(range(10))
    ris = RecentItemStack(4)
    ris.reset(items)
    eq_(len(ris), 4)
    eq_(list(ris), items[-4:])
    ris.reset()
    eq_(len(ris), 0)
예제 #3
0
 def __init__(self, app, window_controller, state=None):
     self.app = app
     self._current_view = None
     self.wc = window_controller
     self.state = state
     self.command = CommandBar(self, app.text_commander)
     self.projects = KVOList.alloc().init()
     self.recent = self._suspended_recent = RecentItemStack(20)
     self.window_settings_loaded = False
예제 #4
0
파일: test_util.py 프로젝트: khairy/editxt
def test_recent_items_queue_update_and_pop():
    ris = RecentItemStack(4)
    items = [8, 2, 6, 4, 5, 7]
    for item in items:
        ris.push(item)
    eq_(len(ris), 4)
    for item in reversed(items[-4:]):
        eq_(ris.pop(), item)
    eq_(len(ris), 0)
예제 #5
0
파일: test_util.py 프로젝트: khairy/editxt
def test_recent_items_queue_push_existing():
    ris = RecentItemStack(4)
    ris.push(1)
    ris.push(2)
    ris.push(3)
    eq_(list(ris), [1, 2, 3])
    ris.push(1)
    eq_(list(ris), [2, 3, 1])
    ris.push(3)
    eq_(list(ris), [2, 1, 3])
예제 #6
0
 def suspend_recent_updates(self):
     self.recent = RecentItemStack(20)
예제 #7
0
파일: test_util.py 프로젝트: khairy/editxt
def test_recent_items_size_zero():
    ris = RecentItemStack(0)
    eq_(list(ris), [])
    ris.push(1)
    eq_(list(ris), [])
    eq_(ris.pop(), None)
예제 #8
0
파일: test_util.py 프로젝트: khairy/editxt
def test_recent_items_pop_empty():
    ris = RecentItemStack(4)
    eq_(len(ris), 0)
    assert ris.pop() is None
예제 #9
0
파일: test_util.py 프로젝트: khairy/editxt
def test_recent_items_queue_size():
    ris = RecentItemStack(20)
    eq_(len(ris), 0)
    eq_(ris.max_size, 20)