diff --git a/tests/system/objects.map b/tests/system/objects.map
index 00bf6fb50a5..c014ad910fe 100644
--- a/tests/system/objects.map
+++ b/tests/system/objects.map
@@ -38,6 +38,11 @@
:CMake Wizard.Next_QPushButton {name='__qt__passive_wizardbutton1' text~='(Next.*|Continue)' type='QPushButton' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}
:CMake Wizard.Run CMake_QPushButton {text='Run CMake' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}
:CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard {type='CMakeProjectManager::Internal::CMakeOpenProjectWizard' unnamed='1' visible='1' windowTitle='CMake Wizard'}
+:CodePaster__Internal__PasteSelectDialog.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog'}
+:CodePaster__Internal__PasteSelectDialog.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog'}
+:CodePaster__Internal__PasteSelectDialog.listWidget_QListWidget {name='listWidget' type='QListWidget' visible='1' window=':CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog'}
+:CodePaster__Internal__PasteSelectDialog.protocolBox_QComboBox {name='protocolBox' type='QComboBox' visible='1' window=':CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog'}
+:CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog {name='CodePaster__Internal__PasteSelectDialog' type='CodePaster::PasteSelectDialog' visible='1'}
:CompilerPath.Utils_BaseValidatingLineEdit {container=':qt_tabwidget_stackedwidget_QWidget' name='LineEdit' type='Utils::BaseValidatingLineEdit' visible='1'}
:Core__Internal__GeneralSettings.User Interface_QGroupBox {container=':qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget' name='interfaceBox' title='User Interface' type='QGroupBox' visible='1'}
:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget' name='groupBox' title='Behavior' type='QGroupBox' visible='1'}
@@ -124,6 +129,7 @@
:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' visible='1' windowTitle?='*Qt Creator'}
:Qt Creator_Core::Internal::NavComboBox {type='Core::Internal::NavComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Core::Internal::ProgressBar {type='Core::Internal::ProgressBar' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
+:Qt Creator_Core::OutputWindow {type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_FilenameQComboBox {type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Find::Internal::SearchResultTreeView {type='Find::Internal::SearchResultTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
@@ -156,6 +162,11 @@
:RunSettingsEnvironmentDetails_Utils::DetailsButton {leftWidget=':RunSettingsUseBuildEnvironment_QLabel' text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:RunSettingsUseBuildEnvironment_QLabel {text~='Us(e|ing) Build Environment' type='QLabel' unnamed='1' visible='1'}
:Select signal.signalList_QTreeWidget {container=':Go to slot.Select signal_QGroupBox' name='signalList' type='QTreeWidget' visible='1'}
+:Send to Codepaster.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':Send to Codepaster_CodePaster::PasteView'}
+:Send to Codepaster.Paste_QPushButton {text='Paste' type='QPushButton' unnamed='1' visible='1' window=':Send to Codepaster_CodePaster::PasteView'}
+:Send to Codepaster.protocolBox_QComboBox {name='protocolBox' type='QComboBox' visible='1' window=':Send to Codepaster_CodePaster::PasteView'}
+:Send to Codepaster.stackedWidget_QStackedWidget {name='stackedWidget' type='QStackedWidget' visible='1' window=':Send to Codepaster_CodePaster::PasteView'}
+:Send to Codepaster_CodePaster::PasteView {name='CodePaster__Internal__ViewDialog' type='CodePaster::PasteView' visible='1' windowTitle='Send to Codepaster'}
:Session Manager_ProjectExplorer::Internal::SessionDialog {name='ProjectExplorer__Internal__SessionDialog' type='ProjectExplorer::Internal::SessionDialog' visible='1' windowTitle='Session Manager'}
:Startup.contextHelpComboBox_QComboBox {container=':Form.Startup_QGroupBox' name='contextHelpComboBox' type='QComboBox' visible='1'}
:User Interface.languageBox_QComboBox {container=':Core__Internal__GeneralSettings.User Interface_QGroupBox' name='languageBox' type='QComboBox' visible='1'}
@@ -183,3 +194,4 @@
:scrollArea.qmlDebuggingLibraryCheckBox_QCheckBox {name='qmlDebuggingLibraryCheckBox' type='QCheckBox' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:scrollArea_QTableView {type='QTableView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:sourceFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Source file:_QLabel' name='sourceFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'}
+:stackedWidget.plainTextEdit_QPlainTextEdit {container=':Send to Codepaster.stackedWidget_QStackedWidget' name='plainTextEdit' type='QPlainTextEdit' visible='1'}
diff --git a/tests/system/suite_tools/suite.conf b/tests/system/suite_tools/suite.conf
index c34c152be13..2f872714c52 100644
--- a/tests/system/suite_tools/suite.conf
+++ b/tests/system/suite_tools/suite.conf
@@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAP=../objects.map
-TEST_CASES=tst_designer_autocomplete tst_designer_goto_slot tst_external_sort
+TEST_CASES=tst_codepasting tst_designer_autocomplete tst_designer_goto_slot tst_external_sort
VERSION=2
WRAPPERS=Qt
diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py
new file mode 100644
index 00000000000..fcbff9930cd
--- /dev/null
+++ b/tests/system/suite_tools/tst_codepasting/test.py
@@ -0,0 +1,101 @@
+#############################################################################
+##
+## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+## Contact: http://www.qt-project.org/legal
+##
+## This file is part of Qt Creator.
+##
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and Digia. For licensing terms and
+## conditions see http://qt.digia.com/licensing. For further information
+## use the contact form at http://qt.digia.com/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Digia gives you certain additional
+## rights. These rights are described in the Digia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+#############################################################################
+
+source("../../shared/qtcreator.py")
+
+def main():
+ startApplication("qtcreator" + SettingsPath)
+ if not startedWithoutPluginError():
+ return
+ protocolsToTest = ["Paste.KDE.Org"]
+ # Be careful with Pastebin.Com, there are only 10 pastes per 24h
+ # for all machines using the same IP-address like you.
+ # protocolsToTest += ["Pastebin.Com"]
+ sourceFile = os.path.join(os.getcwd(), "testdata", "main.cpp")
+ for protocol in protocolsToTest:
+ invokeMenuItem("File", "Open File or Project...")
+ selectFromFileDialog(sourceFile)
+ editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
+ type(editor, "")
+ typeLines(editor, "// tst_codepasting %s" % datetime.utcnow())
+ sourceText = editor.plainText
+ invokeMenuItem("Tools", "Code Pasting", "Paste Snippet...")
+ selectFromCombo(":Send to Codepaster.protocolBox_QComboBox", protocol)
+ pasteEditor = waitForObject(":stackedWidget.plainTextEdit_QPlainTextEdit")
+ test.compare(pasteEditor.plainText, sourceText, "Verify that dialog shows text from the editor")
+ typeLines(pasteEditor, "// tst_codepasting %s" % datetime.utcnow())
+ pastedText = pasteEditor.plainText
+ clickButton(waitForObject(":Send to Codepaster.Paste_QPushButton"))
+ outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
+ waitFor("not outputWindow.plainText.isEmpty()", 20000)
+ pasteId = str(outputWindow.plainText).rsplit("/", 1)[1]
+ clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
+ invokeMenuItem('File', 'Revert "main.cpp" to Saved')
+ clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton"))
+ invokeMenuItem("File", "Close All")
+ if not pasteId:
+ test.fatal("Could not get id of paste to %s" % protocol)
+ continue
+ invokeMenuItem("Tools", "Code Pasting", "Fetch Snippet...")
+ selectFromCombo(":CodePaster__Internal__PasteSelectDialog.protocolBox_QComboBox", protocol)
+ pasteModel = waitForObject(":CodePaster__Internal__PasteSelectDialog.listWidget_QListWidget").model()
+ waitFor("pasteModel.rowCount() > 1", 20000)
+ try:
+ pasteLine = filter(lambda str: pasteId in str, dumpItems(pasteModel))[0]
+ except:
+ test.fail("Could not find id '%s' in list of pastes from %s" % (pasteId, protocol))
+ clickButton(waitForObject(":CodePaster__Internal__PasteSelectDialog.Cancel_QPushButton"))
+ continue
+ waitForObjectItem(":CodePaster__Internal__PasteSelectDialog.listWidget_QListWidget", pasteLine)
+ clickItem(":CodePaster__Internal__PasteSelectDialog.listWidget_QListWidget", pasteLine, 5, 5, 0, Qt.LeftButton)
+ clickButton(waitForObject(":CodePaster__Internal__PasteSelectDialog.OK_QPushButton"))
+ filenameCombo = waitForObject(":Qt Creator_FilenameQComboBox")
+ waitFor("not filenameCombo.currentText.isEmpty()", 20000)
+ if protocol == "Pastebin.Com" and JIRA.isBugStillOpen(9997, JIRA.Bug.CREATOR):
+ protocol = "Pastebin.com"
+ test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor")
+ editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
+ if protocol == "Paste.KDE.Org" and JIRA.isBugStillOpen(9995, JIRA.Bug.CREATOR):
+ test.xcompare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same")
+ else:
+ test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same")
+ invokeMenuItem("File", "Close All")
+ invokeMenuItem("File", "Open File or Project...")
+ selectFromFileDialog(sourceFile)
+ editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
+ markText(editor, "Down", 7)
+ # QString QTextCursor::selectedText () const:
+ # "Note: If the selection obtained from an editor spans a line break, the text will contain a
+ # Unicode U+2029 paragraph separator character instead of a newline \n character."
+ selectedText = str(editor.textCursor().selectedText()).replace(unichr(0x2029), "\n")
+ invokeMenuItem("Tools", "Code Pasting", "Paste Snippet...")
+ test.compare(waitForObject(":stackedWidget.plainTextEdit_QPlainTextEdit").plainText,
+ selectedText, "Verify that dialog shows selected text from the editor")
+ clickButton(waitForObject(":Send to Codepaster.Cancel_QPushButton"))
+ invokeMenuItem("File", "Exit")
diff --git a/tests/system/suite_tools/tst_codepasting/testdata/main.cpp b/tests/system/suite_tools/tst_codepasting/testdata/main.cpp
new file mode 100644
index 00000000000..b48f94ec827
--- /dev/null
+++ b/tests/system/suite_tools/tst_codepasting/testdata/main.cpp
@@ -0,0 +1,11 @@
+#include "mainwindow.h"
+#include
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}