summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAnselmo L. S. Melo <anselmo.melo@openbossa.org>2012-03-07 10:23:40 -0300
committerLuis Gabriel Lima <luis.gabriel@openbossa.org>2012-03-15 01:16:09 +0100
commit4b685173718b42e9308fbe62720105d5f980d542 (patch)
tree86983f359d08b2cd7b1cfbf8db8dfbc07bae2426 /tests
parent163f7235af40f33bfc7d837acc6c8fff639ffbd9 (diff)
Rename Q* classes to Ui*
UiHelpers classes were renamed to avoid conflicts, such as the header names when we do 'make install', for example. Change-Id: I9cea34788353be886211ddf5898cca5c3b15e42a Reviewed-by: Luis Gabriel Lima <luis.gabriel@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/models/qfilesystemmodel/tst_qfilesystemmodel.cpp114
-rw-r--r--tests/auto/models/qstandarditemmodel/tst_qstandarditemmodel.cpp324
-rw-r--r--tests/auto/undo/qundogroup/qundogroup.pro6
-rw-r--r--tests/auto/undo/qundostack/qundostack.pro6
-rw-r--r--tests/auto/undo/undo.pro4
-rw-r--r--tests/auto/utils/uiundogroup/.gitignore (renamed from tests/auto/undo/qundogroup/.gitignore)0
-rw-r--r--tests/auto/utils/uiundogroup/testdata/qundogroup.ts (renamed from tests/auto/undo/qundogroup/testdata/qundogroup.ts)0
-rw-r--r--tests/auto/utils/uiundogroup/tst_uiundogroup.cpp (renamed from tests/auto/undo/qundogroup/tst_qundogroup.cpp)130
-rw-r--r--tests/auto/utils/uiundogroup/uiundogroup.pro6
-rw-r--r--tests/auto/utils/uiundostack/.gitignore (renamed from tests/auto/undo/qundostack/.gitignore)0
-rw-r--r--tests/auto/utils/uiundostack/testdata/qundostack.ts (renamed from tests/auto/undo/qundostack/testdata/qundostack.ts)0
-rw-r--r--tests/auto/utils/uiundostack/tst_uiundostack.cpp (renamed from tests/auto/undo/qundostack/tst_qundostack.cpp)98
-rw-r--r--tests/auto/utils/uiundostack/uiundostack.pro6
-rw-r--r--tests/auto/utils/utils.pro4
15 files changed, 350 insertions, 350 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index e094c1b..6d6a9ad 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
SUBDIRS += \
- undo \
+ utils \
models
diff --git a/tests/auto/models/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/models/qfilesystemmodel/tst_qfilesystemmodel.cpp
index cf8e5ff..fec947a 100644
--- a/tests/auto/models/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/models/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -42,9 +42,9 @@
#include "uihelpersglobal.h"
#include <QtTest/QtTest>
#ifdef QT_BUILD_INTERNAL
-#include <private/qfilesystemmodel_p.h>
+#include <private/uifilesystemmodel_p.h>
#endif
-#include <UiHelpers/QFileSystemModel>
+#include <UiHelpers/UiFileSystemModel>
#include <QTime>
#include <QtGlobal>
@@ -62,12 +62,12 @@ QT_USE_NAMESPACE_UIHELPERS
} \
} while (0)
-class tst_QFileSystemModel : public QObject {
+class tst_UiFileSystemModel : public QObject {
Q_OBJECT
public:
- tst_QFileSystemModel();
- virtual ~tst_QFileSystemModel();
+ tst_UiFileSystemModel();
+ virtual ~tst_UiFileSystemModel();
public Q_SLOTS:
void init();
@@ -122,11 +122,11 @@ protected:
bool createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount = 0, const QStringList &intial_dirs = QStringList(), const QString &baseDir = QDir::temp().absolutePath());
private:
- QFileSystemModel *model;
+ UiFileSystemModel *model;
QString flatDirTestPath;
};
-tst_QFileSystemModel::tst_QFileSystemModel() : model(0)
+tst_UiFileSystemModel::tst_UiFileSystemModel() : model(0)
{
qRegisterMetaType<QModelIndex>("QModelIndex");
@@ -136,7 +136,7 @@ tst_QFileSystemModel::tst_QFileSystemModel() : model(0)
flatDirTestPath = QDir::temp().path() + '/' + QString("flatdirtest.") + QString::number(qrand());
}
-tst_QFileSystemModel::~tst_QFileSystemModel()
+tst_UiFileSystemModel::~tst_UiFileSystemModel()
{
QString tmp = flatDirTestPath;
QDir dir(tmp);
@@ -144,14 +144,14 @@ tst_QFileSystemModel::~tst_QFileSystemModel()
qWarning("failed to remove tmp dir %s", dir.dirName().toAscii().data());
}
-void tst_QFileSystemModel::init()
+void tst_UiFileSystemModel::init()
{
cleanup();
- QCOMPARE(model, (QFileSystemModel*)0);
- model = new QFileSystemModel;
+ QCOMPARE(model, (UiFileSystemModel*)0);
+ model = new UiFileSystemModel;
}
-void tst_QFileSystemModel::cleanup()
+void tst_UiFileSystemModel::cleanup()
{
delete model;
model = 0;
@@ -175,7 +175,7 @@ void tst_QFileSystemModel::cleanup()
}
}
-void tst_QFileSystemModel::indexPath()
+void tst_UiFileSystemModel::indexPath()
{
#if !defined(Q_OS_WIN)
int depth = QDir::currentPath().count('/');
@@ -192,7 +192,7 @@ void tst_QFileSystemModel::indexPath()
#endif
}
-void tst_QFileSystemModel::rootPath()
+void tst_UiFileSystemModel::rootPath()
{
QCOMPARE(model->rootPath(), QString(QDir().path()));
@@ -230,7 +230,7 @@ void tst_QFileSystemModel::rootPath()
}
}
-void tst_QFileSystemModel::naturalCompare_data()
+void tst_UiFileSystemModel::naturalCompare_data()
{
QTest::addColumn<QString>("s1");
QTest::addColumn<QString>("s2");
@@ -277,7 +277,7 @@ void tst_QFileSystemModel::naturalCompare_data()
#undef ROWNAME
}
-void tst_QFileSystemModel::naturalCompare()
+void tst_UiFileSystemModel::naturalCompare()
{
#ifdef QT_BUILD_INTERNAL
QFETCH(QString, s1);
@@ -286,12 +286,12 @@ void tst_QFileSystemModel::naturalCompare()
QFETCH(int, result);
if (result == 10)
- QCOMPARE(QFileSystemModelPrivate::naturalCompare(s1, s2, Qt::CaseSensitivity(caseSensitive)), -1);
+ QCOMPARE(UiFileSystemModelPrivate::naturalCompare(s1, s2, Qt::CaseSensitivity(caseSensitive)), -1);
else
if (result == 11)
- QCOMPARE(QFileSystemModelPrivate::naturalCompare(s2, s1, Qt::CaseSensitivity(caseSensitive)), 1);
+ QCOMPARE(UiFileSystemModelPrivate::naturalCompare(s2, s1, Qt::CaseSensitivity(caseSensitive)), 1);
else
- QCOMPARE(QFileSystemModelPrivate::naturalCompare(s2, s1, Qt::CaseSensitivity(caseSensitive)), result);
+ QCOMPARE(UiFileSystemModelPrivate::naturalCompare(s2, s1, Qt::CaseSensitivity(caseSensitive)), result);
#if defined(Q_OS_WINCE)
// On Windows CE we need to wait after each test, otherwise no new threads can be
// created. The scheduler takes its time to recognize ended threads.
@@ -300,7 +300,7 @@ void tst_QFileSystemModel::naturalCompare()
#endif
}
-void tst_QFileSystemModel::readOnly()
+void tst_UiFileSystemModel::readOnly()
{
QCOMPARE(model->isReadOnly(), true);
QTemporaryFile file;
@@ -315,7 +315,7 @@ void tst_QFileSystemModel::readOnly()
}
-bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount, const QStringList &initial_dirs, const QString &dir)
+bool tst_UiFileSystemModel::createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount, const QStringList &initial_dirs, const QString &dir)
{
QDir baseDir(dir);
if (!baseDir.exists(test_path)) {
@@ -362,7 +362,7 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi
return true;
}
-void tst_QFileSystemModel::rowCount()
+void tst_UiFileSystemModel::rowCount()
{
QString tmp = flatDirTestPath;
QVERIFY(createFiles(tmp, QStringList()));
@@ -386,7 +386,7 @@ void tst_QFileSystemModel::rowCount()
QVERIFY(spy3.count() > 0);
}
-void tst_QFileSystemModel::rowsInserted_data()
+void tst_UiFileSystemModel::rowsInserted_data()
{
QTest::addColumn<int>("count");
QTest::addColumn<int>("assending");
@@ -396,7 +396,7 @@ void tst_QFileSystemModel::rowsInserted_data()
}
}
-void tst_QFileSystemModel::rowsInserted()
+void tst_UiFileSystemModel::rowsInserted()
{
#if defined(Q_OS_WINCE)
QSKIP("Watching directories does not work on CE(see #137910)");
@@ -446,12 +446,12 @@ void tst_QFileSystemModel::rowsInserted()
if (count != 0) QTRY_VERIFY(spy1.count() >= 1); else QTRY_VERIFY(spy1.count() == 0);
}
-void tst_QFileSystemModel::rowsRemoved_data()
+void tst_UiFileSystemModel::rowsRemoved_data()
{
rowsInserted_data();
}
-void tst_QFileSystemModel::rowsRemoved()
+void tst_UiFileSystemModel::rowsRemoved()
{
#if defined(Q_OS_WINCE)
QSKIP("Watching directories does not work on CE(see #137910)");
@@ -506,12 +506,12 @@ void tst_QFileSystemModel::rowsRemoved()
if (count != 0) QVERIFY(spy1.count() >= 1); else QVERIFY(spy1.count() == 0);
}
-void tst_QFileSystemModel::dataChanged_data()
+void tst_UiFileSystemModel::dataChanged_data()
{
rowsInserted_data();
}
-void tst_QFileSystemModel::dataChanged()
+void tst_UiFileSystemModel::dataChanged()
{
// This can't be tested right now sense we don't watch files, only directories
return;
@@ -537,7 +537,7 @@ void tst_QFileSystemModel::dataChanged()
*/
}
-void tst_QFileSystemModel::filters_data()
+void tst_UiFileSystemModel::filters_data()
{
QTest::addColumn<QStringList>("files");
QTest::addColumn<QStringList>("dirs");
@@ -596,7 +596,7 @@ void tst_QFileSystemModel::filters_data()
<< QStringList() << (int)(QDir::Files) << QStringList() << 5;
}
-void tst_QFileSystemModel::filters()
+void tst_UiFileSystemModel::filters()
{
QString tmp = flatDirTestPath;
QVERIFY(createFiles(tmp, QStringList()));
@@ -630,7 +630,7 @@ void tst_QFileSystemModel::filters()
QStringList modelEntries;
for (int i = 0; i < rowCount; ++i)
- modelEntries.append(model->data(model->index(i, 0, root), QFileSystemModel::FileNameRole).toString());
+ modelEntries.append(model->data(model->index(i, 0, root), UiFileSystemModel::FileNameRole).toString());
qSort(dirEntries);
qSort(modelEntries);
@@ -663,7 +663,7 @@ void tst_QFileSystemModel::filters()
#endif
}
-void tst_QFileSystemModel::nameFilters()
+void tst_UiFileSystemModel::nameFilters()
{
QStringList list;
list << "a" << "b" << "c";
@@ -681,7 +681,7 @@ void tst_QFileSystemModel::nameFilters()
model->setNameFilters(filters);
QTRY_COMPARE(model->rowCount(root), 2);
}
-void tst_QFileSystemModel::setData_data()
+void tst_UiFileSystemModel::setData_data()
{
QTest::addColumn<QStringList>("files");
QTest::addColumn<QString>("oldFileName");
@@ -698,7 +698,7 @@ void tst_QFileSystemModel::setData_data()
<< true;
}
-void tst_QFileSystemModel::setData()
+void tst_UiFileSystemModel::setData()
{
QSignalSpy spy(model, SIGNAL(fileRenamed(const QString&, const QString&, const QString&)));
QString tmp = flatDirTestPath;
@@ -720,7 +720,7 @@ void tst_QFileSystemModel::setData()
if (success) {
QCOMPARE(spy.count(), 1);
QList<QVariant> arguments = spy.takeFirst();
- QCOMPARE(model->data(idx, QFileSystemModel::FileNameRole).toString(), newFileName);
+ QCOMPARE(model->data(idx, UiFileSystemModel::FileNameRole).toString(), newFileName);
QCOMPARE(model->index(arguments.at(0).toString()), model->index(tmp));
QCOMPARE(arguments.at(1).toString(), oldFileName);
QCOMPARE(arguments.at(2).toString(), newFileName);
@@ -729,20 +729,20 @@ void tst_QFileSystemModel::setData()
QTRY_COMPARE(model->rowCount(root), files.count());
}
-class MyFriendFileSystemModel : public QFileSystemModel
+class MyFriendFileSystemModel : public UiFileSystemModel
{
- friend class tst_QFileSystemModel;
- Q_DECLARE_PRIVATE(QFileSystemModel)
+ friend class tst_UiFileSystemModel;
+ Q_DECLARE_PRIVATE(UiFileSystemModel)
};
-void tst_QFileSystemModel::sort_data()
+void tst_UiFileSystemModel::sort_data()
{
QTest::addColumn<bool>("fileDialogMode");
QTest::newRow("standard usage") << false;
QTest::newRow("QFileDialog usage") << true;
}
-void tst_QFileSystemModel::sort()
+void tst_UiFileSystemModel::sort()
{
QTemporaryFile file;
file.open();
@@ -824,14 +824,14 @@ void tst_QFileSystemModel::sort()
QList<QString> actualRows;
for (int i = 0; i < myModel->rowCount(parent); ++i)
{
- actualRows << dirPath + QChar('/') + myModel->index(i, 1, parent).data(QFileSystemModel::FileNameRole).toString();
+ actualRows << dirPath + QChar('/') + myModel->index(i, 1, parent).data(UiFileSystemModel::FileNameRole).toString();
}
QVERIFY(actualRows != expectedOrder);
#endif
} else {
for (int i = 0; i < myModel->rowCount(parent); ++i)
{
- QTRY_COMPARE(dirPath + QChar('/') + myModel->index(i, 1, parent).data(QFileSystemModel::FileNameRole).toString(), expectedOrder.at(i));
+ QTRY_COMPARE(dirPath + QChar('/') + myModel->index(i, 1, parent).data(UiFileSystemModel::FileNameRole).toString(), expectedOrder.at(i));
}
}
@@ -847,7 +847,7 @@ void tst_QFileSystemModel::sort()
}
-void tst_QFileSystemModel::mkdir()
+void tst_UiFileSystemModel::mkdir()
{
QString tmp = QDir::tempPath();
QString newFolderPath = QDir::toNativeSeparators(tmp + '/' + "NewFoldermkdirtest4");
@@ -874,7 +874,7 @@ void tst_QFileSystemModel::mkdir()
QCOMPARE(oldRow, idx.row());
}
-void tst_QFileSystemModel::caseSensitivity()
+void tst_UiFileSystemModel::caseSensitivity()
{
QString tmp = flatDirTestPath;
QStringList files;
@@ -888,7 +888,7 @@ void tst_QFileSystemModel::caseSensitivity()
}
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
-void tst_QFileSystemModel::Win32LongFileName()
+void tst_UiFileSystemModel::Win32LongFileName()
{
QString tmp = flatDirTestPath;
QStringList files;
@@ -901,7 +901,7 @@ void tst_QFileSystemModel::Win32LongFileName()
}
#endif
-void tst_QFileSystemModel::drives_data()
+void tst_UiFileSystemModel::drives_data()
{
QTest::addColumn<QString>("path");
QTest::newRow("current") << QDir::currentPath();
@@ -909,10 +909,10 @@ void tst_QFileSystemModel::drives_data()
QTest::newRow("My Computer") << "My Computer";
}
-void tst_QFileSystemModel::drives()
+void tst_UiFileSystemModel::drives()
{
QFETCH(QString, path);
- QFileSystemModel model;
+ UiFileSystemModel model;
model.setRootPath(path);
model.fetchMore(QModelIndex());
QFileInfoList drives = QDir::drives();
@@ -924,7 +924,7 @@ void tst_QFileSystemModel::drives()
QTRY_COMPARE(model.rowCount(), driveCount);
}
-void tst_QFileSystemModel::dirsBeforeFiles()
+void tst_UiFileSystemModel::dirsBeforeFiles()
{
const QString dirPath = QString("%1/task221717_sortedOrder_test_dir").arg(QDir::tempPath());
QDir dir(dirPath);
@@ -965,21 +965,21 @@ void tst_QFileSystemModel::dirsBeforeFiles()
}
}
-void tst_QFileSystemModel::roleNames_data()
+void tst_UiFileSystemModel::roleNames_data()
{
QTest::addColumn<int>("role");
QTest::addColumn<QByteArray>("roleName");
QTest::newRow("decoration") << int(Qt::DecorationRole) << QByteArray("decoration");
QTest::newRow("display") << int(Qt::DisplayRole) << QByteArray("display");
- //QTest::newRow("fileIcon") << int(QFileSystemModel::FileIconRole) << QByteArray("fileIcon");
- QTest::newRow("filePath") << int(QFileSystemModel::FilePathRole) << QByteArray("filePath");
- QTest::newRow("fileName") << int(QFileSystemModel::FileNameRole) << QByteArray("fileName");
- QTest::newRow("filePermissions") << int(QFileSystemModel::FilePermissions) << QByteArray("filePermissions");
+ //QTest::newRow("fileIcon") << int(UiFileSystemModel::FileIconRole) << QByteArray("fileIcon");
+ QTest::newRow("filePath") << int(UiFileSystemModel::FilePathRole) << QByteArray("filePath");
+ QTest::newRow("fileName") << int(UiFileSystemModel::FileNameRole) << QByteArray("fileName");
+ QTest::newRow("filePermissions") << int(UiFileSystemModel::FilePermissions) << QByteArray("filePermissions");
}
-void tst_QFileSystemModel::roleNames()
+void tst_UiFileSystemModel::roleNames()
{
- QFileSystemModel model;
+ UiFileSystemModel model;
QHash<int, QByteArray> roles = model.roleNames();
QFETCH(int, role);
@@ -990,6 +990,6 @@ void tst_QFileSystemModel::roleNames()
QVERIFY(values.contains(roleName));
}
-QTEST_MAIN(tst_QFileSystemModel)
+QTEST_MAIN(tst_UiFileSystemModel)
#include "tst_qfilesystemmodel.moc"
diff --git a/tests/auto/models/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/models/qstandarditemmodel/tst_qstandarditemmodel.cpp
index 555daa0..8d676f8 100644
--- a/tests/auto/models/qstandarditemmodel/tst_qstandarditemmodel.cpp
+++ b/tests/auto/models/qstandarditemmodel/tst_qstandarditemmodel.cpp
@@ -42,19 +42,19 @@
#include <QtTest/QtTest>
-#include <UiHelpers/qstandarditemmodel.h>
+#include <UiHelpers/uistandarditemmodel.h>
//#include <QTreeView>
//#include <private/qtreeview_p.h>
QT_USE_NAMESPACE_UIHELPERS;
-class tst_QStandardItemModel : public QObject
+class tst_UiStandardItemModel : public QObject
{
Q_OBJECT
public:
- tst_QStandardItemModel();
- virtual ~tst_QStandardItemModel();
+ tst_UiStandardItemModel();
+ virtual ~tst_UiStandardItemModel();
enum ModelChanged {
RowsAboutToBeInserted,
@@ -146,23 +146,23 @@ private:
QVector<int> rcLast;
//return true if models have the same structure, and all child have the same text
- bool compareModels(QStandardItemModel *model1, QStandardItemModel *model2);
+ bool compareModels(UiStandardItemModel *model1, UiStandardItemModel *model2);
//return true if models have the same structure, and all child have the same text
- bool compareItems(QStandardItem *item1, QStandardItem *item2);
+ bool compareItems(UiStandardItem *item1, UiStandardItem *item2);
};
static const int defaultSize = 3;
Q_DECLARE_METATYPE(QModelIndex)
-Q_DECLARE_METATYPE(QStandardItem*)
+Q_DECLARE_METATYPE(UiStandardItem*)
Q_DECLARE_METATYPE(Qt::Orientation)
Q_DECLARE_METATYPE(QVariantList)
-tst_QStandardItemModel::tst_QStandardItemModel() : m_model(0), rcParent(8), rcFirst(8,0), rcLast(8,0)
+tst_UiStandardItemModel::tst_UiStandardItemModel() : m_model(0), rcParent(8), rcFirst(8,0), rcLast(8,0)
{
}
-tst_QStandardItemModel::~tst_QStandardItemModel()
+tst_UiStandardItemModel::~tst_UiStandardItemModel()
{
}
@@ -176,13 +176,13 @@ tst_QStandardItemModel::~tst_QStandardItemModel()
| 2,0 | 2,1 | 2,2 |
---------------------------
*/
-void tst_QStandardItemModel::init()
+void tst_UiStandardItemModel::init()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
- qRegisterMetaType<QStandardItem*>("QStandardItem*");
+ qRegisterMetaType<UiStandardItem*>("UiStandardItem*");
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
- m_model = new QStandardItemModel(defaultSize, defaultSize);
+ m_model = new UiStandardItemModel(defaultSize, defaultSize);
connect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex, int, int)),
this, SLOT(rowsAboutToBeInserted(QModelIndex, int, int)));
connect(m_model, SIGNAL(rowsInserted(QModelIndex, int, int)),
@@ -205,7 +205,7 @@ void tst_QStandardItemModel::init()
rcLast.fill(-1);
}
-void tst_QStandardItemModel::cleanup()
+void tst_UiStandardItemModel::cleanup()
{
disconnect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex, int, int)),
this, SLOT(rowsAboutToBeInserted(QModelIndex, int, int)));
@@ -228,7 +228,7 @@ void tst_QStandardItemModel::cleanup()
m_model = 0;
}
-void tst_QStandardItemModel::insertRow_data()
+void tst_UiStandardItemModel::insertRow_data()
{
QTest::addColumn<int>("insertRow");
QTest::addColumn<int>("expectedRow");
@@ -240,7 +240,7 @@ void tst_QStandardItemModel::insertRow_data()
QTest::newRow("Insert in the middle") << 1 << 1;
}
-void tst_QStandardItemModel::insertRow()
+void tst_UiStandardItemModel::insertRow()
{
QFETCH(int, insertRow);
QFETCH(int, expectedRow);
@@ -277,7 +277,7 @@ void tst_QStandardItemModel::insertRow()
}
}
-void tst_QStandardItemModel::insertRows()
+void tst_UiStandardItemModel::insertRows()
{
int rowCount = m_model->rowCount();
QCOMPARE(rowCount, defaultSize);
@@ -302,15 +302,15 @@ void tst_QStandardItemModel::insertRows()
// QCOMPARE(m_model->headerData(3, Qt::Vertical).toString(), headerLabel);
}
-void tst_QStandardItemModel::insertRowsItems()
+void tst_UiStandardItemModel::insertRowsItems()
{
int rowCount = m_model->rowCount();
- QList<QStandardItem *> items;
- QStandardItemModel *m = qobject_cast<QStandardItemModel*>(m_model);
- QStandardItem *hiddenRoot = m->invisibleRootItem();
+ QList<UiStandardItem *> items;
+ UiStandardItemModel *m = qobject_cast<UiStandardItemModel*>(m_model);
+ UiStandardItem *hiddenRoot = m->invisibleRootItem();
for (int i = 0; i < 3; ++i)
- items.append(new QStandardItem(QString("%1").arg(i + 10)));
+ items.append(new UiStandardItem(QString("%1").arg(i + 10)));
hiddenRoot->appendRows(items);
QCOMPARE(m_model->rowCount(), rowCount + 3);
QCOMPARE(m_model->index(rowCount + 0, 0).data().toInt(), 10);
@@ -323,7 +323,7 @@ void tst_QStandardItemModel::insertRowsItems()
}
}
-void tst_QStandardItemModel::insertRowInHierarcy()
+void tst_UiStandardItemModel::insertRowInHierarcy()
{
QVERIFY(m_model->insertRows(0, 1, QModelIndex()));
QVERIFY(m_model->insertColumns(0, 1, QModelIndex()));
@@ -340,7 +340,7 @@ void tst_QStandardItemModel::insertRowInHierarcy()
QVERIFY(child.isValid());
}
-void tst_QStandardItemModel::insertColumn_data()
+void tst_UiStandardItemModel::insertColumn_data()
{
QTest::addColumn<int>("insertColumn");
QTest::addColumn<int>("expectedColumn");
@@ -352,7 +352,7 @@ void tst_QStandardItemModel::insertColumn_data()
QTest::newRow("Insert in the middle") << 1 << 1;
}
-void tst_QStandardItemModel::insertColumn()
+void tst_UiStandardItemModel::insertColumn()
{
QFETCH(int, insertColumn);
QFETCH(int, expectedColumn);
@@ -388,7 +388,7 @@ void tst_QStandardItemModel::insertColumn()
}
-void tst_QStandardItemModel::insertColumns()
+void tst_UiStandardItemModel::insertColumns()
{
int columnCount = m_model->columnCount();
QCOMPARE(columnCount, defaultSize);
@@ -413,7 +413,7 @@ void tst_QStandardItemModel::insertColumns()
// QCOMPARE(m_model->headerData(3, Qt::Horizontal).toString(), headerLabel);
}
-void tst_QStandardItemModel::removeRows()
+void tst_UiStandardItemModel::removeRows()
{
int rowCount = m_model->rowCount();
QCOMPARE(rowCount, defaultSize);
@@ -435,7 +435,7 @@ void tst_QStandardItemModel::removeRows()
QCOMPARE(m_model->rowCount(), rowCount - 2);
}
-void tst_QStandardItemModel::removeColumns()
+void tst_UiStandardItemModel::removeColumns()
{
int columnCount = m_model->columnCount();
QCOMPARE(columnCount, defaultSize);
@@ -458,7 +458,7 @@ void tst_QStandardItemModel::removeColumns()
}
-//void tst_QStandardItemModel::setHeaderData()
+//void tst_UiStandardItemModel::setHeaderData()
//{
// for (int x = 0; x < 2; ++x) {
// bool vertical = (x == 0);
@@ -501,7 +501,7 @@ void tst_QStandardItemModel::removeColumns()
// }
//}
-void tst_QStandardItemModel::persistentIndexes()
+void tst_UiStandardItemModel::persistentIndexes()
{
QCOMPARE(m_model->rowCount(), defaultSize);
QCOMPARE(m_model->columnCount(), defaultSize);
@@ -573,17 +573,17 @@ void tst_QStandardItemModel::persistentIndexes()
QVERIFY(!persistentIndex.isValid());
}
-void tst_QStandardItemModel::checkAboutToBeRemoved()
+void tst_UiStandardItemModel::checkAboutToBeRemoved()
{
QVERIFY(persistent.isValid());
}
-void tst_QStandardItemModel::checkRemoved()
+void tst_UiStandardItemModel::checkRemoved()
{
QVERIFY(!persistent.isValid());
}
-void tst_QStandardItemModel::removingPersistentIndexes()
+void tst_UiStandardItemModel::removingPersistentIndexes()
{
// add 10 rows and columns to model to make it big enough
QVERIFY(m_model->insertRows(0, 10));
@@ -641,14 +641,14 @@ void tst_QStandardItemModel::removingPersistentIndexes()
this, SLOT(checkRemoved()));
}
-void tst_QStandardItemModel::updateRowAboutToBeRemoved()
+void tst_UiStandardItemModel::updateRowAboutToBeRemoved()
{
QModelIndex idx = m_model->index(0, 0);
QVERIFY(idx.isValid());
persistent = idx;
}
-void tst_QStandardItemModel::updatingPersistentIndexes()
+void tst_UiStandardItemModel::updatingPersistentIndexes()
{
QObject::connect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(updateRowAboutToBeRemoved()));
@@ -664,7 +664,7 @@ void tst_QStandardItemModel::updatingPersistentIndexes()
this, SLOT(updateRowAboutToBeRemoved()));
}
-void tst_QStandardItemModel::modelChanged(ModelChanged change, const QModelIndex &parent,
+void tst_UiStandardItemModel::modelChanged(ModelChanged change, const QModelIndex &parent,
int first, int last)
{
rcParent[change] = parent;
@@ -673,9 +673,9 @@ void tst_QStandardItemModel::modelChanged(ModelChanged change, const QModelIndex
}
-void tst_QStandardItemModel::checkChildren()
+void tst_UiStandardItemModel::checkChildren()
{
- QStandardItemModel model(0, 0);
+ UiStandardItemModel model(0, 0);
QCOMPARE(model.rowCount(), 0);
QCOMPARE(model.columnCount(), 0);
QVERIFY(!model.hasChildren());
@@ -724,7 +724,7 @@ void tst_QStandardItemModel::checkChildren()
QCOMPARE(model.columnCount(), 1);
}
-void tst_QStandardItemModel::data()
+void tst_UiStandardItemModel::data()
{
// bad args
m_model->setData(QModelIndex(), "bla", Qt::DisplayRole);
@@ -743,9 +743,9 @@ void tst_QStandardItemModel::data()
}
-void tst_QStandardItemModel::clear()
+void tst_UiStandardItemModel::clear()
{
- QStandardItemModel model;
+ UiStandardItemModel model;
model.insertColumns(0, 10);
model.insertRows(0, 10);
QCOMPARE(model.columnCount(), 10);
@@ -765,7 +765,7 @@ void tst_QStandardItemModel::clear()
QCOMPARE(model.hasChildren(), false);
}
-void tst_QStandardItemModel::sort_data()
+void tst_UiStandardItemModel::sort_data()
{
QTest::addColumn<int>("sortOrder");
QTest::addColumn<QStringList>("initial");
@@ -887,13 +887,13 @@ void tst_QStandardItemModel::sort_data()
QTest::newRow("large set ascending") << static_cast<int>(Qt::AscendingOrder) << list << list;
}
-void tst_QStandardItemModel::sort()
+void tst_UiStandardItemModel::sort()
{
QFETCH(int, sortOrder);
QFETCH(QStringList, initial);
QFETCH(QStringList, expected);
// prepare model
- QStandardItemModel model;
+ UiStandardItemModel model;
QVERIFY(model.insertRows(0, initial.count(), QModelIndex()));
QCOMPARE(model.rowCount(QModelIndex()), initial.count());
model.insertColumns(0, 1, QModelIndex());
@@ -921,7 +921,7 @@ void tst_QStandardItemModel::sort()
}
}
-void tst_QStandardItemModel::sortRole_data()
+void tst_UiStandardItemModel::sortRole_data()
{
QTest::addColumn<QStringList>("initialText");
QTest::addColumn<QVariantList>("initialData");
@@ -946,7 +946,7 @@ void tst_QStandardItemModel::sortRole_data()
<< (QVariantList() << 1 << 2 << 3);
}
-void tst_QStandardItemModel::sortRole()
+void tst_UiStandardItemModel::sortRole()
{
QFETCH(QStringList, initialText);
QFETCH(QVariantList, initialData);
@@ -955,9 +955,9 @@ void tst_QStandardItemModel::sortRole()
QFETCH(QStringList, expectedText);
QFETCH(QVariantList, expectedData);
- QStandardItemModel model;
+ UiStandardItemModel model;
for (int i = 0; i < initialText.count(); ++i) {
- QStandardItem *item = new QStandardItem;
+ UiStandardItem *item = new UiStandardItem;
item->setText(initialText.at(i));
item->setData(initialData.at(i), Qt::UserRole);
model.appendRow(item);
@@ -965,19 +965,19 @@ void tst_QStandardItemModel::sortRole()
model.setSortRole(sortRole);
model.sort(0, static_cast<Qt::SortOrder>(sortOrder));
for (int i = 0; i < expectedText.count(); ++i) {
- QStandardItem *item = model.item(i);
+ UiStandardItem *item = model.item(i);
QCOMPARE(item->text(), expectedText.at(i));
QCOMPARE(item->data(Qt::UserRole), expectedData.at(i));
}
}
-void tst_QStandardItemModel::findItems()
+void tst_UiStandardItemModel::findItems()
{
- QStandardItemModel model;
- model.appendRow(new QStandardItem(QLatin1String("foo")));
- model.appendRow(new QStandardItem(QLatin1String("bar")));
- model.item(1)->appendRow(new QStandardItem(QLatin1String("foo")));
- QList<QStandardItem*> matches;
+ UiStandardItemModel model;
+ model.appendRow(new UiStandardItem(QLatin1String("foo")));
+ model.appendRow(new UiStandardItem(QLatin1String("bar")));
+ model.item(1)->appendRow(new UiStandardItem(QLatin1String("foo")));
+ QList<UiStandardItem*> matches;
matches = model.findItems(QLatin1String("foo"), Qt::MatchExactly|Qt::MatchRecursive, 0);
QCOMPARE(matches.count(), 2);
matches = model.findItems(QLatin1String("foo"), Qt::MatchExactly, 0);
@@ -990,36 +990,36 @@ void tst_QStandardItemModel::findItems()
QCOMPARE(matches.count(), 0);
}
-//void tst_QStandardItemModel::getSetHeaderItem()
+//void tst_UiStandardItemModel::getSetHeaderItem()
//{
-// QStandardItemModel model;
+// UiStandardItemModel model;
//
-// QCOMPARE(model.horizontalHeaderItem(0), static_cast<QStandardItem*>(0));
-// QStandardItem *hheader = new QStandardItem();
+// QCOMPARE(model.horizontalHeaderItem(0), static_cast<UiStandardItem*>(0));
+// UiStandardItem *hheader = new UiStandardItem();
// model.setHorizontalHeaderItem(0, hheader);
// QCOMPARE(model.columnCount(), 1);
// QCOMPARE(model.horizontalHeaderItem(0), hheader);
// QCOMPARE(hheader->model(), &model);
// model.setHorizontalHeaderItem(0, 0);
-// QCOMPARE(model.horizontalHeaderItem(0), static_cast<QStandardItem*>(0));
+// QCOMPARE(model.horizontalHeaderItem(0), static_cast<UiStandardItem*>(0));
//
-// QCOMPARE(model.verticalHeaderItem(0), static_cast<QStandardItem*>(0));
-// QStandardItem *vheader = new QStandardItem();
+// QCOMPARE(model.verticalHeaderItem(0), static_cast<UiStandardItem*>(0));
+// UiStandardItem *vheader = new UiStandardItem();
// model.setVerticalHeaderItem(0, vheader);
// QCOMPARE(model.rowCount(), 1);
// QCOMPARE(model.verticalHeaderItem(0), vheader);
// QCOMPARE(vheader->model(), &model);
// model.setVerticalHeaderItem(0, 0);
-// QCOMPARE(model.verticalHeaderItem(0), static_cast<QStandardItem*>(0));
+// QCOMPARE(model.verticalHeaderItem(0), static_cast<UiStandardItem*>(0));
//}
-void tst_QStandardItemModel::indexFromItem()
+void tst_UiStandardItemModel::indexFromItem()
{
- QStandardItemModel model;
+ UiStandardItemModel model;
QCOMPARE(model.indexFromItem(model.invisibleRootItem()), QModelIndex());
- QStandardItem *item = new QStandardItem;
+ UiStandardItem *item = new UiStandardItem;
model.setItem(10, 20, item);
QCOMPARE(item->model(), &model);
QModelIndex itemIndex = model.indexFromItem(item);
@@ -1029,7 +1029,7 @@ void tst_QStandardItemModel::indexFromItem()
QCOMPARE(itemIndex.parent(), QModelIndex());
QCOMPARE(itemIndex.model(), (const QAbstractItemModel*)(&model));
- QStandardItem *child = new QStandardItem;
+ UiStandardItem *child = new UiStandardItem;
item->setChild(4, 2, child);
QModelIndex childIndex = model.indexFromItem(child);
QVERIFY(childIndex.isValid());
@@ -1037,7 +1037,7 @@ void tst_QStandardItemModel::indexFromItem()
QCOMPARE(childIndex.column(), 2);
QCOMPARE(childIndex.parent(), itemIndex);
- QStandardItem *dummy = new QStandardItem;
+ UiStandardItem *dummy = new UiStandardItem;
QModelIndex noSuchIndex = model.indexFromItem(dummy);
QVERIFY(!noSuchIndex.isValid());
delete dummy;
@@ -1046,19 +1046,19 @@ void tst_QStandardItemModel::indexFromItem()
QVERIFY(!noSuchIndex.isValid());
}
-void tst_QStandardItemModel::itemFromIndex()
+void tst_UiStandardItemModel::itemFromIndex()
{
- QStandardItemModel model;
+ UiStandardItemModel model;
- QCOMPARE(model.itemFromIndex(QModelIndex()), (QStandardItem*)0);
+ QCOMPARE(model.itemFromIndex(QModelIndex()), (UiStandardItem*)0);
- QStandardItem *item = new QStandardItem;
+ UiStandardItem *item = new UiStandardItem;
model.setItem(10, 20, item);
QModelIndex itemIndex = model.index(10, 20, QModelIndex());
QVERIFY(itemIndex.isValid());
QCOMPARE(model.itemFromIndex(itemIndex), item);
- QStandardItem *child = new QStandardItem;
+ UiStandardItem *child = new UiStandardItem;
item->setChild(4, 2, child);
QModelIndex childIndex = model.index(4, 2, itemIndex);
QVERIFY(childIndex.isValid());
@@ -1068,42 +1068,42 @@ void tst_QStandardItemModel::itemFromIndex()
QVERIFY(!noSuchIndex.isValid());
}
-class CustomItem : public QStandardItem
+class CustomItem : public UiStandardItem
{
public:
- CustomItem() : QStandardItem() { }
+ CustomItem() : UiStandardItem() { }
~CustomItem() { }
int type() const {
return UserType;
}
- QStandardItem *clone() const {
+ UiStandardItem *clone() const {
return new CustomItem;
}
};
-void tst_QStandardItemModel::getSetItemPrototype()
+void tst_UiStandardItemModel::getSetItemPrototype()
{
- QStandardItemModel model;
- QCOMPARE(model.itemPrototype(), static_cast<const QStandardItem*>(0));
+ UiStandardItemModel model;
+ QCOMPARE(model.itemPrototype(), static_cast<const UiStandardItem*>(0));
const CustomItem *proto = new CustomItem;
model.setItemPrototype(proto);
- QCOMPARE(model.itemPrototype(), (const QStandardItem*)proto);
+ QCOMPARE(model.itemPrototype(), (const UiStandardItem*)proto);
model.setRowCount(1);
model.setColumnCount(1);
QModelIndex index = model.index(0, 0, QModelIndex());
model.setData(index, "foo");
- QStandardItem *item = model.itemFromIndex(index);
+ UiStandardItem *item = model.itemFromIndex(index);
QVERIFY(item != 0);
- QCOMPARE(item->type(), static_cast<int>(QStandardItem::UserType));
+ QCOMPARE(item->type(), static_cast<int>(UiStandardItem::UserType));
model.setItemPrototype(0);
- QCOMPARE(model.itemPrototype(), static_cast<const QStandardItem*>(0));
+ QCOMPARE(model.itemPrototype(), static_cast<const UiStandardItem*>(0));
}
#include <QFont>
-void tst_QStandardItemModel::getSetItemData()
+void tst_UiStandardItemModel::getSetItemData()
{
QMap<int, QVariant> roles;
QLatin1String text("text");
@@ -1131,7 +1131,7 @@ void tst_QStandardItemModel::getSetItemData()
QLatin1String accessibleDescription("accessibleDescription");
roles.insert(Qt::AccessibleDescriptionRole, accessibleDescription);
- QStandardItemModel model;
+ UiStandardItemModel model;
model.insertRows(0, 1);
model.insertColumns(0, 1);
QModelIndex idx = model.index(0, 0, QModelIndex());
@@ -1145,7 +1145,7 @@ void tst_QStandardItemModel::getSetItemData()
QCOMPARE(model.itemData(idx), roles);
}
-//void tst_QStandardItemModel::setHeaderLabels_data()
+//void tst_UiStandardItemModel::setHeaderLabels_data()
//{
// QTest::addColumn<int>("rows");
// QTest::addColumn<int>("columns");
@@ -1191,14 +1191,14 @@ void tst_QStandardItemModel::getSetItemData()
// << (QStringList() << "a" << "b" << "c" << "d");
//}
-//void tst_QStandardItemModel::setHeaderLabels()
+//void tst_UiStandardItemModel::setHeaderLabels()
//{
// QFETCH(int, rows);
// QFETCH(int, columns);
// QFETCH(int, orientation);
// QFETCH(QStringList, labels);
// QFETCH(QStringList, expectedLabels);
-// QStandardItemModel model(rows, columns);
+// UiStandardItemModel model(rows, columns);
// QSignalSpy columnsInsertedSpy(
// &model, SIGNAL(columnsInserted(QModelIndex,int,int)));
// QSignalSpy rowsInsertedSpy(
@@ -1215,14 +1215,14 @@ void tst_QStandardItemModel::getSetItemData()
// (orientation == Qt::Horizontal) ? 0 : labels.count() > rows);
//}
-void tst_QStandardItemModel::itemDataChanged()
+void tst_UiStandardItemModel::itemDataChanged()
{
- QStandardItemModel model(6, 4);
- QStandardItem item;
+ UiStandardItemModel model(6, 4);
+ UiStandardItem item;
QSignalSpy dataChangedSpy(
&model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)));
QSignalSpy itemChangedSpy(
- &model, SIGNAL(itemChanged(QStandardItem *)));
+ &model, SIGNAL(itemChanged(UiStandardItem *)));
model.setItem(0, &item);
QCOMPARE(dataChangedSpy.count(), 1);
@@ -1233,7 +1233,7 @@ void tst_QStandardItemModel::itemDataChanged()
QCOMPARE(qvariant_cast<QModelIndex>(args.at(0)), index);
QCOMPARE(qvariant_cast<QModelIndex>(args.at(1)), index);
args = itemChangedSpy.takeFirst();
- QCOMPARE(qvariant_cast<QStandardItem*>(args.at(0)), &item);
+ QCOMPARE(qvariant_cast<UiStandardItem*>(args.at(0)), &item);
item.setData(QLatin1String("foo"), Qt::DisplayRole);
QCOMPARE(dataChangedSpy.count(), 1);
@@ -1242,7 +1242,7 @@ void tst_QStandardItemModel::itemDataChanged()
QCOMPARE(qvariant_cast<QModelIndex>(args.at(0)), index);
QCOMPARE(qvariant_cast<QModelIndex>(args.at(1)), index);
args = itemChangedSpy.takeFirst();
- QCOMPARE(qvariant_cast<QStandardItem*>(args.at(0)), &item);
+ QCOMPARE(qvariant_cast<UiStandardItem*>(args.at(0)), &item);
item.setData(item.data(Qt::DisplayRole), Qt::DisplayRole);
QCOMPARE(dataChangedSpy.count(), 0);
@@ -1255,42 +1255,42 @@ void tst_QStandardItemModel::itemDataChanged()
QCOMPARE(qvariant_cast<QModelIndex>(args.at(0)), index);
QCOMPARE(qvariant_cast<QModelIndex>(args.at(1)), index);
args = itemChangedSpy.takeFirst();
- QCOMPARE(qvariant_cast<QStandardItem*>(args.at(0)), &item);
+ QCOMPARE(qvariant_cast<UiStandardItem*>(args.at(0)), &item);
item.setFlags(item.flags());
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(itemChangedSpy.count(), 0);
}
-//void tst_QStandardItemModel::takeHeaderItem()
+//void tst_UiStandardItemModel::takeHeaderItem()
//{
-// QStandardItemModel model;
+// UiStandardItemModel model;
// // set header items
-// QStandardItem *hheader = new QStandardItem();
+// UiStandardItem *hheader = new UiStandardItem();
// model.setHorizontalHeaderItem(0, hheader);
-// QStandardItem *vheader = new QStandardItem();
+// UiStandardItem *vheader = new UiStandardItem();
// model.setVerticalHeaderItem(0, vheader);
// // take header items
// QCOMPARE(model.takeHorizontalHeaderItem(0), hheader);
// QCOMPARE(model.takeVerticalHeaderItem(0), vheader);
-// QCOMPARE(hheader->model(), static_cast<QStandardItemModel*>(0));
-// QCOMPARE(vheader->model(), static_cast<QStandardItemModel*>(0));
-// QCOMPARE(model.takeHorizontalHeaderItem(0), static_cast<QStandardItem*>(0));
-// QCOMPARE(model.takeVerticalHeaderItem(0), static_cast<QStandardItem*>(0));
+// QCOMPARE(hheader->model(), static_cast<UiStandardItemModel*>(0));
+// QCOMPARE(vheader->model(), static_cast<UiStandardItemModel*>(0));
+// QCOMPARE(model.takeHorizontalHeaderItem(0), static_cast<UiStandardItem*>(0));
+// QCOMPARE(model.takeVerticalHeaderItem(0), static_cast<UiStandardItem*>(0));
// delete hheader;
// delete vheader;
//}
-void tst_QStandardItemModel::useCase1()
+void tst_UiStandardItemModel::useCase1()
{
const int rows = 5;
const int columns = 8;
- QStandardItemModel model(rows, columns);
+ UiStandardItemModel model(rows, columns);
for (int i = 0; i < model.rowCount(); ++i) {
for (int j = 0; j < model.columnCount(); ++j) {
- QCOMPARE(model.item(i, j), static_cast<QStandardItem*>(0));
+ QCOMPARE(model.item(i, j), static_cast<UiStandardItem*>(0));
- QStandardItem *item = new QStandardItem();
+ UiStandardItem *item = new UiStandardItem();
model.setItem(i, j, item);
QCOMPARE(item->row(), i);
QCOMPARE(item->column(), j);
@@ -1298,21 +1298,21 @@ void tst_QStandardItemModel::useCase1()
QModelIndex index = model.indexFromItem(item);
QCOMPARE(index, model.index(i, j, QModelIndex()));
- QStandardItem *sameItem = model.itemFromIndex(index);
+ UiStandardItem *sameItem = model.itemFromIndex(index);
QCOMPARE(sameItem, item);
}
}
}
-static void createChildren(QStandardItemModel *model, QStandardItem *parent, int level)
+static void createChildren(UiStandardItemModel *model, UiStandardItem *parent, int level)
{
if (level > 4)
return;
for (int i = 0; i < 4; ++i) {
QCOMPARE(parent->rowCount(), i);
- parent->appendRow(QList<QStandardItem*>());
+ parent->appendRow(QList<UiStandardItem*>());
for (int j = 0; j < parent->columnCount(); ++j) {
- QStandardItem *item = new QStandardItem();
+ UiStandardItem *item = new UiStandardItem();
parent->setChild(i, j, item);
QCOMPARE(item->row(), i);
QCOMPARE(item->column(), j);
@@ -1320,44 +1320,44 @@ static void createChildren(QStandardItemModel *model, QStandardItem *parent, int
QModelIndex parentIndex = model->indexFromItem(parent);
QModelIndex index = model->indexFromItem(item);
QCOMPARE(index, model->index(i, j, parentIndex));
- QStandardItem *theItem = model->itemFromIndex(index);
+ UiStandardItem *theItem = model->itemFromIndex(index);
QCOMPARE(theItem, item);
- QStandardItem *theParent = model->itemFromIndex(parentIndex);
- QCOMPARE(theParent, (level == 0) ? (QStandardItem*)0 : parent);
+ UiStandardItem *theParent = model->itemFromIndex(parentIndex);
+ QCOMPARE(theParent, (level == 0) ? (UiStandardItem*)0 : parent);
}
{
- QStandardItem *item = parent->child(i);
+ UiStandardItem *item = parent->child(i);
item->setColumnCount(parent->columnCount());
createChildren(model, item, level + 1);
}
}
}
-void tst_QStandardItemModel::useCase2()
+void tst_UiStandardItemModel::useCase2()
{
- QStandardItemModel model;
+ UiStandardItemModel model;
model.setColumnCount(2);
createChildren(&model, model.invisibleRootItem(), 0);
}
-void tst_QStandardItemModel::useCase3()
+void tst_UiStandardItemModel::useCase3()
{
// create the tree structure first
- QStandardItem *childItem = 0;
+ UiStandardItem *childItem = 0;
for (int i = 0; i < 100; ++i) {
- QStandardItem *item = new QStandardItem(QString("item %0").arg(i));
+ UiStandardItem *item = new UiStandardItem(QString("item %0").arg(i));
if (childItem)
item->appendRow(childItem);
childItem = item;
}
// add to model as last step
- QStandardItemModel model;
+ UiStandardItemModel model;
model.appendRow(childItem);
// make sure each item has the correct model and parent
- QStandardItem *parentItem = 0;
+ UiStandardItem *parentItem = 0;
while (childItem) {
QCOMPARE(childItem->model(), &model);
QCOMPARE(childItem->parent(), parentItem);
@@ -1369,9 +1369,9 @@ void tst_QStandardItemModel::useCase3()
childItem = model.takeItem(0);
{
parentItem = 0;
- QStandardItem *item = childItem;
+ UiStandardItem *item = childItem;
while (item) {
- QCOMPARE(item->model(), static_cast<QStandardItemModel*>(0));
+ QCOMPARE(item->model(), static_cast<UiStandardItemModel*>(0));
QCOMPARE(item->parent(), parentItem);
parentItem = item;
item = item->child(0);
@@ -1380,9 +1380,9 @@ void tst_QStandardItemModel::useCase3()
delete childItem;
}
-//void tst_QStandardItemModel::rootItemFlags()
+//void tst_UiStandardItemModel::rootItemFlags()
//{
-// QStandardItemModel model(6, 4);
+// UiStandardItemModel model(6, 4);
// QCOMPARE(model.invisibleRootItem()->flags() , model.flags(QModelIndex()));
// QCOMPARE(model.invisibleRootItem()->flags() , Qt::ItemIsDropEnabled);
//
@@ -1398,12 +1398,12 @@ void tst_QStandardItemModel::useCase3()
// QCOMPARE(model.invisibleRootItem()->flags() , model.flags(QModelIndex()));
//}
-bool tst_QStandardItemModel::compareModels(QStandardItemModel *model1, QStandardItemModel *model2)
+bool tst_UiStandardItemModel::compareModels(UiStandardItemModel *model1, UiStandardItemModel *model2)
{
return compareItems(model1->invisibleRootItem(), model2->invisibleRootItem());
}
-bool tst_QStandardItemModel::compareItems(QStandardItem *item1, QStandardItem *item2)
+bool tst_UiStandardItemModel::compareItems(UiStandardItem *item1, UiStandardItem *item2)
{
if (!item1 && !item2)
return true;
@@ -1430,13 +1430,13 @@ bool tst_QStandardItemModel::compareItems(QStandardItem *item1, QStandardItem *i
return true;
}
-static QStandardItem *itemFromText(QStandardItem *parent, const QString &text)
+static UiStandardItem *itemFromText(UiStandardItem *parent, const QString &text)
{
- QStandardItem *item = 0;
+ UiStandardItem *item = 0;
for (int i = 0; i < parent->columnCount(); i++)
for (int j = 0; j < parent->rowCount(); j++) {
- QStandardItem *child = parent->child(j, i);
+ UiStandardItem *child = parent->child(j, i);
if (!child)
continue;
@@ -1448,7 +1448,7 @@ static QStandardItem *itemFromText(QStandardItem *parent, const QString &text)
item = child;
}
- QStandardItem *candidate = itemFromText(child, text);
+ UiStandardItem *candidate = itemFromText(child, text);
if (candidate) {
if (item) {
return 0;
@@ -1460,9 +1460,9 @@ static QStandardItem *itemFromText(QStandardItem *parent, const QString &text)
}
//#ifdef QT_BUILD_INTERNAL
-//static QModelIndex indexFromText(QStandardItemModel *model, const QString &text)
+//static QModelIndex indexFromText(UiStandardItemModel *model, const QString &text)
//{
-// QStandardItem *item = itemFromText(model->invisibleRootItem(), text);
+// UiStandardItem *item = itemFromText(model->invisibleRootItem(), text);
// /*QVERIFY(item);*/
// return model->indexFromItem(item);
//}
@@ -1470,57 +1470,57 @@ static QStandardItem *itemFromText(QStandardItem *parent, const QString &text)
//struct FriendlyTreeView : public QTreeView
//{
-// friend class tst_QStandardItemModel;
+// friend class tst_UiStandardItemModel;
// Q_DECLARE_PRIVATE(QTreeView)
//};
//#endif
-void tst_QStandardItemModel::treeDragAndDrop()
+void tst_UiStandardItemModel::treeDragAndDrop()
{
//#ifdef QT_BUILD_INTERNAL
// const int nRow = 5;
// const int nCol = 3;
-// QStandardItemModel model;
-// QStandardItemModel checkModel;
+// UiStandardItemModel model;
+// UiStandardItemModel checkModel;
// for (int i = 0; i < nRow; ++i) {
-// QList<QStandardItem *> colItems1;
+// QList<UiStandardItem *> colItems1;
// for (int c = 0 ; c < nCol; c ++)
-// colItems1 << new QStandardItem(QString("item %1 - %0").arg(c).arg(i));
+// colItems1 << new UiStandardItem(QString("item %1 - %0").arg(c).arg(i));
// model.appendRow(colItems1);
// for (int j = 0; j < nRow; ++j) {
-// QList<QStandardItem *> colItems2;
+// QList<UiStandardItem *> colItems2;
// for (int c = 0 ; c < nCol; c ++)
-// colItems2 << new QStandardItem(QString("item %1/%2 - %0").arg(c).arg(i).arg(j));
+// colItems2 << new UiStandardItem(QString("item %1/%2 - %0").arg(c).arg(i).arg(j));
// colItems1.at(0)->appendRow(colItems2);
// for (int k = 0; k < nRow; ++k) {
-// QList<QStandardItem *> colItems3;
+// QList<UiStandardItem *> colItems3;
// for (int c = 0 ; c < nCol; c ++)
-// colItems3 << new QStandardItem(QString("item %1/%2/%3 - %0").arg(c).arg(i).arg(j).arg(k));
+// colItems3 << new UiStandardItem(QString("item %1/%2/%3 - %0").arg(c).arg(i).arg(j).arg(k));
// colItems2.at(0)->appendRow(colItems3);
// }
// }
// }
// for (int i = 0; i < nRow; ++i) {
-// QList<QStandardItem *> colItems1;
+// QList<UiStandardItem *> colItems1;
// for (int c = 0 ; c < nCol; c ++)
-// colItems1 << new QStandardItem(QString("item %1 - %0").arg(c).arg(i));
+// colItems1 << new UiStandardItem(QString("item %1 - %0").arg(c).arg(i));
// checkModel.appendRow(colItems1);
// for (int j = 0; j < nRow; ++j) {
-// QList<QStandardItem *> colItems2;
+// QList<UiStandardItem *> colItems2;
// for (int c = 0 ; c < nCol; c ++)
-// colItems2 << new QStandardItem(QString("item %1/%2 - %0").arg(c).arg(i).arg(j));
+// colItems2 << new UiStandardItem(QString("item %1/%2 - %0").arg(c).arg(i).arg(j));
// colItems1.at(0)->appendRow(colItems2);
// for (int k = 0; k < nRow; ++k) {
-// QList<QStandardItem *> colItems3;
+// QList<UiStandardItem *> colItems3;
// for (int c = 0 ; c < nCol; c ++)
-// colItems3 << new QStandardItem(QString("item %1/%2/%3 - %0").arg(c).arg(i).arg(j).arg(k));
+// colItems3 << new UiStandardItem(QString("item %1/%2/%3 - %0").arg(c).arg(i).arg(j).arg(k));
// colItems2.at(0)->appendRow(colItems3);
// }
// }
@@ -1558,7 +1558,7 @@ void tst_QStandardItemModel::treeDragAndDrop()
// delete data;
// QVERIFY(!compareModels(&model, &checkModel)); //the model must be different at this point
-// QStandardItem *item4 = itemFromText(checkModel.invisibleRootItem(), "item 4 - 0");
+// UiStandardItem *item4 = itemFromText(checkModel.invisibleRootItem(), "item 4 - 0");
// item4->insertRow(0, checkModel.takeRow(1));
// item4->insertRow(1, checkModel.takeRow(1));
// QVERIFY(compareModels(&model, &checkModel));
@@ -1583,7 +1583,7 @@ void tst_QStandardItemModel::treeDragAndDrop()
// delete data;
// QVERIFY(!compareModels(&model, &checkModel)); //the model must be different at this point
-// QStandardItem *item4 = itemFromText(checkModel.invisibleRootItem(), "item 4 - 0");
+// UiStandardItem *item4 = itemFromText(checkModel.invisibleRootItem(), "item 4 - 0");
// item4->insertRow(0, checkModel.takeRow(1));
// QVERIFY(compareModels(&model, &checkModel));
@@ -1609,8 +1609,8 @@ void tst_QStandardItemModel::treeDragAndDrop()
// delete data;
// QVERIFY(!compareModels(&model, &checkModel)); //the model must be different at this point
-// QStandardItem *item02 = itemFromText(checkModel.invisibleRootItem(), "item 0/2 - 0");
-// QStandardItem *item4 = itemFromText(checkModel.invisibleRootItem(), "item 4 - 0");
+// UiStandardItem *item02 = itemFromText(checkModel.invisibleRootItem(), "item 0/2 - 0");
+// UiStandardItem *item4 = itemFromText(checkModel.invisibleRootItem(), "item 4 - 0");
// item02->insertRow(0, item4->takeRow(0));
// QVERIFY(compareModels(&model, &checkModel));
@@ -1618,7 +1618,7 @@ void tst_QStandardItemModel::treeDragAndDrop()
//#endif
}
-void tst_QStandardItemModel::removeRowsAndColumns()
+void tst_UiStandardItemModel::removeRowsAndColumns()
{
#define VERIFY_MODEL \
for (int c = 0; c < col_list.count(); c++) \
@@ -1627,10 +1627,10 @@ void tst_QStandardItemModel::removeRowsAndColumns()
QVector<QString> row_list = QString("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").split(',').toVector();
QVector<QString> col_list = row_list;
- QStandardItemModel model;
+ UiStandardItemModel model;
for (int c = 0; c < col_list.count(); c++)
for (int r = 0; r < row_list.count(); r++)
- model.setItem(r, c, new QStandardItem(row_list[r] + "x" + col_list[c]));
+ model.setItem(r, c, new UiStandardItem(row_list[r] + "x" + col_list[c]));
VERIFY_MODEL
row_list.remove(3);
@@ -1649,14 +1649,14 @@ void tst_QStandardItemModel::removeRowsAndColumns()
model.removeColumns(1, 6);
VERIFY_MODEL
- QList<QStandardItem *> row_taken = model.takeRow(6);
+ QList<UiStandardItem *> row_taken = model.takeRow(6);
QCOMPARE(row_taken.count(), col_list.count());
for (int c = 0; c < col_list.count(); c++)
QCOMPARE(row_taken[c]->text() , row_list[6] + "x" + col_list[c]);
row_list.remove(6);
VERIFY_MODEL
- QList<QStandardItem *> col_taken = model.takeColumn(10);
+ QList<UiStandardItem *> col_taken = model.takeColumn(10);
QCOMPARE(col_taken.count(), row_list.count());
for (int r = 0; r < row_list.count(); r++)
QCOMPARE(col_taken[r]->text() , row_list[r] + "x" + col_list[10]);
@@ -1664,14 +1664,14 @@ void tst_QStandardItemModel::removeRowsAndColumns()
VERIFY_MODEL
}
-void tst_QStandardItemModel::itemRoleNames()
+void tst_UiStandardItemModel::itemRoleNames()
{
QVector<QString> row_list = QString("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").split(',').toVector();
QVector<QString> col_list = row_list;
- QStandardItemModel model;
+ UiStandardItemModel model;
for (int c = 0; c < col_list.count(); c++)
for (int r = 0; r < row_list.count(); r++)
- model.setItem(r, c, new QStandardItem(row_list[r] + "x" + col_list[c]));
+ model.setItem(r, c, new UiStandardItem(row_list[r] + "x" + col_list[c]));
VERIFY_MODEL
QHash<int, QByteArray> newRoleNames;
@@ -1683,5 +1683,5 @@ void tst_QStandardItemModel::itemRoleNames()
}
-QTEST_MAIN(tst_QStandardItemModel)
+QTEST_MAIN(tst_UiStandardItemModel)
#include "tst_qstandarditemmodel.moc"
diff --git a/tests/auto/undo/qundogroup/qundogroup.pro b/tests/auto/undo/qundogroup/qundogroup.pro
deleted file mode 100644
index a2d5e4a..0000000
--- a/tests/auto/undo/qundogroup/qundogroup.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qundogroup
-
-QT += uihelpers testlib
-
-SOURCES += tst_qundogroup.cpp
diff --git a/tests/auto/undo/qundostack/qundostack.pro b/tests/auto/undo/qundostack/qundostack.pro
deleted file mode 100644
index a1096a3..0000000
--- a/tests/auto/undo/qundostack/qundostack.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qundostack
-
-QT += testlib uihelpers
-
-SOURCES += tst_qundostack.cpp
diff --git a/tests/auto/undo/undo.pro b/tests/auto/undo/undo.pro
deleted file mode 100644
index 2a70804..0000000
--- a/tests/auto/undo/undo.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE=subdirs
-SUBDIRS=\
- qundogroup \
- qundostack \
diff --git a/tests/auto/undo/qundogroup/.gitignore b/tests/auto/utils/uiundogroup/.gitignore
index bc3e8c4..bc3e8c4 100644
--- a/tests/auto/undo/qundogroup/.gitignore
+++ b/tests/auto/utils/uiundogroup/.gitignore
diff --git a/tests/auto/undo/qundogroup/testdata/qundogroup.ts b/tests/auto/utils/uiundogroup/testdata/qundogroup.ts
index a059bcb..a059bcb 100644
--- a/tests/auto/undo/qundogroup/testdata/qundogroup.ts
+++ b/tests/auto/utils/uiundogroup/testdata/qundogroup.ts
diff --git a/tests/auto/undo/qundogroup/tst_qundogroup.cpp b/tests/auto/utils/uiundogroup/tst_uiundogroup.cpp
index dff2cfa..a4f284b 100644
--- a/tests/auto/undo/qundogroup/tst_qundogroup.cpp
+++ b/tests/auto/utils/uiundogroup/tst_uiundogroup.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
#include <QtTest/QtTest>
-#include <UiHelpers/QUndoGroup>
-#include <UiHelpers/QUndoStack>
+#include <UiHelpers/UiUndoGroup>
+#include <UiHelpers/UiUndoStack>
QT_USE_NAMESPACE_UIHELPERS
@@ -51,11 +51,11 @@ QT_USE_NAMESPACE_UIHELPERS
** Commands
*/
-class InsertCommand : public QUndoCommand
+class InsertCommand : public UiUndoCommand
{
public:
InsertCommand(QString *str, int idx, const QString &text,
- QUndoCommand *parent = 0);
+ UiUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
@@ -66,10 +66,10 @@ private:
QString m_text;
};
-class RemoveCommand : public QUndoCommand
+class RemoveCommand : public UiUndoCommand
{
public:
- RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent = 0);
+ RemoveCommand(QString *str, int idx, int len, UiUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
@@ -80,15 +80,15 @@ private:
QString m_text;
};
-class AppendCommand : public QUndoCommand
+class AppendCommand : public UiUndoCommand
{
public:
- AppendCommand(QString *str, const QString &text, QUndoCommand *parent = 0);
+ AppendCommand(QString *str, const QString &text, UiUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
virtual int id() const;
- virtual bool mergeWith(const QUndoCommand *other);
+ virtual bool mergeWith(const UiUndoCommand *other);
bool merged;
@@ -98,8 +98,8 @@ private:
};
InsertCommand::InsertCommand(QString *str, int idx, const QString &text,
- QUndoCommand *parent)
- : QUndoCommand(parent)
+ UiUndoCommand *parent)
+ : UiUndoCommand(parent)
{
QVERIFY(str->length() >= idx);
@@ -124,8 +124,8 @@ void InsertCommand::undo()
m_str->remove(m_idx, m_text.length());
}
-RemoveCommand::RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent)
- : QUndoCommand(parent)
+RemoveCommand::RemoveCommand(QString *str, int idx, int len, UiUndoCommand *parent)
+ : UiUndoCommand(parent)
{
QVERIFY(str->length() >= idx + len);
@@ -150,8 +150,8 @@ void RemoveCommand::undo()
m_str->insert(m_idx, m_text);
}
-AppendCommand::AppendCommand(QString *str, const QString &text, QUndoCommand *parent)
- : QUndoCommand(parent)
+AppendCommand::AppendCommand(QString *str, const QString &text, UiUndoCommand *parent)
+ : UiUndoCommand(parent)
{
setText("append");
@@ -177,7 +177,7 @@ int AppendCommand::id() const
return 1;
}
-bool AppendCommand::mergeWith(const QUndoCommand *other)
+bool AppendCommand::mergeWith(const UiUndoCommand *other)
{
if (other->id() != id())
return false;
@@ -187,14 +187,14 @@ bool AppendCommand::mergeWith(const QUndoCommand *other)
}
/******************************************************************************
-** tst_QUndoGroup
+** tst_UiUndoGroup
*/
-class tst_QUndoGroup : public QObject
+class tst_UiUndoGroup : public QObject
{
Q_OBJECT
public:
- tst_QUndoGroup();
+ tst_UiUndoGroup();
private slots:
void setActive();
@@ -204,20 +204,20 @@ private slots:
void addStackAndDie();
};
-tst_QUndoGroup::tst_QUndoGroup()
+tst_UiUndoGroup::tst_UiUndoGroup()
{
}
-void tst_QUndoGroup::setActive()
+void tst_UiUndoGroup::setActive()
{
- QUndoGroup group;
- QUndoStack stack1(&group), stack2(&group);
+ UiUndoGroup group;
+ UiUndoStack stack1(&group), stack2(&group);
- QCOMPARE(group.activeStack(), (QUndoStack*)0);
+ QCOMPARE(group.activeStack(), (UiUndoStack*)0);
QCOMPARE(stack1.isActive(), false);
QCOMPARE(stack2.isActive(), false);
- QUndoStack stack3;
+ UiUndoStack stack3;
QCOMPARE(stack3.isActive(), true);
group.addStack(&stack3);
@@ -236,78 +236,78 @@ void tst_QUndoGroup::setActive()
QCOMPARE(stack3.isActive(), false);
group.removeStack(&stack2);
- QCOMPARE(group.activeStack(), (QUndoStack*)0);
+ QCOMPARE(group.activeStack(), (UiUndoStack*)0);
QCOMPARE(stack1.isActive(), false);
QCOMPARE(stack2.isActive(), true);
QCOMPARE(stack3.isActive(), false);
group.removeStack(&stack2);
- QCOMPARE(group.activeStack(), (QUndoStack*)0);
+ QCOMPARE(group.activeStack(), (UiUndoStack*)0);
QCOMPARE(stack1.isActive(), false);
QCOMPARE(stack2.isActive(), true);
QCOMPARE(stack3.isActive(), false);
}
-void tst_QUndoGroup::addRemoveStack()
+void tst_UiUndoGroup::addRemoveStack()
{
- QUndoGroup group;
+ UiUndoGroup group;
- QUndoStack stack1(&group);
- QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack1);
+ UiUndoStack stack1(&group);
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>() << &stack1);
- QUndoStack stack2;
+ UiUndoStack stack2;
group.addStack(&stack2);
- QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack1 << &stack2);
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>() << &stack1 << &stack2);
group.addStack(&stack1);
- QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack1 << &stack2);
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>() << &stack1 << &stack2);
group.removeStack(&stack1);
- QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack2);
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>() << &stack2);
group.removeStack(&stack1);
- QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack2);
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>() << &stack2);
group.removeStack(&stack2);
- QCOMPARE(group.stacks(), QList<QUndoStack*>());
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>());
}
-void tst_QUndoGroup::deleteStack()
+void tst_UiUndoGroup::deleteStack()
{
- QUndoGroup group;
+ UiUndoGroup group;
- QUndoStack *stack1 = new QUndoStack(&group);
- QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack1);
- QCOMPARE(group.activeStack(), (QUndoStack*)0);
+ UiUndoStack *stack1 = new UiUndoStack(&group);
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>() << stack1);
+ QCOMPARE(group.activeStack(), (UiUndoStack*)0);
stack1->setActive();
QCOMPARE(group.activeStack(), stack1);
- QUndoStack *stack2 = new QUndoStack(&group);
- QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack1 << stack2);
+ UiUndoStack *stack2 = new UiUndoStack(&group);
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>() << stack1 << stack2);
QCOMPARE(group.activeStack(), stack1);
- QUndoStack *stack3 = new QUndoStack(&group);
- QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack1 << stack2 << stack3);
+ UiUndoStack *stack3 = new UiUndoStack(&group);
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>() << stack1 << stack2 << stack3);
QCOMPARE(group.activeStack(), stack1);
delete stack2;
- QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack1 << stack3);
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>() << stack1 << stack3);
QCOMPARE(group.activeStack(), stack1);
delete stack1;
- QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack3);
- QCOMPARE(group.activeStack(), (QUndoStack*)0);
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>() << stack3);
+ QCOMPARE(group.activeStack(), (UiUndoStack*)0);
stack3->setActive(false);
- QCOMPARE(group.activeStack(), (QUndoStack*)0);
+ QCOMPARE(group.activeStack(), (UiUndoStack*)0);
stack3->setActive(true);
QCOMPARE(group.activeStack(), stack3);
group.removeStack(stack3);
- QCOMPARE(group.stacks(), QList<QUndoStack*>());
- QCOMPARE(group.activeStack(), (QUndoStack*)0);
+ QCOMPARE(group.stacks(), QList<UiUndoStack*>());
+ QCOMPARE(group.activeStack(), (UiUndoStack*)0);
delete stack3;
}
@@ -326,7 +326,7 @@ static QString glue(const QString &s1, const QString &s2)
#define CHECK_STATE(_activeStack, _clean, _canUndo, _undoText, _canRedo, _redoText, \
_cleanChanged, _indexChanged, _undoChanged, _redoChanged) \
- QCOMPARE(group.activeStack(), (QUndoStack*)_activeStack); \
+ QCOMPARE(group.activeStack(), (UiUndoStack*)_activeStack); \
QCOMPARE(group.isClean(), _clean); \
QCOMPARE(group.canUndo(), _canUndo); \
QCOMPARE(group.undoText(), QString(_undoText)); \
@@ -368,9 +368,9 @@ static QString glue(const QString &s1, const QString &s2)
QCOMPARE(redoTextChangedSpy.count(), 0); \
}
-void tst_QUndoGroup::checkSignals()
+void tst_UiUndoGroup::checkSignals()
{
- QUndoGroup group;
+ UiUndoGroup group;
QSignalSpy indexChangedSpy(&group, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&group, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&group, SIGNAL(canUndoChanged(bool)));
@@ -415,7 +415,7 @@ void tst_QUndoGroup::checkSignals()
false, // undoChanged
false) // redoChanged
- QUndoStack *stack1 = new QUndoStack(&group);
+ UiUndoStack *stack1 = new UiUndoStack(&group);
CHECK_STATE(0, // activeStack
true, // clean
false, // canUndo
@@ -535,7 +535,7 @@ void tst_QUndoGroup::checkSignals()
true, // undoChanged
true) // redoChanged
- QUndoStack *stack2 = new QUndoStack(&group);
+ UiUndoStack *stack2 = new UiUndoStack(&group);
CHECK_STATE(0, // activeStack
true, // clean
false, // canUndo
@@ -584,12 +584,12 @@ void tst_QUndoGroup::checkSignals()
true) // redoChanged
}
-void tst_QUndoGroup::addStackAndDie()
+void tst_UiUndoGroup::addStackAndDie()
{
- // Test that QUndoStack doesn't keep a reference to QUndoGroup after the
+ // Test that UiUndoStack doesn't keep a reference to UiUndoGroup after the
// group is deleted.
- QUndoStack *stack = new QUndoStack;
- QUndoGroup *group = new QUndoGroup;
+ UiUndoStack *stack = new UiUndoStack;
+ UiUndoGroup *group = new UiUndoGroup;
group->addStack(stack);
delete group;
stack->setActive(true);
@@ -597,11 +597,11 @@ void tst_QUndoGroup::addStackAndDie()
}
#else
-class tst_QUndoGroup : public QObject
+class tst_UiUndoGroup : public QObject
{
Q_OBJECT
public:
- tst_QUndoGroup() {}
+ tst_UiUndoGroup() {}
private slots:
void setActive() { QSKIP( "Not tested on irix-g++"); }
@@ -612,7 +612,7 @@ private slots:
};
#endif
-QTEST_MAIN(tst_QUndoGroup)
+QTEST_MAIN(tst_UiUndoGroup)
-#include "tst_qundogroup.moc"
+#include "tst_uiundogroup.moc"
diff --git a/tests/auto/utils/uiundogroup/uiundogroup.pro b/tests/auto/utils/uiundogroup/uiundogroup.pro
new file mode 100644
index 0000000..75a7fe6
--- /dev/null
+++ b/tests/auto/utils/uiundogroup/uiundogroup.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase
+TARGET = tst_uiundogroup
+
+QT += uihelpers testlib
+
+SOURCES += tst_uiundogroup.cpp
diff --git a/tests/auto/undo/qundostack/.gitignore b/tests/auto/utils/uiundostack/.gitignore
index f8faf27..f8faf27 100644
--- a/tests/auto/undo/qundostack/.gitignore
+++ b/tests/auto/utils/uiundostack/.gitignore
diff --git a/tests/auto/undo/qundostack/testdata/qundostack.ts b/tests/auto/utils/uiundostack/testdata/qundostack.ts
index 4584036..4584036 100644
--- a/tests/auto/undo/qundostack/testdata/qundostack.ts
+++ b/tests/auto/utils/uiundostack/testdata/qundostack.ts
diff --git a/tests/auto/undo/qundostack/tst_qundostack.cpp b/tests/auto/utils/uiundostack/tst_uiundostack.cpp
index b3d95fd..17c0258 100644
--- a/tests/auto/undo/qundostack/tst_qundostack.cpp
+++ b/tests/auto/utils/uiundostack/tst_uiundostack.cpp
@@ -41,7 +41,7 @@
#include <QtTest/QtTest>
-#include <UiHelpers/QUndoStack>
+#include <UiHelpers/UiUndoStack>
QT_USE_NAMESPACE_UIHELPERS
@@ -49,11 +49,11 @@ QT_USE_NAMESPACE_UIHELPERS
** Commands
*/
-class InsertCommand : public QUndoCommand
+class InsertCommand : public UiUndoCommand
{
public:
InsertCommand(QString *str, int idx, const QString &text,
- QUndoCommand *parent = 0);
+ UiUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
@@ -64,10 +64,10 @@ private:
QString m_text;
};
-class RemoveCommand : public QUndoCommand
+class RemoveCommand : public UiUndoCommand
{
public:
- RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent = 0);
+ RemoveCommand(QString *str, int idx, int len, UiUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
@@ -78,17 +78,17 @@ private:
QString m_text;
};
-class AppendCommand : public QUndoCommand
+class AppendCommand : public UiUndoCommand
{
public:
AppendCommand(QString *str, const QString &text, bool _fail_merge = false,
- QUndoCommand *parent = 0);
+ UiUndoCommand *parent = 0);
~AppendCommand();
virtual void undo();
virtual void redo();
virtual int id() const;
- virtual bool mergeWith(const QUndoCommand *other);
+ virtual bool mergeWith(const UiUndoCommand *other);
bool merged;
bool fail_merge;
@@ -99,10 +99,10 @@ private:
QString m_text;
};
-class IdleCommand : public QUndoCommand
+class IdleCommand : public UiUndoCommand
{
public:
- IdleCommand(QUndoCommand *parent = 0);
+ IdleCommand(UiUndoCommand *parent = 0);
~IdleCommand();
virtual void undo();
@@ -110,8 +110,8 @@ public:
};
InsertCommand::InsertCommand(QString *str, int idx, const QString &text,
- QUndoCommand *parent)
- : QUndoCommand(parent)
+ UiUndoCommand *parent)
+ : UiUndoCommand(parent)
{
QVERIFY(str->length() >= idx);
@@ -136,8 +136,8 @@ void InsertCommand::undo()
m_str->remove(m_idx, m_text.length());
}
-RemoveCommand::RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent)
- : QUndoCommand(parent)
+RemoveCommand::RemoveCommand(QString *str, int idx, int len, UiUndoCommand *parent)
+ : UiUndoCommand(parent)
{
QVERIFY(str->length() >= idx + len);
@@ -165,8 +165,8 @@ void RemoveCommand::undo()
int AppendCommand::delete_cnt = 0;
AppendCommand::AppendCommand(QString *str, const QString &text, bool _fail_merge,
- QUndoCommand *parent)
- : QUndoCommand(parent)
+ UiUndoCommand *parent)
+ : UiUndoCommand(parent)
{
setText("append");
@@ -198,7 +198,7 @@ int AppendCommand::id() const
return 1;
}
-bool AppendCommand::mergeWith(const QUndoCommand *other)
+bool AppendCommand::mergeWith(const UiUndoCommand *other)
{
if (other->id() != id())
return false;
@@ -209,11 +209,11 @@ bool AppendCommand::mergeWith(const QUndoCommand *other)
return true;
}
-IdleCommand::IdleCommand(QUndoCommand *parent)
- : QUndoCommand(parent)
+IdleCommand::IdleCommand(UiUndoCommand *parent)
+ : UiUndoCommand(parent)
{
- // "idle-item" goes to QUndoStack::{redo,undo}Text
- // "idle-action" goes to all other places (e.g. QUndoView)
+ // "idle-item" goes to UiUndoStack::{redo,undo}Text
+ // "idle-action" goes to all other places (e.g. UiUndoView)
setText("idle-item\nidle-action");
}
@@ -230,14 +230,14 @@ void IdleCommand::undo()
}
/******************************************************************************
-** tst_QUndoStack
+** tst_UiUndoStack
*/
-class tst_QUndoStack : public QObject
+class tst_UiUndoStack : public QObject
{
Q_OBJECT
public:
- tst_QUndoStack();
+ tst_UiUndoStack();
private slots:
void undoRedo();
@@ -251,7 +251,7 @@ private slots:
void separateUndoText();
};
-tst_QUndoStack::tst_QUndoStack()
+tst_UiUndoStack::tst_UiUndoStack()
{
}
@@ -273,7 +273,7 @@ static void checkState(QSignalSpy &redoTextChangedSpy,
QSignalSpy &canUndoChangedSpy,
QSignalSpy &cleanChangedSpy,
QSignalSpy &indexChangedSpy,
- QUndoStack &stack,
+ UiUndoStack &stack,
const bool _clean,
const int _count,
const int _index,
@@ -331,9 +331,9 @@ static void checkState(QSignalSpy &redoTextChangedSpy,
}
}
-void tst_QUndoStack::undoRedo()
+void tst_UiUndoStack::undoRedo()
{
- QUndoStack stack;
+ UiUndoStack stack;
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@@ -660,9 +660,9 @@ void tst_QUndoStack::undoRedo()
true); // redoChanged
}
-void tst_QUndoStack::setIndex()
+void tst_UiUndoStack::setIndex()
{
- QUndoStack stack;
+ UiUndoStack stack;
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@@ -900,9 +900,9 @@ void tst_QUndoStack::setIndex()
true); // redoChanged
}
-void tst_QUndoStack::setClean()
+void tst_UiUndoStack::setClean()
{
- QUndoStack stack;
+ UiUndoStack stack;
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@@ -1131,9 +1131,9 @@ void tst_QUndoStack::setClean()
QCOMPARE(stack.cleanIndex(), -1);
}
-void tst_QUndoStack::clear()
+void tst_UiUndoStack::clear()
{
- QUndoStack stack;
+ UiUndoStack stack;
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@@ -1311,9 +1311,9 @@ void tst_QUndoStack::clear()
true); // redoChanged
}
-void tst_QUndoStack::childCommand()
+void tst_UiUndoStack::childCommand()
{
- QUndoStack stack;
+ UiUndoStack stack;
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@@ -1343,7 +1343,7 @@ void tst_QUndoStack::childCommand()
true, // undoChanged
true); // redoChanged
- QUndoCommand *cmd = new QUndoCommand();
+ UiUndoCommand *cmd = new UiUndoCommand();
cmd->setText("ding");
new InsertCommand(&str, 5, "world", cmd);
new RemoveCommand(&str, 4, 1, cmd);
@@ -1411,9 +1411,9 @@ void tst_QUndoStack::childCommand()
true); // redoChanged
}
-void tst_QUndoStack::macroBeginEnd()
+void tst_UiUndoStack::macroBeginEnd()
{
- QUndoStack stack;
+ UiUndoStack stack;
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@@ -1836,9 +1836,9 @@ void tst_QUndoStack::macroBeginEnd()
true); // redoChanged
}
-void tst_QUndoStack::compression()
+void tst_UiUndoStack::compression()
{
- QUndoStack stack;
+ UiUndoStack stack;
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@@ -2240,9 +2240,9 @@ void tst_QUndoStack::compression()
true); // redoChanged
}
-void tst_QUndoStack::undoLimit()
+void tst_UiUndoStack::undoLimit()
{
- QUndoStack stack;
+ UiUndoStack stack;
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@@ -2719,12 +2719,12 @@ void tst_QUndoStack::undoLimit()
true); // redoChanged
}
-void tst_QUndoStack::separateUndoText()
+void tst_UiUndoStack::separateUndoText()
{
- QUndoStack stack;
+ UiUndoStack stack;
- QUndoCommand *command1 = new IdleCommand();
- QUndoCommand *command2 = new IdleCommand();
+ UiUndoCommand *command1 = new IdleCommand();
+ UiUndoCommand *command2 = new IdleCommand();
stack.push(command1);
stack.push(command2);
stack.undo();
@@ -2743,6 +2743,6 @@ void tst_QUndoStack::separateUndoText()
QCOMPARE(command1->text(), QString("idle-item"));
}
-QTEST_MAIN(tst_QUndoStack)
+QTEST_MAIN(tst_UiUndoStack)
-#include "tst_qundostack.moc"
+#include "tst_uiundostack.moc"
diff --git a/tests/auto/utils/uiundostack/uiundostack.pro b/tests/auto/utils/uiundostack/uiundostack.pro
new file mode 100644
index 0000000..d932c04
--- /dev/null
+++ b/tests/auto/utils/uiundostack/uiundostack.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase
+TARGET = tst_uiundostack
+
+QT += testlib uihelpers
+
+SOURCES += tst_uiundostack.cpp
diff --git a/tests/auto/utils/utils.pro b/tests/auto/utils/utils.pro
new file mode 100644
index 0000000..14f244e
--- /dev/null
+++ b/tests/auto/utils/utils.pro
@@ -0,0 +1,4 @@
+TEMPLATE=subdirs
+SUBDIRS=\
+ uiundogroup \
+ uiundostack