~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ui.py

  • Committer: Martin Pool
  • Date: 2010-09-15 10:40:51 UTC
  • mfrom: (5425 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5426.
  • Revision ID: mbp@sourcefrog.net-20100915104051-pkjmuc2bc27buysp
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    test_progress,
41
41
    )
42
42
from bzrlib.ui import text as _mod_ui_text
 
43
from bzrlib.tests.testui import (
 
44
    ProgressRecordingUIFactory,
 
45
    )
43
46
 
44
47
 
45
48
class TestUIConfiguration(tests.TestCaseWithTransport):
476
479
        self.assertThat(repr(wrapper),
477
480
            Equals("ConfirmationUserInterfacePolicy("
478
481
                "NoninteractiveUIFactory(), True, {'a': 2})"))
 
482
 
 
483
 
 
484
class TestProgressRecordingUI(tests.TestCase):
 
485
    """Test test-oriented UIFactory that records progress updates"""
 
486
 
 
487
    def test_nested_ignore_depth_beyond_one(self):
 
488
        # we only want to capture the first level out progress, not
 
489
        # want sub-components might do. So we have nested bars ignored.
 
490
        factory = ProgressRecordingUIFactory()
 
491
        pb1 = factory.nested_progress_bar()
 
492
        pb1.update('foo', 0, 1)
 
493
        pb2 = factory.nested_progress_bar()
 
494
        pb2.update('foo', 0, 1)
 
495
        pb2.finished()
 
496
        pb1.finished()
 
497
        self.assertEqual([("update", 0, 1, 'foo')], factory._calls)