~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_progress.py

  • Committer: Andrew Bennetts
  • Date: 2010-01-15 03:58:20 UTC
  • mfrom: (4963 +trunk)
  • mto: (4973.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4975.
  • Revision ID: andrew.bennetts@canonical.com-20100115035820-ilb3t36swgzq6v1l
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
        task.total_cnt = total
71
71
        return task
72
72
 
 
73
    def test_render_progress_no_bar(self):
 
74
        """The default view now has a spinner but no bar."""
 
75
        out, view = self.make_view()
 
76
        # view.enable_bar = False
 
77
        task = self.make_task(None, view, 'reticulating splines', 5, 20)
 
78
        view.show_progress(task)
 
79
        self.assertEqual(
 
80
'\r/ reticulating splines 5/20                                                    \r'
 
81
            , out.getvalue())
 
82
 
73
83
    def test_render_progress_easy(self):
74
84
        """Just one task and one quarter done"""
75
85
        out, view = self.make_view()
 
86
        view.enable_bar = True
76
87
        task = self.make_task(None, view, 'reticulating splines', 5, 20)
77
88
        view.show_progress(task)
78
89
        self.assertEqual(
85
96
        task = self.make_task(None, view, 'reticulating splines', 0, 2)
86
97
        task2 = self.make_task(task, view, 'stage2', 1, 2)
87
98
        view.show_progress(task2)
 
99
        view.enable_bar = True
88
100
        # so we're in the first half of the main task, and half way through
89
101
        # that
90
102
        self.assertEqual(
100
112
    def test_render_progress_sub_nested(self):
101
113
        """Intermediate tasks don't mess up calculation."""
102
114
        out, view = self.make_view()
 
115
        view.enable_bar = True
103
116
        task_a = ProgressTask(None, progress_view=view)
104
117
        task_a.update('a', 0, 2)
105
118
        task_b = ProgressTask(task_a, progress_view=view)