summaryrefslogtreecommitdiffstats
path: root/tests/auto/xmlpatternsview
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:18:55 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:18:55 (GMT)
commite5fcad302d86d316390c6b0f62759a067313e8a9 (patch)
treec2afbf6f1066b6ce261f14341cf6d310e5595bc1 /tests/auto/xmlpatternsview
downloadQt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2
Long live Qt 4.5!
Diffstat (limited to 'tests/auto/xmlpatternsview')
-rw-r--r--tests/auto/xmlpatternsview/.gitignore1
-rw-r--r--tests/auto/xmlpatternsview/test/test.pro17
-rw-r--r--tests/auto/xmlpatternsview/test/tst_xmlpatternsview.cpp74
-rw-r--r--tests/auto/xmlpatternsview/view/FunctionSignaturesView.cpp101
-rw-r--r--tests/auto/xmlpatternsview/view/FunctionSignaturesView.h116
-rw-r--r--tests/auto/xmlpatternsview/view/MainWindow.cpp531
-rw-r--r--tests/auto/xmlpatternsview/view/MainWindow.h215
-rw-r--r--tests/auto/xmlpatternsview/view/TestCaseView.cpp220
-rw-r--r--tests/auto/xmlpatternsview/view/TestCaseView.h132
-rw-r--r--tests/auto/xmlpatternsview/view/TestResultView.cpp204
-rw-r--r--tests/auto/xmlpatternsview/view/TestResultView.h127
-rw-r--r--tests/auto/xmlpatternsview/view/TreeSortFilter.cpp163
-rw-r--r--tests/auto/xmlpatternsview/view/TreeSortFilter.h139
-rw-r--r--tests/auto/xmlpatternsview/view/UserTestCase.cpp200
-rw-r--r--tests/auto/xmlpatternsview/view/UserTestCase.h167
-rw-r--r--tests/auto/xmlpatternsview/view/XDTItemItem.cpp160
-rw-r--r--tests/auto/xmlpatternsview/view/XDTItemItem.h133
-rw-r--r--tests/auto/xmlpatternsview/view/main.cpp103
-rw-r--r--tests/auto/xmlpatternsview/view/ui_BaseLinePage.ui48
-rw-r--r--tests/auto/xmlpatternsview/view/ui_FunctionSignaturesView.ui70
-rw-r--r--tests/auto/xmlpatternsview/view/ui_MainWindow.ui310
-rw-r--r--tests/auto/xmlpatternsview/view/ui_TestCaseView.ui224
-rw-r--r--tests/auto/xmlpatternsview/view/ui_TestResultView.ui239
-rw-r--r--tests/auto/xmlpatternsview/view/view.pro35
-rw-r--r--tests/auto/xmlpatternsview/xmlpatternsview.pro8
25 files changed, 3737 insertions, 0 deletions
diff --git a/tests/auto/xmlpatternsview/.gitignore b/tests/auto/xmlpatternsview/.gitignore
new file mode 100644
index 0000000..31f60b1
--- /dev/null
+++ b/tests/auto/xmlpatternsview/.gitignore
@@ -0,0 +1 @@
+tst_xmlpatternsview
diff --git a/tests/auto/xmlpatternsview/test/test.pro b/tests/auto/xmlpatternsview/test/test.pro
new file mode 100644
index 0000000..6adff4d
--- /dev/null
+++ b/tests/auto/xmlpatternsview/test/test.pro
@@ -0,0 +1,17 @@
+load(qttest_p4)
+SOURCES += tst_xmlpatternsview.cpp
+
+include (../../xmlpatterns.pri)
+
+DESTDIR = ..
+win32 {
+ CONFIG(debug, debug|release): DESTDIR = ../debug
+ else: DESTDIR = ../release
+}
+TARGET = tst_xmlpatternsview
+
+wince*: {
+ viewexe.sources = $$QT_BUILD_TREE/xmlpatternsview.exe
+ viewexe.path = .
+ DEPLOYMENT += viewexe
+}
diff --git a/tests/auto/xmlpatternsview/test/tst_xmlpatternsview.cpp b/tests/auto/xmlpatternsview/test/tst_xmlpatternsview.cpp
new file mode 100644
index 0000000..5da739d
--- /dev/null
+++ b/tests/auto/xmlpatternsview/test/tst_xmlpatternsview.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#ifdef QTEST_XMLPATTERNS
+
+/*!
+ \class tst_XmlPatternsView
+ \internal
+ \since 4.5
+ \brief This test tests nothing, it only exists in order to have a place
+ for the xmlpatternsview utility.
+
+ tests/auto/xmlpatternsview doesn't test anything, it only exists to house the
+ xmlpatternsview debugging utility inside the Qt directory.
+ */
+class tst_XmlPatternsView : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void run() const;
+};
+
+void tst_XmlPatternsView::run() const
+{
+}
+
+QTEST_MAIN(tst_XmlPatternsView)
+
+#include "tst_xmlpatternsview.moc"
+#else //QTEST_XMLPATTERNS
+QTEST_NOOP_MAIN
+#endif
diff --git a/tests/auto/xmlpatternsview/view/FunctionSignaturesView.cpp b/tests/auto/xmlpatternsview/view/FunctionSignaturesView.cpp
new file mode 100644
index 0000000..c4df9f7
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/FunctionSignaturesView.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#include "DebugExpressionFactory.h"
+
+#include "FunctionSignaturesView.h"
+
+using namespace QPatternistSDK;
+
+FunctionSignaturesView::FunctionSignaturesView(QWidget *const p)
+ : QDockWidget(QLatin1String("Function Signatures View"), p)
+{
+ setObjectName(QLatin1String("FunctionSignaturesView"));
+ setWidget(new QWidget());
+ setupUi(widget());
+
+ signatureList->addItems(DebugExpressionFactory::availableFunctionSignatures());
+ signatureList->sortItems();
+ countInfo->setText(QString::fromLatin1("Count: %1").arg(signatureList->count()));
+}
+
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/FunctionSignaturesView.h b/tests/auto/xmlpatternsview/view/FunctionSignaturesView.h
new file mode 100644
index 0000000..94d5b94
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/FunctionSignaturesView.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#ifndef PatternistSDK_FunctionSignaturesView_H
+#define PatternistSDK_FunctionSignaturesView_H
+
+#include <QDockWidget>
+
+#include "ui_ui_FunctionSignaturesView.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternistSDK
+{
+ /**
+ * @short a window which displays all available functions in
+ * the XQuery/XPath implementation.
+ *
+ * @ingroup PatternistSDK
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class FunctionSignaturesView : public QDockWidget,
+ public Ui_FunctionSignaturesViewCentralWidget
+ {
+ public:
+ FunctionSignaturesView(QWidget *const parent);
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/MainWindow.cpp b/tests/auto/xmlpatternsview/view/MainWindow.cpp
new file mode 100644
index 0000000..57aaca0
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/MainWindow.cpp
@@ -0,0 +1,531 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#include <QCloseEvent>
+#include <QFileDialog>
+#include <QFileInfo>
+#include <QHeaderView>
+#include <QMenu>
+#include <QMessageBox>
+#include <QProcess>
+#include <QSettings>
+#include <QTextStream>
+
+#include "ASTItem.h"
+#include "FunctionSignaturesView.h"
+#include "Global.h"
+#include "TestCaseView.h"
+#include "TestResultView.h"
+#include "TestSuite.h"
+#include "TreeModel.h"
+#include "TreeSortFilter.h"
+#include "UserTestCase.h"
+
+#include "MainWindow.h"
+
+using namespace QPatternistSDK;
+
+MainWindow::MainWindow() : m_userTC(new UserTestCase()),
+ m_currentTC(0)
+{
+ setupUi(this);
+
+ /* I want to do this in Designer.. */
+ testSuiteView->header()->setSortIndicator(0, Qt::AscendingOrder);
+ testSuiteView->header()->setSortIndicatorShown(true);
+ testSuiteView->header()->setClickable(true);
+
+ setupActions();
+
+ QStringList suiteHeaders;
+ suiteHeaders << QLatin1String("Name")
+ << QLatin1String("Pass")
+ << QLatin1String("Fail")
+ << QLatin1String("Total");
+
+ TreeSortFilter *const proxy = new TreeSortFilter(this);
+ connect(searchInput, SIGNAL(textChanged(const QString &)),
+ proxy, SLOT(setFilterFixedString(const QString &)));
+
+ proxy->setSourceModel(new TreeModel(suiteHeaders, this));
+ testSuiteView->setModel(proxy);
+
+ /* --------- Test Result View ---------- */
+ testResultView = new TestResultView(this);
+ testResultView->setAllowedAreas(Qt::AllDockWidgetAreas);
+ addDockWidget(Qt::RightDockWidgetArea, testResultView);
+ /* ----------------------------------- */
+
+ /* --------- Test Case View ---------- */
+ testCaseView = new TestCaseView(this);
+ testCaseView->setAllowedAreas(Qt::AllDockWidgetAreas);
+ addDockWidget(Qt::LeftDockWidgetArea, testCaseView);
+
+ connect(this, SIGNAL(testCaseSelected(TestCase *const)),
+ testCaseView, SLOT(displayTestCase(TestCase *const)));
+ connect(this, SIGNAL(testCaseSelected(TestCase *const)),
+ testResultView, SLOT(displayTestResult(TestCase *const)));
+ connect(focusURI, SIGNAL(textChanged(const QString &)),
+ m_userTC, SLOT(focusDocumentChanged(const QString &)));
+ /* ----------------------------------- */
+
+ /* ----- Function Signature View ----- */
+ functionView = new FunctionSignaturesView(this);
+ functionView->setAllowedAreas(Qt::AllDockWidgetAreas);
+ addDockWidget(Qt::RightDockWidgetArea, functionView);
+ /* ----------------------------------- */
+
+ /* Appears here, because the menu uses actions in the QDockWidgets. */
+ setupMenu();
+
+ readSettings();
+
+ /* Connect this after readSettings(), otherwise readSettings() triggers writeSettings(). */
+ connect(sourceTab, SIGNAL(currentChanged(int)),
+ SLOT(writeSettings()));
+ connect(testSuiteView, SIGNAL(clicked(const QModelIndex &)),
+ SLOT(writeSettings()));
+ connect(sourceInput, SIGNAL(textChanged()),
+ SLOT(writeSettings()));
+}
+
+MainWindow::~MainWindow()
+{
+ delete m_userTC;
+}
+
+QModelIndex MainWindow::sourceIndex(const QModelIndex &proxyIndex) const
+{
+ return static_cast<TreeSortFilter *>(testSuiteView->model())->mapToSource(proxyIndex);
+}
+
+TreeModel *MainWindow::sourceModel() const
+{
+ const TreeSortFilter *const proxy = static_cast<TreeSortFilter *>(testSuiteView->model());
+ return static_cast<TreeModel *>(proxy->sourceModel());
+}
+
+void MainWindow::on_testSuiteView_clicked(const QModelIndex &index)
+{
+ if(index.isValid())
+ {
+ TestItem *const node = static_cast<TestItem *>(sourceIndex(index).internalPointer());
+ Q_ASSERT(node);
+
+ if(node->isFinalNode())
+ {
+ m_currentTC = static_cast<TestCase *>(node);
+ testCaseSelected(m_currentTC);
+ return;
+ }
+ }
+
+ /* In all other cases: */
+ m_currentTC = 0;
+ testCaseSelected(0);
+}
+
+void MainWindow::on_sourceInput_textChanged()
+{
+ m_userTC->setSourceCode(sourceInput->toPlainText());
+}
+
+void MainWindow::on_actionOpen_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;
+
+ openCatalog(QUrl::fromLocalFile(fileName), true, false);
+}
+
+void MainWindow::on_actionOpenXSLTSCatalog_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;
+
+ openCatalog(QUrl::fromLocalFile(fileName), true, true);
+}
+
+void MainWindow::openCatalog(const QUrl &fileName,
+ const bool reportError,
+ const bool isXSLT)
+{
+ setCurrentFile(fileName);
+ m_previousOpenedCatalog = fileName;
+
+ QString errorMsg;
+ TestSuite *const loadedSuite = TestSuite::openCatalog(fileName, errorMsg, false, isXSLT);
+
+ if(!loadedSuite)
+ {
+ if(reportError)
+ {
+ QMessageBox::information(this, QLatin1String("Failed to load catalog file"),
+ errorMsg, QMessageBox::Ok);
+ }
+
+ return;
+ }
+
+ TreeModel *const prevModel = sourceModel();
+ prevModel->setRoot(loadedSuite);
+ m_currentTC = 0;
+
+ testCaseCount->setText(QString::number(loadedSuite->resultSummary().second));
+ /* Switch to the tab containing the loaded test suite. */
+ sourceTab->setCurrentIndex(0);
+
+ setWindowTitle(QCoreApplication::applicationName() +
+ QLatin1String(" -- ") +
+ QFileInfo(fileName.toLocalFile()).fileName());
+
+ /* @p reportError is set when not auto-loading on startup, and
+ * we only want to save when the user opens from the GUI. */
+ if(reportError)
+ writeSettings();
+}
+
+void MainWindow::on_sourceTab_currentChanged(int index)
+{
+ if(index == 1)
+ {
+ m_currentTC = m_userTC;
+ testCaseSelected(m_userTC);
+ }
+ else
+ on_testSuiteView_clicked(testSuiteView->currentIndex());
+}
+
+void MainWindow::on_actionExecute_triggered()
+{
+ Q_ASSERT(testCaseView);
+ TestSuite *const ts = static_cast<TestSuite *>(sourceModel()->root());
+
+ const TestItem::ExecutionStage stage = compileOnly->isChecked() ? TestItem::CompileOnly
+ : TestItem::CompileAndRun;
+
+ m_userTC->setLanguage(isXSLT20->isChecked() ? QXmlQuery::XSLT20 : QXmlQuery::XQuery10);
+
+ if(m_currentTC)
+ {
+ const TestResult::List rlist(m_currentTC->execute(stage, ts));
+ Q_ASSERT(rlist.count() == 1);
+ const TestResult *const result = rlist.first();
+ Q_ASSERT(result);
+ testResultView->displayTestResult(result);
+ }
+ else
+ {
+ const QModelIndexList indexes = testSuiteView->selectionModel()->selectedIndexes();
+ for (int i = 0; i < indexes.count(); ++i) {
+ const QModelIndex source(sourceIndex(indexes.at(i)));
+
+ TestItem *const ti = static_cast<TestItem *>(source.internalPointer());
+ if(!ti)
+ return;
+
+ /* ti is a TestGroup. It now executes its children, changed(TreeItem *) signals is
+ * emitted which the view receives, and thus updates. */
+ ti->execute(stage, ts);
+ }
+ }
+}
+
+void MainWindow::readSettings()
+{
+ QSettings settings;
+
+ settings.beginGroup(QLatin1String("MainWindow"));
+ restoreState(settings.value(QLatin1String("state")).toByteArray(), Global::versionNumber);
+ resize(settings.value(QLatin1String("size"), QSize(400, 400)).toSize());
+ move(settings.value(QLatin1String("pos"), QPoint(200, 200)).toPoint());
+ m_previousOpenedCatalog = settings.value(QLatin1String("PreviousOpenedCatalogFile")).toUrl();
+ focusURI->setText(settings.value(QLatin1String("focusURI")).toString());
+ isXSLT20->setChecked(settings.value(QLatin1String("isXSLT20")).toBool());
+ compileOnly->setChecked(settings.value(QLatin1String("compileOnly")).toBool());
+
+ /* 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());
+ }
+
+ sourceInput->setPlainText(settings.value(QLatin1String("sourceInput")).toString());
+ testResultView->resultViewSelection->setCurrentIndex(
+ settings.value(QLatin1String("ResultViewMethod"), 0).toInt());
+ testResultView->outputStack->setCurrentIndex(settings.value(
+ QLatin1String("ResultViewMethod"), 0).toInt());
+
+ /* Restore the selected test case/group. */
+ const QStringList rows(settings.value(QLatin1String("SelectedTestSuiteRow"),
+ QString())
+ .toString().split(QLatin1Char(',')));
+
+ if(!rows.isEmpty()) /* Ok, we have a selection. */
+ {
+ QAbstractItemModel *const model = testSuiteView->model();
+ Q_ASSERT(model);
+ QModelIndex p;
+
+ for(int i = rows.count() - 1; i >= 0; --i)
+ {
+ const QModelIndex childIndex(model->index(rows.at(i).toInt(), 0 , p));
+
+ if(childIndex.isValid())
+ {
+ testSuiteView->scrollTo(p); /* Work around for Qt issue #87575. */
+ p = childIndex;
+ }
+ }
+
+ testSuiteView->scrollTo(p); /* Scrolls to it. */
+ testSuiteView->setCurrentIndex(p); /* Selects it. */
+ on_testSuiteView_clicked(p); /* Loads the test case in the Test Case View. */
+ }
+
+ /* Do it here. In this way the user-entered test case gets selected, if that tab
+ * was previously used. */
+ sourceTab->setCurrentIndex(settings.value(QLatin1String("SelectedTab"), 0).toInt());
+ on_sourceTab_currentChanged(sourceTab->currentIndex());
+
+ settings.endGroup();
+}
+
+void MainWindow::writeSettings()
+{
+ QSettings settings;
+
+ settings.beginGroup(QLatin1String("MainWindow"));
+ settings.setValue(QLatin1String("state"), saveState(Global::versionNumber));
+ settings.setValue(QLatin1String("pos"), pos());
+ settings.setValue(QLatin1String("size"), size());
+ settings.setValue(QLatin1String("sourceInput"), sourceInput->toPlainText());
+ settings.setValue(QLatin1String("PreviousOpenedCatalogFile"), m_previousOpenedCatalog);
+ settings.setValue(QLatin1String("SelectedTab"), sourceTab->currentIndex());
+ settings.setValue(QLatin1String("ResultViewMethod"),
+ testResultView->resultViewSelection->currentIndex());
+ settings.setValue(QLatin1String("focusURI"),
+ focusURI->text());
+ settings.setValue(QLatin1String("isXSLT20"),
+ isXSLT20->isChecked());
+ settings.setValue(QLatin1String("compileOnly"),
+ compileOnly->isChecked());
+
+ /* Store the selected test case/group. */
+ QModelIndex selected(sourceIndex(testSuiteView->currentIndex()));
+ if(selected.isValid())
+ {
+ QString result;
+
+ do
+ {
+ result.append(QString::number(selected.row()));
+ selected = selected.parent();
+
+ if(selected.isValid())
+ result.append(QLatin1Char(','));
+ else
+ break;
+ }
+ while(true);
+
+ settings.setValue(QLatin1String("SelectedTestSuiteRow"), result);
+ }
+
+ settings.endGroup();
+}
+
+void MainWindow::setCurrentFile(const QUrl &f)
+{
+ const QString fileName(f.toLocalFile());
+ QSettings settings;
+ settings.beginGroup(QLatin1String("MainWindow"));
+ QStringList files(settings.value(QLatin1String("RecentFileList")).toStringList());
+
+ files.removeAll(fileName);
+ files.prepend(fileName);
+ while(files.size() > MaximumRecentFiles)
+ files.removeLast();
+
+ settings.setValue(QLatin1String("RecentFileList"), files);
+ settings.endGroup();
+
+ updateRecentFileActions();
+}
+
+void MainWindow::updateRecentFileActions()
+{
+ QSettings settings;
+ settings.beginGroup(QLatin1String("MainWindow"));
+ const QStringList files(settings.value(QLatin1String("RecentFileList")).toStringList());
+ settings.endGroup();
+
+ const int numRecentFiles = qMin(files.size(), static_cast<int>(MaximumRecentFiles));
+
+ for(int i = 0; i < numRecentFiles; ++i)
+ {
+ const QString text(QString::fromLatin1("&%1 %2").arg(i + 1).arg(QFileInfo(files[i]).filePath()));
+ m_recentFileActs[i]->setText(text);
+ m_recentFileActs[i]->setData(QUrl::fromLocalFile(files[i]));
+ m_recentFileActs[i]->setVisible(true);
+ }
+
+ for(int j = numRecentFiles; j < MaximumRecentFiles; ++j)
+ m_recentFileActs[j]->setVisible(false);
+}
+
+void MainWindow::openRecentFile()
+{
+ const QAction *const action = qobject_cast<QAction *>(sender());
+ if(action)
+ openCatalog(action->data().toUrl(), true, false);
+}
+
+void MainWindow::closeEvent(QCloseEvent *ev)
+{
+ writeSettings();
+ ev->accept();
+}
+
+void MainWindow::setupActions()
+{
+ connect(actionQuit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
+
+ for(int i = 0; i < MaximumRecentFiles; ++i)
+ {
+ m_recentFileActs[i] = new QAction(this);
+ m_recentFileActs[i]->setVisible(false);
+ connect(m_recentFileActs[i], SIGNAL(triggered()),
+ this, SLOT(openRecentFile()));
+ }
+}
+
+void MainWindow::setupMenu()
+{
+ QMenu *const menFile = findChild<QMenu *>(QLatin1String("menuFile"));
+ Q_ASSERT(menFile);
+ QAction *const actOpen = findChild<QAction *>(QLatin1String("actionExecute"));
+ Q_ASSERT(actOpen);
+ QMenu *const recent = new QMenu(QLatin1String("O&pen Recent"), this);
+
+ menFile->insertMenu(actOpen, recent);
+ menFile->insertSeparator(actOpen);
+
+ for(int i = 0; i < MaximumRecentFiles; ++i)
+ recent->addAction(m_recentFileActs[i]);
+
+ updateRecentFileActions();
+
+ QMenu *const menWindows = findChild<QMenu *>(QLatin1String("menuWindows"));
+ Q_ASSERT(menWindows);
+
+ menWindows->addAction(testCaseView->toggleViewAction());
+ menWindows->addAction(testResultView->toggleViewAction());
+ menWindows->addAction(functionView->toggleViewAction());
+}
+
+void MainWindow::on_actionRestart_triggered()
+{
+ if(QProcess::startDetached(QCoreApplication::applicationFilePath()))
+ QApplication::closeAllWindows();
+ else
+ {
+ QTextStream err(stderr);
+ err << "Failed to start " << qPrintable(QCoreApplication::applicationFilePath()) << endl;
+ }
+}
+
+
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/MainWindow.h b/tests/auto/xmlpatternsview/view/MainWindow.h
new file mode 100644
index 0000000..1d14f41
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/MainWindow.h
@@ -0,0 +1,215 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#ifndef PatternistSDK_MainWindow_H
+#define PatternistSDK_MainWindow_H
+
+#include <QtDebug>
+#include <QUrl>
+
+#include "ui_ui_MainWindow.h"
+#include "DebugExpressionFactory.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternistSDK
+{
+ class FunctionSignaturesView;
+ class TestCase;
+ class TestCaseView;
+ class TestResultView;
+ class TreeModel;
+ class UserTestCase;
+
+ /**
+ * @short The main window of the PatternistSDKView application.
+ *
+ * MainWindow is heavily influenced by Qt's examples covering recent files,
+ * main window usage, QSettings, and other central parts.
+ *
+ * @ingroup PatternistSDK
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class MainWindow : public QMainWindow,
+ private Ui_MainWindow
+ {
+ Q_OBJECT
+ public:
+ MainWindow();
+ virtual ~MainWindow();
+
+ /**
+ * Takes care of saving QSettings.
+ */
+ virtual void closeEvent(QCloseEvent *event);
+
+ Q_SIGNALS:
+ /**
+ * Emitted whenever a test case is selected. The test case
+ * selected is @p tc. If something that wasn't a test case
+ * was selected, such as a test group or that a new test suite was
+ * opened, @p tc is @c null.
+ */
+ void testCaseSelected(TestCase *const tc);
+
+ private Q_SLOTS:
+ /**
+ * The Open action calls this slot. It is responsible
+ * for opening a test suite catalog file.
+ */
+ void on_actionOpen_triggered();
+
+ void on_actionOpenXSLTSCatalog_triggered();
+
+ /**
+ * Executes the selected test case or test group.
+ */
+ void on_actionExecute_triggered();
+
+ /**
+ * @param file the name of the catalog to open.
+ * @param reportError whether the user should be notified about a loading error. If @c true,
+ * an informative message box will be displayed, if any errors occurred.
+ */
+ void openCatalog(const QUrl &file, const bool reportError,
+ const bool isXSLT);
+
+ void openRecentFile();
+
+ void on_testSuiteView_clicked(const QModelIndex &index);
+
+ void on_sourceTab_currentChanged(int index);
+ void on_sourceInput_textChanged();
+
+ /**
+ * Restarts the program by executing restartApplication.sh loaded as a QResource file,
+ * combined with shutting down this instance.
+ */
+ void on_actionRestart_triggered();
+
+ void writeSettings();
+
+ private:
+ /**
+ * Saves typing a long line.
+ *
+ * @returns the source model the index in the proxy @p proxyIndex corresponds to.
+ */
+ inline QModelIndex sourceIndex(const QModelIndex &proxyIndex) const;
+
+ /**
+ * Saves typing a long line.
+ *
+ * @returns the source model for the test suite view, by walking through the
+ * proxy model.
+ */
+ inline TreeModel *sourceModel() const;
+
+ void setupMenu();
+ void setupActions();
+ void readSettings();
+ void setCurrentFile(const QUrl &fileName);
+ void updateRecentFileActions();
+
+ UserTestCase *const m_userTC;
+
+ enum {MaximumRecentFiles = 5};
+ QAction * m_recentFileActs[MaximumRecentFiles];
+
+ /**
+ * The current selected test case.
+ */
+ TestCase * m_currentTC;
+ QUrl m_previousOpenedCatalog;
+ TestCaseView * testCaseView;
+ TestResultView * testResultView;
+ FunctionSignaturesView * functionView;
+ };
+}
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/TestCaseView.cpp b/tests/auto/xmlpatternsview/view/TestCaseView.cpp
new file mode 100644
index 0000000..c187ef8
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/TestCaseView.cpp
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#include <QDate>
+#include <QtDebug>
+
+#include "UserTestCase.h"
+#include "ui_ui_BaseLinePage.h"
+
+#include "TestCaseView.h"
+
+using namespace QPatternistSDK;
+
+/**
+ * Removes all tabs in @p widget, and deletes its page widgets.
+ */
+static void clearTabWidget(QTabWidget *const widget)
+{
+ Q_ASSERT(widget);
+
+ /* Very annoying, we can't cache count(). */
+ /* Idea: QTabWidget::clear(bool deletePageWidgets = false); */
+ while(widget->count() != 0)
+ {
+ delete widget->widget(0);
+ widget->removeTab(0);
+ }
+
+ Q_ASSERT(widget->count() == 0);
+}
+
+TestCaseView::TestCaseView(QWidget *const p) : QDockWidget(QLatin1String("Test Case View"), p)
+{
+ setObjectName(QLatin1String("TestCaseView"));
+ setWidget(new QWidget());
+ setupUi(widget());
+ displayNone();
+ clearTabWidget(baselinesTabs);
+}
+
+void TestCaseView::displayNone()
+{
+ stackedWidget->setCurrentIndex(1);
+}
+
+void TestCaseView::displayTestCase(TestCase *const tc)
+{
+ if(!tc)
+ {
+ displayNone();
+ return;
+ }
+
+ name->setText(tc->title());
+ description->setText(tc->description());
+ isXPath->setText(tc->isXPath() ? QLatin1String("yes") : QLatin1String("no"));
+ author->setText(tc->creator());
+ type->setText(TestCase::displayName(tc->scenario()));
+ if(tc->lastModified().isNull())
+ lastModified->setText(QLatin1String("Not specified."));
+ else
+ lastModified->setText(tc->lastModified().toString());
+
+ if(tc->contextItemSource().isValid())
+ focusDocument->setText(tc->contextItemSource().toLocalFile());
+
+ /* Not used. */
+ bool ok = false;
+
+ const QString sourceCode(tc->sourceCode(ok));
+
+ if(sourceCode.isEmpty())
+ sourceEdit->setPlainText(QLatin1String("No source code available."));
+ else
+ sourceEdit->setPlainText(sourceCode);
+
+ stackedWidget->setCurrentIndex(0);
+
+ displayBaseLines(tc);
+}
+
+void TestCaseView::displayBaseLines(const TestCase *const tc)
+{
+ clearTabWidget(baselinesTabs);
+ Q_ASSERT(tc);
+ const TestBaseLine::List bs(tc->baseLines());
+ const TestBaseLine::List::const_iterator end(bs.constEnd());
+ TestBaseLine::List::const_iterator it(bs.constBegin());
+
+ for(; it != end; ++it)
+ {
+ const TestBaseLine *const bl = *it;
+ Q_ASSERT(bl);
+ const TestBaseLine::Type t = bl->type();
+
+ QString title(TestBaseLine::displayName(t));
+ const QString details(bl->details());
+
+ QWidget *const currPage = new QWidget();
+ Ui::BaseLinePage setupPage;
+ setupPage.setupUi(currPage);
+
+ /* Make this title a bit better: "ExpectedError: XPTY0004", for example. */
+ switch(t)
+ {
+ case TestBaseLine::ExpectedError:
+ {
+ title += (QLatin1String(": ") + details);
+ /* Fallthrough. */
+ }
+ case TestBaseLine::Ignore:
+ {
+ setupPage.contentEdit->setEnabled(false);
+ break;
+ }
+ default:
+ {
+ setupPage.contentEdit->setPlainText(details);
+ break;
+ }
+ }
+
+ baselinesTabs->addTab(currPage, title);
+ }
+
+ int tabIndex = baselinesTabs->count(); /* The tab we're about to add. */
+ baselinesTabs->addTab(new QWidget(), QLatin1String("AST Baseline"));
+ baselinesTabs->setTabToolTip(tabIndex,
+ QLatin1String("Expected AST baselines are not yet implemented."));
+ baselinesTabs->setTabEnabled(tabIndex, false);
+
+ ++tabIndex; /* Again, the tab we're about to add. */
+ baselinesTabs->addTab(new QWidget(), QLatin1String("Message Baseline"));
+ baselinesTabs->setTabToolTip(tabIndex,
+ QLatin1String("Expected Message baselines are not yet implemented."));
+ baselinesTabs->setTabEnabled(tabIndex, false);
+
+ baselinesTabs->setCurrentIndex(0);
+}
+
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/TestCaseView.h b/tests/auto/xmlpatternsview/view/TestCaseView.h
new file mode 100644
index 0000000..9e02a6f
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/TestCaseView.h
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#ifndef PatternistSDK_TestCaseView_H
+#define PatternistSDK_TestCaseView_H
+
+#include <QDockWidget>
+
+#include "ui_ui_TestCaseView.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternistSDK
+{
+ class TestCase;
+
+ /**
+ * @short Displays a test case.
+ *
+ * @ingroup PatternistSDK
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class TestCaseView : public QDockWidget,
+ public Ui_TestCaseViewCentralWidget
+ {
+ Q_OBJECT
+ public:
+ /**
+ * Creates a TestCaseView. Calls displayNone(), in order to reset its view.
+ */
+ TestCaseView(QWidget *const parent);
+
+ public Q_SLOTS:
+ void displayTestCase(TestCase *const);
+
+ private:
+ void displayBaseLines(const TestCase *const);
+
+ /**
+ * Displays a generic message that no test case is selected.
+ */
+ void displayNone();
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/TestResultView.cpp b/tests/auto/xmlpatternsview/view/TestResultView.cpp
new file mode 100644
index 0000000..d944b76
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/TestResultView.cpp
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#include <QHeaderView>
+
+#include "ASTItem.h"
+#include "ErrorItem.h"
+#include "TestCase.h"
+#include "TestResult.h"
+#include "TreeModel.h"
+#include "XDTItemItem.h"
+
+#include "TestResultView.h"
+
+using namespace QPatternistSDK;
+
+TestResultView::TestResultView(QWidget *const p) : QDockWidget(QLatin1String("Test Result View"), p)
+{
+ Q_ASSERT(p);
+ setObjectName(QLatin1String("TestResultView"));
+ setWidget(new QWidget());
+ setupUi(widget());
+
+ QStringList astColumns;
+ astColumns << QLatin1String("Node Name")
+ << QLatin1String("Details")
+ << QLatin1String("Static Type")
+ << QLatin1String("Required Type");
+ astView->setModel(new TreeModel(astColumns, this));
+
+ QStringList itemColumns;
+ itemColumns << QLatin1String("#")
+ << QLatin1String("Value")
+ << QLatin1String("Type");
+ itemListResult->setModel(new TreeModel(itemColumns, this));
+
+ QStringList errColumns;
+ errColumns << QLatin1String("Severity")
+ << QLatin1String("Error Code")
+ << QLatin1String("Message");
+ messageOutput->setModel(new TreeModel(errColumns, this));
+ messageOutput->horizontalHeader()->setStretchLastSection(true);
+}
+
+void TestResultView::displayTestResult(const TestResult *const result)
+{
+ if(!result)
+ {
+ displayNone();
+ return;
+ }
+
+ /* ------- the Test Status Label --------- */
+ resultStatus->setText(result->status() ? TestResult::displayName(result->status())
+ : QLatin1String("Not Applicable"));
+ /* --------------------------------------- */
+
+ /* ------------ the AST View ------------- */
+ ASTItem *astTree = result->astTree();
+ static_cast<TreeModel *>(astView->model())->setRoot(astTree);
+ /* --------------------------------------- */
+
+ /* ------- the Error code/msg View ------- */
+ ErrorItem *msgRoot = new ErrorItem(ErrorHandler::Message(), 0);
+
+ const ErrorHandler::Message::List msgs(result->messages());
+ ErrorHandler::Message::List::const_iterator it(msgs.constBegin());
+ const ErrorHandler::Message::List::const_iterator end(msgs.constEnd());
+
+ for(; it != end; ++it)
+ msgRoot->appendChild(new ErrorItem(*it, msgRoot));
+
+ TreeModel *etm = static_cast<TreeModel *>(messageOutput->model());
+ etm->setRoot(msgRoot);
+ /* --------------------------------------- */
+
+ const QPatternist::Item::List items(result->items());
+ /* ----- the Serialized Output View ------ */
+ serializedResult->setPlainText(result->asSerialized());
+ /* --------------------------------------- */
+
+ /* ------ the Item List Output View ------ */
+ XDTItemItem *itemRoot = new XDTItemItem(QPatternist::Item(), 0);
+ QPatternist::Item item;
+
+ QPatternist::Item::List::const_iterator itemIt(items.constBegin());
+ const QPatternist::Item::List::const_iterator itemsEnd(items.constEnd());
+
+ for(; itemIt != itemsEnd; ++itemIt)
+ itemRoot->appendChild(new XDTItemItem(*itemIt, itemRoot));
+
+ TreeModel *itm = static_cast<TreeModel *>(itemListResult->model());
+ itm->setRoot(itemRoot);
+ /* --------------------------------------- */
+}
+
+void TestResultView::displayTestResult(TestCase *const tc)
+{
+ if(tc)
+ displayTestResult(tc->testResult());
+ else
+ displayNone();
+}
+
+void TestResultView::displayNone()
+{
+ TreeModel *tm;
+
+ tm = static_cast<TreeModel *>(astView->model());
+ Q_ASSERT(tm);
+ tm->setRoot(0);
+
+ tm = static_cast<TreeModel *>(messageOutput->model());
+ Q_ASSERT(tm);
+ tm->setRoot(0);
+
+ tm = static_cast<TreeModel *>(itemListResult->model());
+ Q_ASSERT(tm);
+ tm->setRoot(0);
+
+ serializedResult->clear();
+ resultStatus->clear();
+}
+
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/TestResultView.h b/tests/auto/xmlpatternsview/view/TestResultView.h
new file mode 100644
index 0000000..a934fcb
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/TestResultView.h
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#ifndef PatternistSDK_TestResultView_H
+#define PatternistSDK_TestResultView_H
+
+#include <QDockWidget>
+
+#include "ui_ui_TestResultView.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternistSDK
+{
+ class TestCase;
+ class TestResult;
+
+ /**
+ * @short Displays the result of running a test case.
+ *
+ * @ingroup PatternistSDK
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class TestResultView : public QDockWidget,
+ public Ui_TestResultViewCentralWidget
+ {
+ Q_OBJECT
+ public:
+ TestResultView(QWidget *const parent);
+
+ void displayTestResult(const TestResult *const result);
+
+ public Q_SLOTS:
+ void displayTestResult(TestCase *const result);
+
+ private:
+ void displayNone();
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/TreeSortFilter.cpp b/tests/auto/xmlpatternsview/view/TreeSortFilter.cpp
new file mode 100644
index 0000000..d7de3c2
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/TreeSortFilter.cpp
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#include <QtDebug>
+
+#include "TreeSortFilter.h"
+
+using namespace QPatternistSDK;
+
+TreeSortFilter::TreeSortFilter(QObject *p) : QSortFilterProxyModel(p)
+{
+ Q_ASSERT(p);
+}
+
+bool TreeSortFilter::lessThan(const QModelIndex &left,
+ const QModelIndex &right) const
+{
+ const QVariant leftData(sourceModel()->data(left));
+ const QVariant rightData(sourceModel()->data(right));
+
+ return numericLessThan(leftData.toString(), rightData.toString());
+}
+
+bool TreeSortFilter::numericLessThan(const QString &l, const QString &r) const
+{
+ QString ls(l);
+ QString rs(r);
+ const int len = (l.length() > r.length() ? r.length() : l.length());
+
+ for(int i = 0;i < len; ++i)
+ {
+ const QChar li(l.at(i));
+ const QChar ri(r.at(i));
+
+ if(li >= QLatin1Char('0') &&
+ li <= QLatin1Char('9') &&
+ ri >= QLatin1Char('0') &&
+ ri <= QLatin1Char('9'))
+ {
+ ls = l.mid(i);
+ rs = r.mid(i);
+ break;
+ }
+ else if(li != ri)
+ break;
+ }
+
+ const int ld = ls.toInt();
+ const int rd = rs.toInt();
+
+ if(ld == rd)
+ return ls.localeAwareCompare(rs) < 0;
+ else
+ return ld < rd;
+}
+
+bool TreeSortFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+{
+ if(filterRegExp().isEmpty())
+ return true;
+
+ QModelIndex current(sourceModel()->index(sourceRow, filterKeyColumn(), sourceParent));
+
+ if(sourceModel()->hasChildren(current))
+ {
+ bool atLeastOneValidChild = false;
+ int i = 0;
+ while(!atLeastOneValidChild)
+ {
+ const QModelIndex child(current.child(i, current.column()));
+ if(!child.isValid())
+ // No valid child
+ break;
+
+ atLeastOneValidChild = filterAcceptsRow(i, current);
+ i++;
+ }
+ return atLeastOneValidChild;
+ }
+
+ return sourceModel()->data(current).toString().contains(filterRegExp());
+}
+
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/TreeSortFilter.h b/tests/auto/xmlpatternsview/view/TreeSortFilter.h
new file mode 100644
index 0000000..80e5fc5
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/TreeSortFilter.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#ifndef PatternistSDK_TreeSortFilter_H
+#define PatternistSDK_TreeSortFilter_H
+
+#include <QSortFilterProxyModel>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternistSDK
+{
+ /**
+ * @short A sort & filter model for hierarchical item models.
+ *
+ * Features:
+ * - When sorting, numbers are treated as a whole instead of on a
+ * character-per-character basis. For example, @c myFile-10 is sorted after @c myFile-9.
+ * - When filtering, it behaves as usually is expected when the item model is hierarchical. That is,
+ * an item is shown if it matches or any of its children matches.
+ *
+ * @image html TreeSortFilter.png "TreeSortFilter in action on a QTreeView."
+ *
+ * @ingroup PatternistSDK
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class TreeSortFilter : public QSortFilterProxyModel
+ {
+ public:
+ /**
+ * Creates a TreeSortFilter.
+ *
+ * @param parent the parent. Must not be @c null.
+ */
+ TreeSortFilter(QObject *parent);
+
+ protected:
+ /**
+ * Compares @p left and @p right. They are treated as QStrings.
+ */
+ virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
+
+ /**
+ * Overridden to implement filtering.
+ */
+ virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+
+ private:
+ inline bool numericLessThan(const QString &l, const QString &r) const;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/UserTestCase.cpp b/tests/auto/xmlpatternsview/view/UserTestCase.cpp
new file mode 100644
index 0000000..7f2e6d0
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/UserTestCase.cpp
@@ -0,0 +1,200 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#include <QCoreApplication>
+#include <QDate>
+#include <QUrl>
+#include <QVariant>
+#include <QtDebug>
+
+#include "TestResult.h"
+
+#include "UserTestCase.h"
+
+using namespace QPatternistSDK;
+
+UserTestCase::UserTestCase() : m_lang(QXmlQuery::XQuery10)
+{
+}
+
+QVariant UserTestCase::data(const Qt::ItemDataRole role, int /*column*/) const
+{
+ if(role != Qt::DisplayRole)
+ return QVariant();
+
+ return title();
+}
+
+QString UserTestCase::creator() const
+{
+ return QString(QLatin1String("The user of %1."))
+ .arg(QCoreApplication::instance()->applicationName());
+}
+
+QString UserTestCase::name() const
+{
+ return QString(QLatin1String("X-KDE-%1-UserCreated"))
+ .arg(QCoreApplication::instance()->applicationName());
+}
+
+QString UserTestCase::description() const
+{
+ return QLatin1String("No description available; the test case is not part of "
+ "a test suite, but entered manually in the source code window.");
+}
+
+QString UserTestCase::title() const
+{
+ return QLatin1String("User Specified Test");
+}
+
+TestCase::Scenario UserTestCase::scenario() const
+{
+ return Standard;
+}
+
+TestBaseLine::List UserTestCase::baseLines() const
+{
+ TestBaseLine::List retval;
+
+ TestBaseLine *const bl = new TestBaseLine(TestBaseLine::Ignore);
+ retval.append(bl);
+
+ return retval;
+}
+
+void UserTestCase::setSourceCode(const QString &code)
+{
+ m_sourceCode = code;
+}
+
+QString UserTestCase::sourceCode(bool &ok) const
+{
+ ok = true;
+ return m_sourceCode;
+}
+
+QDate UserTestCase::lastModified() const
+{
+ return QDate();
+}
+
+bool UserTestCase::isXPath() const
+{
+ return true;
+}
+
+TreeItem *UserTestCase::parent() const
+{
+ return 0;
+}
+
+int UserTestCase::columnCount() const
+{
+ return 1;
+}
+
+QUrl UserTestCase::testCasePath() const
+{
+ return QUrl::fromLocalFile(QCoreApplication::applicationDirPath());
+}
+
+QPatternist::ExternalVariableLoader::Ptr UserTestCase::externalVariableLoader() const
+{
+ /* We don't have any bindings for the query that the user writes. */
+ return QPatternist::ExternalVariableLoader::Ptr();
+}
+
+QUrl UserTestCase::contextItemSource() const
+{
+ return m_contextSource;
+}
+
+void UserTestCase::focusDocumentChanged(const QString &code)
+{
+ const QUrl focusDoc(code);
+ if(focusDoc.isValid())
+ m_contextSource = focusDoc;
+}
+
+// vim: et:ts=4:sw=4:sts=4
+
diff --git a/tests/auto/xmlpatternsview/view/UserTestCase.h b/tests/auto/xmlpatternsview/view/UserTestCase.h
new file mode 100644
index 0000000..a00765e
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/UserTestCase.h
@@ -0,0 +1,167 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#ifndef PatternistSDK_UserTestCase_H
+#define PatternistSDK_UserTestCase_H
+
+#include <QString>
+
+#include "TestCase.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternistSDK
+{
+ /**
+ * @short Displays a test case entered manually by the user.
+ *
+ * @ingroup PatternistSDK
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class UserTestCase : public TestCase
+ {
+ Q_OBJECT
+ public:
+ UserTestCase();
+ virtual QString creator() const;
+ virtual QString description() const;
+ virtual QDate lastModified() const;
+
+ /**
+ * @returns the query the user has entered in the editor.
+ * @param ok is always set to @c true
+ */
+ virtual QString sourceCode(bool &ok) const;
+ virtual bool isXPath() const;
+ virtual QVariant data(const Qt::ItemDataRole role, int column) const;
+ virtual QString title() const;
+ virtual QString name() const;
+ /**
+ * Performs an assert crash.
+ */
+ virtual QUrl testCasePath() const;
+ virtual TreeItem *parent() const;
+ virtual int columnCount() const;
+
+ virtual Scenario scenario() const;
+
+ /**
+ * @returns always a default constructed QUrl.
+ */
+ virtual QUrl contextItemSource() const;
+
+ /**
+ * @return an empty list.
+ */
+ virtual TestBaseLine::List baseLines() const;
+
+ void setLanguage(const QXmlQuery::QueryLanguage lang)
+ {
+ m_lang = lang;
+ }
+
+ virtual QPatternist::ExternalVariableLoader::Ptr externalVariableLoader() const;
+
+ virtual QXmlQuery::QueryLanguage language() const
+ {
+ return m_lang;
+ }
+
+ public Q_SLOTS:
+ void setSourceCode(const QString &code);
+ void focusDocumentChanged(const QString &code);
+
+ private:
+ QString m_sourceCode;
+ QXmlQuery::QueryLanguage m_lang;
+ QUrl m_contextSource;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/XDTItemItem.cpp b/tests/auto/xmlpatternsview/view/XDTItemItem.cpp
new file mode 100644
index 0000000..d8a9b4d
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/XDTItemItem.cpp
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#include <QList>
+#include <QPointer>
+#include <QVariant>
+
+#include "Global.h"
+
+#include "qitem_p.h"
+#include "qreportcontext_p.h"
+
+#include "XDTItemItem.h"
+
+using namespace QPatternistSDK;
+
+XDTItemItem::XDTItemItem(const QPatternist::Item &item,
+ XDTItemItem *p) : m_item(item),
+ m_parent(p)
+{
+}
+
+XDTItemItem::~XDTItemItem()
+{
+ qDeleteAll(m_children);
+}
+
+int XDTItemItem::columnCount() const
+{
+ return 3;
+}
+
+QVariant XDTItemItem::data(const Qt::ItemDataRole role, int column) const
+{
+ Q_ASSERT(m_item);
+ if(role != Qt::DisplayRole)
+ return QVariant();
+
+ switch(column)
+ {
+ case 0:
+ /* + 1: We don't want the index; the XDT counts from 1. */
+ return row() + 1;
+ case 1:
+ return m_item.stringValue();
+ case 2:
+ return m_item.type()->displayName(Global::namePool());
+ default:
+ {
+ Q_ASSERT(false);
+ return QString();
+ }
+ }
+}
+
+TreeItem::List XDTItemItem::children() const
+{
+ return m_children;
+}
+
+void XDTItemItem::appendChild(TreeItem *item)
+{
+ m_children.append(item);
+}
+
+TreeItem *XDTItemItem::child(const unsigned int rowP) const
+{
+ return m_children.value(rowP);
+}
+
+unsigned int XDTItemItem::childCount() const
+{
+ return m_children.count();
+}
+
+TreeItem *XDTItemItem::parent() const
+{
+ return m_parent;
+}
+
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/XDTItemItem.h b/tests/auto/xmlpatternsview/view/XDTItemItem.h
new file mode 100644
index 0000000..19b1fdc
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/XDTItemItem.h
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#ifndef PatternistSDK_XDTItemItem_H
+#define PatternistSDK_XDTItemItem_H
+
+#include <QList>
+#include "qitem_p.h"
+
+#include "TreeItem.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternistSDK
+{
+ /**
+ * @short Proxies an QPatternist::Item through the TreeItem
+ * interface such that Patternist data can be used in Qt's model/view
+ * framework.
+ *
+ * @ingroup PatternistSDK
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class XDTItemItem : public TreeItem
+ {
+ public:
+ XDTItemItem(const QPatternist::Item &item,
+ XDTItemItem *parent);
+ virtual ~XDTItemItem();
+
+ virtual QVariant data(const Qt::ItemDataRole role, int column) const;
+
+ virtual void appendChild(TreeItem *item);
+ virtual TreeItem *child(const unsigned int row) const;
+ virtual unsigned int childCount() const;
+ virtual TreeItem::List children() const;
+ virtual TreeItem *parent() const;
+ int columnCount() const;
+
+ private:
+ const QPatternist::Item m_item;
+ XDTItemItem *m_parent;
+ TreeItem::List m_children;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/main.cpp b/tests/auto/xmlpatternsview/view/main.cpp
new file mode 100644
index 0000000..fdb895c
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/main.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+
+#include <QtDebug>
+
+#include "Global.h"
+#include "MainWindow.h"
+#include "TestSuiteHandler.h"
+
+using namespace QPatternistSDK;
+
+int main(int argc, char *argv[])
+{
+ const QApplication app(argc, argv);
+ app.setOrganizationName(Global::organizationName);
+ app.setApplicationName(QLatin1String("PatternistSDKView"));
+
+ MainWindow *const mainWindow = new MainWindow();
+ mainWindow->show();
+
+ return app.exec();
+}
+
+// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternsview/view/ui_BaseLinePage.ui b/tests/auto/xmlpatternsview/view/ui_BaseLinePage.ui
new file mode 100644
index 0000000..9d42b80
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/ui_BaseLinePage.ui
@@ -0,0 +1,48 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>BaseLinePage</class>
+ <widget class="QWidget" name="BaseLinePage" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QTextEdit" name="contentEdit" >
+ <property name="font" >
+ <font>
+ <family>Fixed [Sony]</family>
+ <pointsize>9</pointsize>
+ <weight>50</weight>
+ <italic>false</italic>
+ <bold>false</bold>
+ <underline>false</underline>
+ <strikeout>false</strikeout>
+ </font>
+ </property>
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/xmlpatternsview/view/ui_FunctionSignaturesView.ui b/tests/auto/xmlpatternsview/view/ui_FunctionSignaturesView.ui
new file mode 100644
index 0000000..1990800
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/ui_FunctionSignaturesView.ui
@@ -0,0 +1,70 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>FunctionSignaturesViewCentralWidget</class>
+ <widget class="QWidget" name="FunctionSignaturesViewCentralWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>8</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="signatureInfo" >
+ <property name="text" >
+ <string>The following function signatures are available:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="signatureList" />
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="countInfo" >
+ <property name="text" >
+ <string>Count:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/xmlpatternsview/view/ui_MainWindow.ui b/tests/auto/xmlpatternsview/view/ui_MainWindow.ui
new file mode 100644
index 0000000..5d74331
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/ui_MainWindow.ui
@@ -0,0 +1,310 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>402</width>
+ <height>827</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>QtXmlPatterns View</string>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QTabWidget" name="sourceTab">
+ <property name="currentIndex">
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="tabTestSuite">
+ <attribute name="title">
+ <string>&amp;Test Suite</string>
+ </attribute>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>9</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="infoSearch">
+ <property name="text">
+ <string>S&amp;earch:</string>
+ </property>
+ <property name="buddy">
+ <cstring>searchInput</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="searchInput"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTreeView" name="testSuiteView">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tabSourceCode">
+ <attribute name="title">
+ <string>&amp;Source Code</string>
+ </attribute>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QTextEdit" name="sourceInput">
+ <property name="font">
+ <font>
+ <family>Fixed [Sony]</family>
+ <pointsize>14</pointsize>
+ <weight>50</weight>
+ <italic>false</italic>
+ <bold>false</bold>
+ <underline>false</underline>
+ <strikeout>false</strikeout>
+ </font>
+ </property>
+ <property name="acceptRichText">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="isXSLT20">
+ <property name="text">
+ <string>Is XSL-T 2.0</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="compileOnly">
+ <property name="toolTip">
+ <string>When enabled, the query will not be run, only compiled.</string>
+ </property>
+ <property name="text">
+ <string>Compile &amp;Only</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="infoTestCaseCout">
+ <property name="text">
+ <string>Test Case Count:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="testCaseCount">
+ <property name="text">
+ <string>The Count</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Minimum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Focus document(URI):</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="focusURI"/>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="widgetMenuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>402</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>&amp;File</string>
+ </property>
+ <addaction name="actionOpen"/>
+ <addaction name="actionOpenXSLTSCatalog"/>
+ <addaction name="actionExecute"/>
+ <addaction name="separator"/>
+ <addaction name="actionRestart"/>
+ <addaction name="actionQuit"/>
+ </widget>
+ <widget class="QMenu" name="menuWindows">
+ <property name="title">
+ <string>&amp;Windows</string>
+ </property>
+ </widget>
+ <addaction name="menuFile"/>
+ <addaction name="menuWindows"/>
+ </widget>
+ <action name="actionOpen">
+ <property name="text">
+ <string>&amp;Open XQTS Catalog...</string>
+ </property>
+ <property name="toolTip">
+ <string>Opens a Test Suite Catalog in the format specified by W3C's XQuery Test Suite Task Force. XQTS's catalog is called XQTSCatalog.xml. The format is specified in XQTSCatalog.xsd</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+O</string>
+ </property>
+ </action>
+ <action name="actionOpen_Recent">
+ <property name="text">
+ <string>Open Recent</string>
+ </property>
+ </action>
+ <action name="actionExecute">
+ <property name="text">
+ <string>Execute Test</string>
+ </property>
+ <property name="toolTip">
+ <string>Executes the selected test, or the tests in the selected group.</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+E</string>
+ </property>
+ </action>
+ <action name="actionRestart">
+ <property name="text">
+ <string>Restart</string>
+ </property>
+ <property name="toolTip">
+ <string>Restarts this program by shutting down and starting up again, such that changes in libraries are used.</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+R</string>
+ </property>
+ </action>
+ <action name="actionQuit">
+ <property name="text">
+ <string>Quit</string>
+ </property>
+ <property name="toolTip">
+ <string>Simply shuts down the program.</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Q</string>
+ </property>
+ </action>
+ <action name="actionOpenXSLTSCatalog">
+ <property name="text">
+ <string>O&amp;pen XSLTS Catalog...</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+L</string>
+ </property>
+ </action>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/xmlpatternsview/view/ui_TestCaseView.ui b/tests/auto/xmlpatternsview/view/ui_TestCaseView.ui
new file mode 100644
index 0000000..7b6e9a8
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/ui_TestCaseView.ui
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>TestCaseViewCentralWidget</class>
+ <widget class="QWidget" name="TestCaseViewCentralWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>472</width>
+ <height>724</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QStackedWidget" name="stackedWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="page">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="name">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <family>Sans Serif</family>
+ <pointsize>15</pointsize>
+ <weight>50</weight>
+ <italic>false</italic>
+ <bold>false</bold>
+ <underline>false</underline>
+ <strikeout>false</strikeout>
+ </font>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;test name&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::RichText</enum>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="description">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;description&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="indent">
+ <number>14</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Source Code</string>
+ </property>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QTextEdit" name="sourceEdit">
+ <property name="font">
+ <font>
+ <family>Fixed [Sony]</family>
+ <pointsize>9</pointsize>
+ <weight>50</weight>
+ <italic>false</italic>
+ <bold>false</bold>
+ <underline>false</underline>
+ <strikeout>false</strikeout>
+ </font>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QTabWidget" name="baselinesTabs">
+ <property name="currentIndex">
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>Tab 1</string>
+ </attribute>
+ </widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string>Tab 2</string>
+ </attribute>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="TypeExpl">
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="type">
+ <property name="text">
+ <string>type</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="isXPathOnlyExpl">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Is XPath Only Test:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="isXPath">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;is xpath only&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="authorExpl">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Author:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="author">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;author&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="lastModifiedExpl">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Last Modified:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="lastModified">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;last modified&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="focusDocumentExpl">
+ <property name="text">
+ <string>Focus document:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLineEdit" name="focusDocument">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page2">
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="noSelectionInfo">
+ <property name="text">
+ <string>No test case is selected.
+
+This dock widget displays information about a test case, when selected in the tree view.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/xmlpatternsview/view/ui_TestResultView.ui b/tests/auto/xmlpatternsview/view/ui_TestResultView.ui
new file mode 100644
index 0000000..bed70ac
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/ui_TestResultView.ui
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>TestResultViewCentralWidget</class>
+ <widget class="QWidget" name="TestResultViewCentralWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>458</width>
+ <height>571</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="resultStatusInfo">
+ <property name="text">
+ <string>Result Status:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="resultStatus">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QSplitter" name="splitter_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QGroupBox" name="astViewInfo">
+ <property name="title">
+ <string>Abstract Syntax Tree</string>
+ </property>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QTreeView" name="astView">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Output</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QStackedWidget" name="outputStack">
+ <property name="currentIndex">
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="page">
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QTextEdit" name="serializedResult">
+ <property name="font">
+ <font>
+ <family>Fixed [Sony]</family>
+ <pointsize>9</pointsize>
+ <weight>50</weight>
+ <italic>false</italic>
+ <bold>false</bold>
+ <underline>false</underline>
+ <strikeout>false</strikeout>
+ </font>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="html">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Fixed [Sony]'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page2">
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QTableView" name="itemListResult">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="viewAsInfo">
+ <property name="text">
+ <string>View as:</string>
+ </property>
+ <property name="buddy">
+ <cstring>resultViewSelection</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="resultViewSelection">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip">
+ <string/>
+ </property>
+ <item>
+ <property name="text">
+ <string>XQuery/XSL-T Serialization</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Item List</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QGroupBox" name="MessagesInfo">
+ <property name="title">
+ <string>Messages</string>
+ </property>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QTableView" name="messageOutput">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>resultViewSelection</sender>
+ <signal>activated(int)</signal>
+ <receiver>outputStack</receiver>
+ <slot>setCurrentIndex(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>427</x>
+ <y>345</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>426</x>
+ <y>214</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/tests/auto/xmlpatternsview/view/view.pro b/tests/auto/xmlpatternsview/view/view.pro
new file mode 100644
index 0000000..f9d36ee
--- /dev/null
+++ b/tests/auto/xmlpatternsview/view/view.pro
@@ -0,0 +1,35 @@
+TARGET = xmlpatternsview
+TEMPLATE = app
+DESTDIR = $$QT_BUILD_TREE/bin
+
+include (../../xmlpatterns.pri)
+
+# We add gui here, since xmlpatterns.pri pull it out.
+QT += xmlpatterns xml gui
+
+LIBS += -l$$XMLPATTERNS_SDK
+
+HEADERS = FunctionSignaturesView.h \
+ MainWindow.h \
+ TestCaseView.h \
+ TestResultView.h \
+ TreeSortFilter.h \
+ UserTestCase.h \
+ XDTItemItem.h
+
+SOURCES = FunctionSignaturesView.cpp \
+ main.cpp \
+ MainWindow.cpp \
+ TestCaseView.cpp \
+ TestResultView.cpp \
+ TreeSortFilter.cpp \
+ UserTestCase.cpp \
+ XDTItemItem.cpp
+
+FORMS = ui_BaseLinePage.ui \
+ ui_MainWindow.ui \
+ ui_TestCaseView.ui \
+ ui_TestResultView.ui \
+ ui_FunctionSignaturesView.ui
+
+INCLUDEPATH += $$QT_SOURCE_TREE/tests/auto/xmlpatternsxqts/lib/ $$QT_BUILD_TREE/include/QtXmlPatterns/private
diff --git a/tests/auto/xmlpatternsview/xmlpatternsview.pro b/tests/auto/xmlpatternsview/xmlpatternsview.pro
new file mode 100644
index 0000000..3544264
--- /dev/null
+++ b/tests/auto/xmlpatternsview/xmlpatternsview.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+CONFIG += ordered
+
+SUBDIRS = ../xmlpatternsxqts test
+
+contains(QT_CONFIG,xmlpatterns) {
+ SUBDIRS += view
+}