diff options
Diffstat (limited to 'tests/test_gio.py')
-rw-r--r-- | tests/test_gio.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py index 930d8fb..ad186fe 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -295,6 +295,28 @@ class TestFile(unittest.TestCase): finally: os.unlink("copy.txt") + # See bug 546591. + def test_copy_progress(self): + source = gio.File('file.txt') + destination = gio.File('copy.txt') + + def progress(current, total): + self.assert_(isinstance(current, long)) + self.assert_(isinstance(total, long)) + self.assert_(0 <= current <= total) + + try: + retval = source.copy(destination, + flags=gio.FILE_COPY_OVERWRITE, + progress_callback=progress) + self.failUnless(retval) + + self.failUnless(os.path.exists('copy.txt')) + self.assertEqual(open('file.txt').read(), + open('copy.txt').read()) + finally: + os.unlink("copy.txt") + def testMove(self): if os.path.exists('move.txt'): os.unlink("move.txt") |