testinggtk r365 - trunk/tests
- From: bjornl svn gnome org
- To: svn-commits-list gnome org
- Subject: testinggtk r365 - trunk/tests
- Date: Mon, 4 Aug 2008 22:27:06 +0000 (UTC)
Author: bjornl
Date: Mon Aug 4 22:27:06 2008
New Revision: 365
URL: http://svn.gnome.org/viewvc/testinggtk?rev=365&view=rev
Log:
Test for #528091
Modified:
trunk/tests/test_notebook.py
Modified: trunk/tests/test_notebook.py
==============================================================================
--- trunk/tests/test_notebook.py (original)
+++ trunk/tests/test_notebook.py Mon Aug 4 22:27:06 2008
@@ -2,6 +2,7 @@
Tests for the ``gtk.Notebook`` class.
'''
import gtk
+from gtk import gdk
def test_default_attributes():
'''
@@ -141,3 +142,47 @@
book.remove_page(x)
page = book.get_nth_page(book.get_current_page())
assert page == pages[x - 1]
+
+def test_press_arrow_on_not_can_focus_notebook():
+ '''
+ The scroll arrows in a ``gtk.Notebook`` should be clickable and
+ should change the current page even if the notebook does not
+ accept keyboard focus.
+
+ :bug: #528091
+ '''
+ book = gtk.Notebook()
+
+ # Show scroll arrows
+ book.set_scrollable(True)
+
+ # Unfocusable
+ book.set_property('can-focus', False)
+
+ # Add four dummy pages
+ for page in range(4):
+ page = gtk.Label('A')
+ book.append_page(page, gtk.Label('A'))
+
+ win = gtk.Window()
+ win.add(book)
+ win.show_all()
+
+ book.set_current_page(3)
+
+ # This will simulate a left button click on the left notebook
+ # arrow. Note that the coordinates are hardcoded, they should be
+ # calculated somehow.
+ ev = gdk.Event(gdk.BUTTON_PRESS)
+ ev.button = 1
+ ev.x = 5.0
+ ev.y = 5.0
+ ev.window = book.window
+ book.do_button_press_event(book, ev)
+
+ # Release the button
+ ev = gdk.Event(gdk.BUTTON_RELEASE)
+ ev.button = 1
+ book.do_button_release_event(book, ev)
+
+ assert book.get_current_page() == 2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]