コード例 #1
0
ファイル: notebook.py プロジェクト: hjq300/zim-wiki
	def testShouldAutochangeHeading(self):
		page = Page(Path("Foo"))
		page.readonly = False
		tree = ParseTree().fromstring('<zim-tree></zim-tree>')
		tree.set_heading("Foo")
		page.set_parsetree(tree)
		self.assertTrue(page.heading_matches_pagename())
		tree.set_heading("Bar")
		page.set_parsetree(tree)
		self.assertFalse(page.heading_matches_pagename())
コード例 #2
0
ファイル: gui.py プロジェクト: Jam71/Zim-QDA
	def testRenamePageDialogWithHeadingChanges(self):
		'''Test RenamePageDialog's heading auto-change option depending on
		whether we have a changed heading or not.
		'''
		tree = ParseTree().fromstring('<zim-tree></zim-tree>')
		tree.set_heading("bar")
		self.ui.page = Page(Path("Test:foo:bar"), parsetree=tree)
		self.ui.notebook.get_page = lambda path: self.ui.page
		dialog = zim.gui.RenamePageDialog(self.ui, path=Path("Test:foo:bar"))
		self.assertTrue(dialog.form['head'])
		tree.set_heading("different")
		dialog = zim.gui.RenamePageDialog(self.ui, path=Path("Test:foo:bar"))
		self.assertFalse(dialog.form['head'])
コード例 #3
0
ファイル: notebook.py プロジェクト: timckuhn/zim-desktop-wiki
    def testShouldAutochangeHeading(self):
        from zim.newfs.mock import MockFile, MockFolder
        file = MockFile('/mock/test/page.txt')
        folder = MockFile('/mock/test/page/')
        page = Page(Path('Foo'), False, file, folder)

        tree = ParseTree().fromstring('<zim-tree></zim-tree>')
        tree.set_heading("Foo")
        page.set_parsetree(tree)
        self.assertTrue(page.heading_matches_pagename())
        tree.set_heading("Bar")
        page.set_parsetree(tree)
        self.assertFalse(page.heading_matches_pagename())
コード例 #4
0
ファイル: gui.py プロジェクト: pombredanne/zim
    def testRenamePageDialogWithHeadingChanges(self):
        '''Test RenamePageDialog's heading auto-change option depending on
		whether we have a changed heading or not.
		'''
        tree = ParseTree().fromstring('<zim-tree></zim-tree>')
        tree.set_heading("bar")
        self.ui.page = Page(Path("Test:foo:bar"), parsetree=tree)
        self.ui.notebook.get_page = lambda path: self.ui.page
        dialog = zim.gui.RenamePageDialog(self.ui, path=Path("Test:foo:bar"))
        self.assertTrue(dialog.form['head'])
        tree.set_heading("different")
        dialog = zim.gui.RenamePageDialog(self.ui, path=Path("Test:foo:bar"))
        self.assertFalse(dialog.form['head'])
コード例 #5
0
    def testRenamePageDialogWithHeadingChanges(self):
        '''Test RenamePageDialog's heading auto-change option depending on
		whether we have a changed heading or not.
		'''
        from zim.newfs.mock import MockFile, MockFolder
        file = MockFile('/mock/test/page.txt')
        folder = MockFile('/mock/test/page/')
        page = Page(Path("Test:foo:bar"), False, file, folder)

        tree = ParseTree().fromstring('<zim-tree></zim-tree>')
        tree.set_heading("bar")
        page.set_parsetree(tree)

        self.ui.page = page
        self.ui.notebook.get_page = lambda path: self.ui.page
        dialog = zim.gui.RenamePageDialog(self.ui, path=Path("Test:foo:bar"))
        self.assertTrue(dialog.form['head'])
        tree.set_heading("different")
        dialog = zim.gui.RenamePageDialog(self.ui, path=Path("Test:foo:bar"))
        self.assertFalse(dialog.form['head'])