本文整理汇总了Python中ReText.window.ReTextWindow.switchTab方法的典型用法代码示例。如果您正苦于以下问题:Python ReTextWindow.switchTab方法的具体用法?Python ReTextWindow.switchTab怎么用?Python ReTextWindow.switchTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReText.window.ReTextWindow
的用法示例。
在下文中一共展示了ReTextWindow.switchTab方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestWindow
# 需要导入模块: from ReText.window import ReTextWindow [as 别名]
# 或者: from ReText.window.ReTextWindow import switchTab [as 别名]
#.........这里部分代码省略.........
self.assertEqual('New document[*]', self.window.windowTitle())
self.assertFalse(self.window.currentTab.fileName)
@patch('ReText.window.QFileDialog.getOpenFileNames', return_value=([os.path.join(path_to_testdata, 'existing_file.md')], None))
def test_windowTitleAndTabs_afterLoadingFile(self, getOpenFileNamesMock):
self.window = ReTextWindow()
self.window.createNew('')
self.window.actionOpen.trigger()
processEventsUntilIdle()
# Check that file is opened in the existing empty tab
self.assertEqual(1, self.window.tabWidget.count())
self.assertEqual('existing_file.md[*]', self.window.windowTitle())
self.assertTrue(self.window.currentTab.fileName.endswith('tests/testdata/existing_file.md'))
@patch('ReText.window.QFileDialog.getOpenFileNames', return_value=([os.path.join(path_to_testdata, 'existing_file.md')], None))
def test_windowTitleAndTabs_afterSwitchingTab(self, getOpenFileNamesMock):
self.window = ReTextWindow()
self.window.createNew('')
self.window.actionOpen.trigger()
processEventsUntilIdle()
tab_with_file = self.window.currentTab
self.window.createNew('bla')
processEventsUntilIdle()
tab_with_unsaved_content = self.window.currentTab
self.assertEqual('New document[*]', self.window.windowTitle())
self.assertTrue(self.window.currentTab is tab_with_unsaved_content)
self.assertTrue(self.window.tabWidget.currentWidget() is tab_with_unsaved_content)
self.window.switchTab()
processEventsUntilIdle()
self.assertEqual('existing_file.md[*]', self.window.windowTitle())
self.assertTrue(self.window.currentTab is tab_with_file)
self.assertTrue(self.window.tabWidget.currentWidget() is tab_with_file)
@patch('ReText.window.QFileDialog.getOpenFileNames', return_value=([os.path.join(path_to_testdata, 'existing_file.md')], None))
def test_activeTab_afterLoadingFileThatIsAlreadyOpenInOtherTab(self, getOpenFileNamesMock):
self.window = ReTextWindow()
self.window.createNew('')
self.window.actionOpen.trigger()
processEventsUntilIdle()
tab_with_file = self.window.currentTab
self.window.createNew('')
processEventsUntilIdle()
# Make sure that the newly created tab is the active one
self.assertFalse(self.window.currentTab.fileName)
# Load the same document again
self.window.actionOpen.trigger()
processEventsUntilIdle()
# Check that we have indeed been switched back to the previous tab
self.assertTrue(self.window.currentTab is tab_with_file)
self.assertTrue(self.window.currentTab.fileName.endswith('tests/testdata/existing_file.md'))
def test_markupDependentWidgetStates_afterStartWithEmptyTabAndMarkdownAsDefaultMarkup(self):
self.window = ReTextWindow()
self.window.createNew('')
processEventsUntilIdle()