Exemple #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.create_with_textview(tv)
        ctl.save_options()
Exemple #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.create_with_textview(tv)
        ctl.execute_(None)
Exemple #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.create_with_textview(tv) # calls load_options()
        opts = ctl.opts
        eq_(opts.from_mode, mode)
        eq_(opts.from_size, size)
        eq_(opts.to_mode, mode)
        eq_(opts.to_size, size)
Exemple #4
0
    def execute(self, textview, sender):
        from editxt.changeindent import ChangeIndentationController

        ctl = ChangeIndentationController.create_with_textview(textview)
        ctl.begin_sheet(sender)