예제 #1
0
def test_ChangeIndentationController_save_options():
    m = Mocker()
    tv = m.mock(TextView)
    dv = tv.doc_view >> m.mock(TextDocumentView)
    with m.order():
        mode = dv.indent_mode >> "<indent mode>"
        size = dv.indent_size >> "<indent size>"
    with m:
        ctl = ChangeIndentationController(tv)
        ctl.save_options()
예제 #2
0
def test_ChangeIndentationController_execute_():
    m = Mocker()
    tv = m.mock(TextView)
    dv = m.mock(TextDocumentView)
    (tv.doc_view << dv).count(2)
    mode = dv.indent_mode >> "m"
    size = dv.indent_size >> "s"
    dv.change_indentation("m", "s", "m", "s", True)
    m.method(ChangeIndentationController.save_options)()
    m.method(ChangeIndentationController.cancel_)(None)
    with m:
        ctl = ChangeIndentationController(tv)
        ctl.execute_(None)
예제 #3
0
def test_ChangeIndentationController_load_options():
    m = Mocker()
    tv = m.mock(TextView)
    dv = tv.doc_view >> m.mock(TextDocumentView)
    mode = dv.indent_mode >> "<indent mode>"
    size = dv.indent_size >> "<indent size>"
    with m:
        ctl = ChangeIndentationController(tv) # calls load_options()
        opts = ctl.options
        eq_(opts.from_mode, mode)
        eq_(opts.from_size, size)
        eq_(opts.to_mode, mode)
        eq_(opts.to_size, size)