~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ui.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-14 11:09:39 UTC
  • mfrom: (5422.1.5 cleanup)
  • Revision ID: pqm@pqm.ubuntu.com-20100914110939-hvk7xfh39y9hq76a
(mbp) split out ProgressRecordingUIFactory (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    test_progress,
40
40
    )
41
41
from bzrlib.ui import text as _mod_ui_text
 
42
from bzrlib.tests.testui import (
 
43
    ProgressRecordingUIFactory,
 
44
    )
42
45
 
43
46
 
44
47
class TestUIConfiguration(tests.TestCaseWithTransport):
432
435
        self.assertIsNone('0', av)
433
436
        self.assertIsNone('on', av)
434
437
        self.assertIsNone('off', av)
 
438
 
 
439
 
 
440
class TestProgressRecordingUI(tests.TestCase):
 
441
    """Test test-oriented UIFactory that records progress updates"""
 
442
 
 
443
    def test_nested_ignore_depth_beyond_one(self):
 
444
        # we only want to capture the first level out progress, not
 
445
        # want sub-components might do. So we have nested bars ignored.
 
446
        factory = ProgressRecordingUIFactory()
 
447
        pb1 = factory.nested_progress_bar()
 
448
        pb1.update('foo', 0, 1)
 
449
        pb2 = factory.nested_progress_bar()
 
450
        pb2.update('foo', 0, 1)
 
451
        pb2.finished()
 
452
        pb1.finished()
 
453
        self.assertEqual([("update", 0, 1, 'foo')], factory._calls)