testinggtk r420 - trunk/tests/gdk
- From: bjornl svn gnome org
- To: svn-commits-list gnome org
- Subject: testinggtk r420 - trunk/tests/gdk
- Date: Mon, 8 Sep 2008 15:49:22 +0000 (UTC)
Author: bjornl
Date: Mon Sep 8 15:49:22 2008
New Revision: 420
URL: http://svn.gnome.org/viewvc/testinggtk?rev=420&view=rev
Log:
Add 3 tests for the gdk.PixbufAnimation class
Added:
trunk/tests/gdk/test_pixbufanimation.py
Added: trunk/tests/gdk/test_pixbufanimation.py
==============================================================================
--- (empty file)
+++ trunk/tests/gdk/test_pixbufanimation.py Mon Sep 8 15:49:22 2008
@@ -0,0 +1,43 @@
+'''
+Tests for the ``gdk.PixbufAnimation`` class.
+'''
+from gtk import gdk
+
+def test_iter_on_currently_loading_frame_on_empty_anim():
+ '''
+ Ensure that ``iter.on_currently_loading_frame()`` returns ``True``
+ on an empty animation.
+ '''
+ anim = gdk.PixbufSimpleAnim(100, 200, 10)
+ iter = anim.get_iter()
+ assert iter.on_currently_loading_frame()
+
+def test_iter_on_currently_loading_frame_one_frame():
+ '''
+ Ensure that ``iter.on_currently_loading_frame()`` returns ``True``
+ if the animation has only one frame.
+ '''
+ anim = gdk.PixbufSimpleAnim(100, 200, 10)
+ anim.add_frame(gdk.Pixbuf(gdk.COLORSPACE_RGB, False, 8, 400, 300))
+ iter = anim.get_iter()
+ assert iter.on_currently_loading_frame()
+
+def test_iter_on_currently_loading_frame_not_last():
+ '''
+ Ensure that ``iter.on_currently_loading_frame()`` returns
+ ``False`` if the pixbuf animation iterator isn't on the last
+ frame in a non-empty animation.
+ '''
+ anim = gdk.PixbufSimpleAnim(100, 200, 40)
+ for x in range(5):
+ pixbuf = gdk.Pixbuf(gdk.COLORSPACE_RGB, False, 8, 400, 300)
+ anim.add_frame(pixbuf)
+
+ time = 0.0
+ iter = anim.get_iter(time)
+ for x in range(4):
+ assert not iter.on_currently_loading_frame()
+ time += iter.get_delay_time() / 1000.0
+ # In case we fall on an edge between two frames
+ while not iter.advance(time):
+ time += 0.001
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]