Zim

Merge lp:~fmos/zim/bugfixes into lp:~jaap.karssenberg/zim/pyzim

Proposed by Fabian Stanke
Status: Merged
Merged at revision: 549
Proposed branch: lp:~fmos/zim/bugfixes
Merge into: lp:~jaap.karssenberg/zim/pyzim
Diff against target: 66 lines (+34/-2)
3 files modified
tests/data/notebook-wiki.xml (+4/-0)
tests/gui.py (+26/-1)
zim/gui/pageindex.py (+4/-1)
To merge this branch: bzr merge lp:~fmos/zim/bugfixes
Reviewer Review Type Date Requested Status
Jaap Karssenberg Pending
Review via email: mp+106306@code.launchpad.net

Description of the change

Test covering GUI updates during a page move.
Bug fix for index update causing crash when trying to update the moved (and thus non-existing) row in PageTreeStore.select_page.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/data/notebook-wiki.xml'
--- tests/data/notebook-wiki.xml 2012-02-09 03:38:46 +0000
+++ tests/data/notebook-wiki.xml 2012-05-18 05:32:28 +0000
@@ -370,4 +370,8 @@
370<page name="Parent:Daughter:SomeOne:Bar">For page.menu template variable test</page>370<page name="Parent:Daughter:SomeOne:Bar">For page.menu template variable test</page>
371<page name="Parent:Child:Grandchild">For page.menu template variable test</page>371<page name="Parent:Child:Grandchild">For page.menu template variable test</page>
372372
373<page name="Movers">Subpages will be moved</page>
374<page name="Movers:Stator">Non-mover</page>
375<page name="Movers:Stator:Mover">Move me</page>
376
373</pagelist>377</pagelist>
374378
=== modified file 'tests/gui.py'
--- tests/gui.py 2012-05-17 17:14:44 +0000
+++ tests/gui.py 2012-05-18 05:32:28 +0000
@@ -579,7 +579,32 @@
579 self.ui.save_page()579 self.ui.save_page()
580 self.assertFalse(self.ui.page.get_parsetree() is None)580 self.assertFalse(self.ui.page.get_parsetree() is None)
581581
582 # TODO notebook manipulation (new (sub)page, move, rename, delete ..)582 def testPageMove(self):
583 oldpath, newpath = Path('Movers:Stator:Mover'), Path('Movers:Mover')
584
585 # Open page and process message queue to sync tree view
586 indexpath = self.ui.notebook.index.lookup_path(oldpath)
587 self.ui.open_page(indexpath)
588 while gtk.events_pending():
589 gtk.main_iteration(False)
590
591 # Test actual moving
592 page = self.ui.notebook.get_page(oldpath)
593 text = page.dump('wiki')
594 self.ui.notebook.index.ensure_update()
595 self.ui.notebook.move_page(oldpath, newpath)
596 self.ui.notebook.index.ensure_update()
597
598 # newpath should exist and look like the old one
599 page = self.ui.notebook.get_page(newpath)
600 self.assertEqual(page.dump('wiki'), text)
601
602 # oldpath should be deleted
603 page = self.ui.notebook.get_page(oldpath)
604 self.assertFalse(page.haschildren)
605 self.assertFalse(page.hascontent)
606
607 # TODO notebook manipulation (new (sub)page, rename, delete ..)
583 # merge with tests for dialogs (?)608 # merge with tests for dialogs (?)
584609
585 def testClipboard(self):610 def testClipboard(self):
586611
=== modified file 'zim/gui/pageindex.py'
--- zim/gui/pageindex.py 2012-03-27 19:00:32 +0000
+++ zim/gui/pageindex.py 2012-05-18 05:32:28 +0000
@@ -204,7 +204,10 @@
204 if mypath:204 if mypath:
205 treepath = self.get_treepath(mypath)205 treepath = self.get_treepath(mypath)
206 if treepath:206 if treepath:
207 treeiter = self.get_iter(treepath)207 try:
208 treeiter = self.get_iter(treepath)
209 except ValueError:
210 continue
208 self.emit('row-changed', treepath, treeiter)211 self.emit('row-changed', treepath, treeiter)
209212
210 def on_get_flags(self):213 def on_get_flags(self):