evince r3161 - in trunk: . shell test



Author: nshmyrev
Date: Sun Sep  7 16:27:14 2008
New Revision: 3161
URL: http://svn.gnome.org/viewvc/evince?rev=3161&view=rev

Log:
2008-09-07  Nickolay V. Shmyrev  <nshmyrev yandex ru>

	* shell/ev-page-cache.c (ev_page_cache_set_page_label):
	
	Patch for case unsensitive page label match by Michael Lee.
	See bug #550136.
	
	* shell/ev-page-action.c (create_tool_item):	
	* test/Makefile.am:
	* test/test1.py:
	* test/test4.py:
	* test/test5.py:
	
	Added test for the above and updated other tests.



Added:
   trunk/test/test-page-labels.pdf   (contents, props changed)
   trunk/test/test5.py   (contents, props changed)
Modified:
   trunk/ChangeLog
   trunk/shell/ev-page-action.c
   trunk/shell/ev-page-cache.c
   trunk/test/Makefile.am
   trunk/test/test1.py
   trunk/test/test4.py

Modified: trunk/shell/ev-page-action.c
==============================================================================
--- trunk/shell/ev-page-action.c	(original)
+++ trunk/shell/ev-page-action.c	Sun Sep  7 16:27:14 2008
@@ -163,6 +163,7 @@
 {
 	EvPageActionWidget *proxy;
 	GtkWidget *hbox;
+        AtkObject *obj;
 
 	proxy = g_object_new (ev_page_action_widget_get_type (), NULL);
 	gtk_container_set_border_width (GTK_CONTAINER (proxy), 6); 
@@ -172,6 +173,9 @@
 	gtk_box_set_spacing (GTK_BOX (hbox), 6);
 
 	proxy->entry = gtk_entry_new ();
+	obj = gtk_widget_get_accessible (proxy->entry);
+        atk_object_set_name (obj, "page-label-entry");
+	         
 	g_signal_connect(proxy->entry, "scroll-event",G_CALLBACK(page_scroll_cb),action);
 	gtk_widget_add_events(GTK_WIDGET(proxy->entry),GDK_BUTTON_MOTION_MASK);
 	gtk_entry_set_width_chars (GTK_ENTRY (proxy->entry), 5);

Modified: trunk/shell/ev-page-cache.c
==============================================================================
--- trunk/shell/ev-page-cache.c	(original)
+++ trunk/shell/ev-page-cache.c	Sun Sep  7 16:27:14 2008
@@ -482,6 +482,15 @@
 		}
 	}
 
+	/* Second, look for a match with case insensitively */
+	for (i = 0; i < page_cache->n_pages; i++) {
+		if (page_cache->page_labels[i] != NULL &&
+		    ! strcasecmp (page_label, page_cache->page_labels[i])) {
+			ev_page_cache_set_current_page (page_cache, i);
+			return TRUE;
+		}
+	}
+
 	/* Next, parse the label, and see if the number fits */
 	value = strtol (page_label, &endptr, 10);
 	if (endptr[0] == '\0') {

Modified: trunk/test/Makefile.am
==============================================================================
--- trunk/test/Makefile.am	(original)
+++ trunk/test/Makefile.am	Sun Sep  7 16:27:14 2008
@@ -1,6 +1,15 @@
 
-dist_check_SCRIPTS = test1.py test2.py test3.py test4.py
+dist_check_SCRIPTS = \
+	test1.py \
+	test2.py \
+	test3.py \
+	test4.py \
+	test5.py
 
 TESTS = $(dist_check_SCRIPTS)
 
-EXTRA_DIST = test-encrypt.pdf test-links.pdf test-mime.bin
+EXTRA_DIST = \
+	test-encrypt.pdf \
+	test-links.pdf \
+	test-mime.bin \
+	test-page-labels.pdf

Added: trunk/test/test-page-labels.pdf
==============================================================================
Binary file. No diff available.

Modified: trunk/test/test1.py
==============================================================================
--- trunk/test/test1.py	(original)
+++ trunk/test/test1.py	Sun Sep  7 16:27:14 2008
@@ -24,7 +24,7 @@
 # About dialog
 click('Help', roleName='menu')
 click('About', roleName='menu item')
-focus.dialog('About Evince')
+focus.dialog('About Document Viewer')
 click('Credits', roleName='push button')
 focus.dialog('Credits')
 click('Close', roleName='push button')

Modified: trunk/test/test4.py
==============================================================================
--- trunk/test/test4.py	(original)
+++ trunk/test/test4.py	Sun Sep  7 16:27:14 2008
@@ -10,9 +10,10 @@
 
 run('evince', arguments=' '+srcdir+'/test-links.pdf')
 
-# Close evince
-click('View', roleName='menu')
-click('Reload', roleName='menu item')
+# Reload document a few times
+for i in range(1,6):
+	click('View', roleName='menu')
+	click('Reload', roleName='menu item')
 
 # Close evince
 click('File', roleName='menu')

Added: trunk/test/test5.py
==============================================================================
--- (empty file)
+++ trunk/test/test5.py	Sun Sep  7 16:27:14 2008
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+# This test tries document reload action.
+
+import os
+os.environ['LANG']='C'
+srcdir = os.environ['srcdir']
+
+from dogtail.procedural import *
+
+run('evince', arguments=' '+srcdir+'/test-page-labels.pdf')
+
+focus.widget('page-label-entry')
+focus.widget.text = "iii"
+activate()
+
+if focus.widget.text != "III":
+	click('File', roleName='menu')
+	click('Close', roleName='menu item')
+	exit (1)
+
+# Close evince
+click('File', roleName='menu')
+click('Close', roleName='menu item')



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