diff options
author | Tobias Koenig <tokoe@kde.org> | 2009-05-16 10:19:10 (GMT) |
---|---|---|
committer | Tobias Koenig <tokoe@kde.org> | 2009-05-16 10:19:10 (GMT) |
commit | 135a028d9dc9a28a0a072665a7dc43b7e9e187be (patch) | |
tree | d259e1d265589d10a541899d4982ab4e656900eb /tests/auto/xmlpatternsview | |
parent | 210bd7b6033e41aad61fe131002dc5e496d7427a (diff) | |
download | Qt-135a028d9dc9a28a0a072665a7dc43b7e9e187be.zip Qt-135a028d9dc9a28a0a072665a7dc43b7e9e187be.tar.gz Qt-135a028d9dc9a28a0a072665a7dc43b7e9e187be.tar.bz2 |
Add W3C XML Schema validation support
This was done by Tobias Koenig, as part of an internship at Trolltech/Qt
Software, started at Wed Oct 1 18:32:43 2008 +0200, and the last commit being
part of this commit dating Tue Feb 24 11:03:36 2009 +0100. This is work
consisting of about 650 commits squashed into one, where the first commit was
61b280386c1905a15690fdd917dcbc8eb09b6283, in the repository before Qt's history
cut.
Diffstat (limited to 'tests/auto/xmlpatternsview')
-rw-r--r-- | tests/auto/xmlpatternsview/view/MainWindow.cpp | 32 | ||||
-rw-r--r-- | tests/auto/xmlpatternsview/view/MainWindow.h | 6 | ||||
-rw-r--r-- | tests/auto/xmlpatternsview/view/ui_MainWindow.ui | 9 |
3 files changed, 39 insertions, 8 deletions
diff --git a/tests/auto/xmlpatternsview/view/MainWindow.cpp b/tests/auto/xmlpatternsview/view/MainWindow.cpp index 57aaca0..b5424a3 100644 --- a/tests/auto/xmlpatternsview/view/MainWindow.cpp +++ b/tests/auto/xmlpatternsview/view/MainWindow.cpp @@ -220,7 +220,8 @@ void MainWindow::on_actionOpen_triggered() if(fileName.isNull()) return; - openCatalog(QUrl::fromLocalFile(fileName), true, false); + m_currentSuiteType = TestSuite::XQuerySuite; + openCatalog(QUrl::fromLocalFile(fileName), true, TestSuite::XQuerySuite); } void MainWindow::on_actionOpenXSLTSCatalog_triggered() @@ -234,18 +235,34 @@ void MainWindow::on_actionOpenXSLTSCatalog_triggered() if(fileName.isNull()) return; - openCatalog(QUrl::fromLocalFile(fileName), true, true); + m_currentSuiteType = TestSuite::XsltSuite; + openCatalog(QUrl::fromLocalFile(fileName), true, TestSuite::XsltSuite); +} + +void MainWindow::on_actionOpenXSDTSCatalog_triggered() +{ + const QString fileName(QFileDialog::getOpenFileName(this, + QLatin1String("Open Test Suite Catalog"), + m_previousOpenedCatalog.toLocalFile(), + QLatin1String("Test Suite Catalog file (*.xml)"))); + + /* "If the user presses Cancel, it returns a null string." */ + if(fileName.isNull()) + return; + + m_currentSuiteType = TestSuite::XsdSuite; + openCatalog(QUrl::fromLocalFile(fileName), true, TestSuite::XsdSuite); } void MainWindow::openCatalog(const QUrl &fileName, const bool reportError, - const bool isXSLT) + const TestSuite::SuiteType suiteType) { setCurrentFile(fileName); m_previousOpenedCatalog = fileName; QString errorMsg; - TestSuite *const loadedSuite = TestSuite::openCatalog(fileName, errorMsg, false, isXSLT); + TestSuite *const loadedSuite = TestSuite::openCatalog(fileName, errorMsg, false, suiteType); if(!loadedSuite) { @@ -334,12 +351,12 @@ void MainWindow::readSettings() focusURI->setText(settings.value(QLatin1String("focusURI")).toString()); isXSLT20->setChecked(settings.value(QLatin1String("isXSLT20")).toBool()); compileOnly->setChecked(settings.value(QLatin1String("compileOnly")).toBool()); + m_currentSuiteType = (TestSuite::SuiteType)settings.value(QLatin1String("PreviousSuiteType"), isXSLT20->isChecked() ? TestSuite::XsltSuite : TestSuite::XQuerySuite).toInt(); /* Open the previously opened catalog. */ if(!m_previousOpenedCatalog.isEmpty()) { - /* We don't know what kind of catalog it is, so we just take a chance. */ - openCatalog(m_previousOpenedCatalog, false, isXSLT20->isChecked()); + openCatalog(m_previousOpenedCatalog, false, m_currentSuiteType); } sourceInput->setPlainText(settings.value(QLatin1String("sourceInput")).toString()); @@ -393,6 +410,7 @@ void MainWindow::writeSettings() settings.setValue(QLatin1String("size"), size()); settings.setValue(QLatin1String("sourceInput"), sourceInput->toPlainText()); settings.setValue(QLatin1String("PreviousOpenedCatalogFile"), m_previousOpenedCatalog); + settings.setValue(QLatin1String("PreviousSuiteType"), m_currentSuiteType); settings.setValue(QLatin1String("SelectedTab"), sourceTab->currentIndex()); settings.setValue(QLatin1String("ResultViewMethod"), testResultView->resultViewSelection->currentIndex()); @@ -470,7 +488,7 @@ void MainWindow::openRecentFile() { const QAction *const action = qobject_cast<QAction *>(sender()); if(action) - openCatalog(action->data().toUrl(), true, false); + openCatalog(action->data().toUrl(), true, TestSuite::XQuerySuite); } void MainWindow::closeEvent(QCloseEvent *ev) diff --git a/tests/auto/xmlpatternsview/view/MainWindow.h b/tests/auto/xmlpatternsview/view/MainWindow.h index 1d14f41..778d7cd 100644 --- a/tests/auto/xmlpatternsview/view/MainWindow.h +++ b/tests/auto/xmlpatternsview/view/MainWindow.h @@ -88,6 +88,7 @@ #include "ui_ui_MainWindow.h" #include "DebugExpressionFactory.h" +#include "TestSuite.h" QT_BEGIN_HEADER @@ -142,6 +143,8 @@ namespace QPatternistSDK void on_actionOpenXSLTSCatalog_triggered(); + void on_actionOpenXSDTSCatalog_triggered(); + /** * Executes the selected test case or test group. */ @@ -153,7 +156,7 @@ namespace QPatternistSDK * an informative message box will be displayed, if any errors occurred. */ void openCatalog(const QUrl &file, const bool reportError, - const bool isXSLT); + const TestSuite::SuiteType suitType); void openRecentFile(); @@ -205,6 +208,7 @@ namespace QPatternistSDK TestCaseView * testCaseView; TestResultView * testResultView; FunctionSignaturesView * functionView; + TestSuite::SuiteType m_currentSuiteType; }; } QT_END_NAMESPACE diff --git a/tests/auto/xmlpatternsview/view/ui_MainWindow.ui b/tests/auto/xmlpatternsview/view/ui_MainWindow.ui index 5d74331..0240350 100644 --- a/tests/auto/xmlpatternsview/view/ui_MainWindow.ui +++ b/tests/auto/xmlpatternsview/view/ui_MainWindow.ui @@ -234,6 +234,7 @@ </property> <addaction name="actionOpen"/> <addaction name="actionOpenXSLTSCatalog"/> + <addaction name="actionOpenXSDTSCatalog"/> <addaction name="actionExecute"/> <addaction name="separator"/> <addaction name="actionRestart"/> @@ -304,6 +305,14 @@ <string>Ctrl+L</string> </property> </action> + <action name="actionOpenXSDTSCatalog"> + <property name="text"> + <string>O&pen XSDTS Catalog...</string> + </property> + <property name="shortcut"> + <string>Ctrl+S</string> + </property> + </action> </widget> <resources/> <connections/> |