~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_progress.py

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2009 Canonical Ltd
 
1
# Copyright (C) 2006-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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)