Exemplo n.º 1
0
def test_reset_shouldGoToFirstItemOfMainFolder():
    menu = Menu(mainFolder)
    menu.moveBy(1).select().moveBy(1).select()
    menu.reset()
    assert menu.folder() is mainFolder
    assert menu.item() is folder1
    assert len(menu._menuStack) == 0
Exemplo n.º 2
0
def test_back_shouldGoToLastElementIfParentItemListWasShortended_withBackItem():
    subFolders = [Folder("a", []), Folder("b", []), Folder("c", [])]
    folder = Folder("", subFolders)
    menu = Menu(folder)
    menu.moveBy(-1).select()
    subFolders.pop()
    menu.back()
    assert menu.item() is menu._backItem
Exemplo n.º 3
0
def test_back_multiLevel():
    menu = Menu(mainFolder)
    menu.moveBy(1).select().moveBy(1).select()
    menu.back()
    assert menu.folder() is folder2
    assert menu.item() is folder2b
    menu.back()
    assert menu.folder() is mainFolder
    assert menu.item() is folder2
Exemplo n.º 4
0
def test_moveBy3_withBackItem():
    menu = Menu(mainFolder)
    menu.moveBy(3)
    assert menu.item() is menu._backItem
Exemplo n.º 5
0
def test_moveBy1_withBackItem():
    menu = Menu(mainFolder)
    menu.moveBy(1)
    assert menu.item() is folder2
Exemplo n.º 6
0
def test_moveBy0_withBackItem_shouldDoNothing():
    menu = Menu(mainFolder)
    menu.moveBy(0)
    assert menu.item() is folder1
Exemplo n.º 7
0
def test_moveDoesNotChangeTheFolder():
    menu = Menu(mainFolder)
    menu.moveBy(1)
    assert menu.folder() is mainFolder
    assert menu.isRoot() is True
Exemplo n.º 8
0
def test_moveByMinus1_withoutBackItem():
    menu = Menu(mainFolder, showBackItem=False)
    menu.moveBy(-1)
    assert menu.item() is folder3
Exemplo n.º 9
0
def test_select_shouldOpenFolderAndShowItsFirstEntry():
    menu = Menu(mainFolder)
    menu.moveBy(1)
    menu.select()
    assert menu.folder() is folder2
    assert menu.item() is folder2a
Exemplo n.º 10
0
def test_moveByMinus2_withBackItem():
    menu = Menu(mainFolder)
    menu.moveBy(-2)
    assert menu.item() is folder3
Exemplo n.º 11
0
def test_moveBy0_shouldDoNothing():
    menu = Menu(mainFolder, showBackItem=False)
    menu.moveBy(0)
    assert menu.item() is folder1
Exemplo n.º 12
0
def test_back_shouldRememberIndex():
    menu = Menu(mainFolder)
    menu.moveBy(1)
    menu.select()
    menu.back()
    assert menu.item() is folder2
Exemplo n.º 13
0
def test_select_multiLevel():
    menu = Menu(mainFolder)
    menu.moveBy(1).select().moveBy(1).select()
    assert menu.folder() is folder2b
Exemplo n.º 14
0
def test_moveBy_overflow_withBackItem():
    menu = Menu(mainFolder)
    menu.moveBy(4)
    assert menu.item() is folder1
Exemplo n.º 15
0
def test_moveBy2():
    menu = Menu(mainFolder, showBackItem=False)
    menu.moveBy(2)
    assert menu.item() is folder3
Exemplo n.º 16
0
def test_moveByMinus1_withBackItem():
    menu = Menu(mainFolder)
    menu.moveBy(-1)
    assert menu.item() is menu._backItem
Exemplo n.º 17
0
def test_moveBy_overflow_withoutBackItem():
    menu = Menu(mainFolder, showBackItem=False)
    menu.moveBy(4)
    assert menu.item() is folder2
Exemplo n.º 18
0
def test_moveBy1_shouldNotFailForEmptyFolder():
    menu = Menu(emptyFolder, showBackItem=False)
    menu.moveBy(1)
    assert menu.item() is menu._emptyItem
Exemplo n.º 19
0
def test_moveByMinus1_withBackItem_shouldNotFailForEmptyFolder():
    menu = Menu(emptyFolder)
    menu.moveBy(-1)
    assert menu.item() is menu._backItem