testinggtk r375 - trunk/tests



Author: bjornl
Date: Mon Aug 18 21:55:50 2008
New Revision: 375
URL: http://svn.gnome.org/viewvc/testinggtk?rev=375&view=rev

Log:
New test that checks that a cell renderer expands over the whole background

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:55:50 2008
@@ -167,15 +167,35 @@
     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)
-
+    pixbuf = utils.widget_get_rendering(win)
     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
+
+def test_cell_renderer_expanding():
+    '''
+    One cell renderer pack started in a cell view. It should expand to
+    cover the whole widget.
+    '''
+    cv = gtk.CellView()
+
+    cr = gtk.CellRendererText()
+    cr.set_property('background', '#ff0000')
+    cv.pack_start(cr)
+
+    win = gtk.Window()
+    win.add(cv)
+    win.show_all()
+    win.modify_bg(gtk.STATE_NORMAL, gdk.Color('#0000ff'))
+
+    # Cell renderer should resize now to cover the whole widget.
+    win.resize(500, 500)
+
+    utils.gtk_process_all_pending_events()
+    pixbuf = utils.widget_get_rendering(win)
+
+    # Sometimes the resize doesn't seem to happen...
+    assert pixbuf.get_width() == 500
+    assert pixbuf.get_height() == 500
+    assert utils.pixbuf_count_pixels(pixbuf, '#0000ff') == 0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]