testinggtk r372 - trunk/tests
- From: bjornl svn gnome org
- To: svn-commits-list gnome org
- Subject: testinggtk r372 - trunk/tests
- Date: Mon, 18 Aug 2008 21:23:54 +0000 (UTC)
Author: bjornl
Date: Mon Aug 18 21:23:54 2008
New Revision: 372
URL: http://svn.gnome.org/viewvc/testinggtk?rev=372&view=rev
Log:
New test testing the spacing of multiple cell renderers inside a cell view
Modified:
trunk/tests/test_cellview.py
Modified: trunk/tests/test_cellview.py
==============================================================================
--- trunk/tests/test_cellview.py (original)
+++ trunk/tests/test_cellview.py Mon Aug 18 21:23:54 2008
@@ -2,6 +2,7 @@
Tests for the ``gtk.CellView`` class.
'''
import gtk
+from gtk import gdk
import utils
def test_default_attributes():
@@ -145,3 +146,36 @@
cv.set_displayed_row((0,))
assert cr.get_property('text') == 'foo'
+
+######################################################################
+##### Rendering tests ################################################
+######################################################################
+def test_spacing_of_pack_start_renderers():
+ '''
+ Three text cell renderers are put in a cell view using pack
+ start. When the view is rendered, each of the three cell renderers
+ should occupy the same amount of space.
+ '''
+ cv = gtk.CellView()
+ crs = [gtk.CellRendererText() for x in range(3)]
+ for cr, col in zip(crs, ['#ff0000', '#00ff00', '#0000ff']):
+ cr.set_property('background', col)
+ cr.set_property('text', 'dummy text')
+ cv.pack_start(cr)
+
+ win = gtk.Window()
+ win.add(cv)
+ win.show_all()
+
+ width, height = win.window.get_size()
+ clip = gtk.gdk.Rectangle(0, 0, width, height)
+ pixmap = win.get_snapshot(clip)
+ pixbuf = gdk.Pixbuf(gdk.COLORSPACE_RGB, False, 8, width, height)
+ pixbuf.get_from_drawable(pixmap, pixmap.get_colormap(),
+ 0, 0, 0, 0,
+ width, height)
+
+ reds = utils.pixbuf_count_pixels(pixbuf, '#ff0000')
+ greens = utils.pixbuf_count_pixels(pixbuf, '#00ff00')
+ blues = utils.pixbuf_count_pixels(pixbuf, '#0000ff')
+ assert reds == greens == blues
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]