# Path: tests/gui.py
# def setupGtkInterface(test, klass=None, notebook=None):
# 	'''Setup a new GtkInterface object for testing.
# 	Will have test notebook, and default preferences.
# 	@param test: the test that wants to use this ui object
# 	@param klass: the klass to use, defaults to L{GtkInterface}, but
# 	could be partially mocked subclass
# 	'''
# 	if klass is None:
# 		klass = zim.gui.GtkInterface
# 
# 	# start filtering
# 	filter = FilterNoSuchImageWarning()
# 	filter.wrap_test(test)
# 
# 
# 	# create interface object with new notebook
# 	if notebook is None:
# 		dirpath = test.get_tmp_name()
# 		notebook = tests.new_notebook(fakedir=dirpath)
# 
# 	config = VirtualConfigManager()
# 	ui = klass(config=config, notebook=notebook)
# 
# 	ui.mainwindow.init_uistate()
# 	ui.open_page(Path('Test:foo:bar'))
# 
# 	return ui
# 
# Path: zim/gui/widgets.py
# RIGHT_PANE = 'right_pane' #: Right pane position in window
# 
# LEFT_PANE = 'left_pane' #: Left pane position in window


import tests
import gtk
from tests.gui import setupGtkInterface
from zim.plugins.tableofcontents import *
from zim.gui.widgets import RIGHT_PANE, LEFT_PANE
		ext = list(plugin.extensions)
		self.assertEqual(len(ext), 1)
		self.assertIsInstance(ext[0], MainWindowExtensionFloating)

		plugin.preferences.changed() # make sure no errors are triggered
		plugin.preferences['show_h1'] = True
		plugin.preferences['show_h1'] = False
		plugin.preferences['pane'] = RIGHT_PANE
		plugin.preferences['pane'] = LEFT_PANE


		plugin.preferences['floating'] = False
		self.assertEqual(plugin.extension_classes['MainWindow'], MainWindowExtensionEmbedded)
		plugin.extend(ui.mainwindow) # plugin does not remember objects, manager does that

		ext = list(plugin.extensions)
		self.assertEqual(len(ext), 1)
		self.assertIsInstance(ext[0], MainWindowExtensionEmbedded)

		plugin.preferences.changed() # make sure no errors are triggered
		plugin.preferences['show_h1'] = True
		plugin.preferences['show_h1'] = False
		plugin.preferences['pane'] = RIGHT_PANE
		plugin.preferences['pane'] = LEFT_PANE

		plugin.preferences['floating'] = True  # switch back

	def testToCWidget(self):
		'''Test Tabel Of Contents plugin'''
		notebook = tests.new_notebook(self.get_tmp_name())

# Path: tests/gui.py
# def setupGtkInterface(test, klass=None, notebook=None):
# 	'''Setup a new GtkInterface object for testing.
# 	Will have test notebook, and default preferences.
# 	@param test: the test that wants to use this ui object
# 	@param klass: the klass to use, defaults to L{GtkInterface}, but
# 	could be partially mocked subclass
# 	'''
# 	if klass is None:
# 		klass = zim.gui.GtkInterface
# 
# 	# start filtering
# 	filter = FilterNoSuchImageWarning()
# 	filter.wrap_test(test)
# 
# 
# 	# create interface object with new notebook
# 	if notebook is None:
# 		dirpath = test.get_tmp_name()
# 		notebook = tests.new_notebook(fakedir=dirpath)
# 
# 	config = VirtualConfigManager()
# 	ui = klass(config=config, notebook=notebook)
# 
# 	ui.mainwindow.init_uistate()
# 	ui.open_page(Path('Test:foo:bar'))
# 
# 	return ui
# 
# Path: zim/gui/widgets.py
# RIGHT_PANE = 'right_pane' #: Right pane position in window
# 
# LEFT_PANE = 'left_pane' #: Left pane position in window


# Path: tests/tableofcontents.py
import tests
import gtk
from tests.gui import setupGtkInterface
from zim.plugins.tableofcontents import *
from zim.gui.widgets import RIGHT_PANE, LEFT_PANE

		ext = list(plugin.extensions)
		self.assertEqual(len(ext), 1)
		self.assertIsInstance(ext[0], MainWindowExtensionFloating)

		plugin.preferences.changed() # make sure no errors are triggered
		plugin.preferences['show_h1'] = True
		plugin.preferences['show_h1'] = False
		plugin.preferences['pane'] = RIGHT_PANE
		plugin.preferences['pane'] = LEFT_PANE


		plugin.preferences['floating'] = False
		self.assertEqual(plugin.extension_classes['MainWindow'], MainWindowExtensionEmbedded)
		plugin.extend(ui.mainwindow) # plugin does not remember objects, manager does that

		ext = list(plugin.extensions)
		self.assertEqual(len(ext), 1)
		self.assertIsInstance(ext[0], MainWindowExtensionEmbedded)

		plugin.preferences.changed() # make sure no errors are triggered
		plugin.preferences['show_h1'] = True
		plugin.preferences['show_h1'] = False
		plugin.preferences['pane'] = RIGHT_PANE
		plugin.preferences['pane'] = LEFT_PANE

		plugin.preferences['floating'] = True  # switch back

	def testToCWidget(self):
		'''Test Tabel Of Contents plugin'''
		notebook = tests.new_notebook(self.get_tmp_name())

		ui = setupGtkInterface(self, notebook=notebook)