]> www.fi.muni.cz Git - evince.git/commitdiff
Patch for case unsensitive page label match by Michael Lee. See bug
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>
Sun, 7 Sep 2008 16:27:14 +0000 (16:27 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sun, 7 Sep 2008 16:27:14 +0000 (16:27 +0000)
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.

svn path=/trunk/; revision=3161

ChangeLog
shell/ev-page-action.c
shell/ev-page-cache.c
test/Makefile.am
test/test-page-labels.pdf [new file with mode: 0644]
test/test1.py
test/test4.py
test/test5.py [new file with mode: 0755]

index 15b6eead540be399432e8c23653f01a16c8db01b..9c16b3ee9b7d2d16ac7ad00e3589369d3a1d087f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+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.
+
 2008-09-07  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * shell/ev-window.c: (image_save_dialog_response_cb):
index ef87e75ee9ba992b22ced5fbb4bce8def0456ce9..cc3615abf091164041f99d7d59607e9f1bdda7f7 100644 (file)
@@ -163,6 +163,7 @@ create_tool_item (GtkAction *action)
 {
        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 @@ create_tool_item (GtkAction *action)
        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);
index bbddbbc0882e4d33e49f108a29be0e8fb36c6559..a43876a40fbe2b319021bdb909de566640e53d9b 100644 (file)
@@ -482,6 +482,15 @@ ev_page_cache_set_page_label (EvPageCache *page_cache,
                }
        }
 
+       /* 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') {
index db56b57a4f44093d96c52f3435c150bff7a290f0..aa562d38129279ebe00956d3171145a25b0ab1ec 100644 (file)
@@ -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
diff --git a/test/test-page-labels.pdf b/test/test-page-labels.pdf
new file mode 100644 (file)
index 0000000..c7d1267
Binary files /dev/null and b/test/test-page-labels.pdf differ
index 6822c7f03229eb4277d360ee166902ecfaa9ec15..a106c0d060107f82c95f3f9543f63b6420a1fc47 100755 (executable)
@@ -24,7 +24,7 @@ click('Close', roleName='push button')
 # 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')
index 86ff1976d7057a535cc8fada90e26a0fee45055b..789030e3130990a6364b07661f32cf4c3cfdf114 100755 (executable)
@@ -10,9 +10,10 @@ from dogtail.procedural import *
 
 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')
diff --git a/test/test5.py b/test/test5.py
new file mode 100755 (executable)
index 0000000..9fd7276
--- /dev/null
@@ -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')