summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/arthur/data/qps/aliasing.qps156
-rw-r--r--tests/arthur/data/qps/aliasing_qps.pngbin0 -> 30531 bytes
-rw-r--r--tests/auto/headers/tst_headers.cpp4
-rw-r--r--tests/auto/moc/tst_moc.cpp35
-rw-r--r--tests/auto/modeltest/dynamictreemodel.cpp (renamed from tests/auto/qabstractitemmodel/dynamictreemodel.cpp)0
-rw-r--r--tests/auto/modeltest/dynamictreemodel.h (renamed from tests/auto/qabstractitemmodel/dynamictreemodel.h)0
-rw-r--r--tests/auto/modeltest/modeltest.cpp20
-rw-r--r--tests/auto/modeltest/modeltest.pro4
-rw-r--r--tests/auto/modeltest/tst_modeltest.cpp157
-rw-r--r--tests/auto/qabstractitemmodel/qabstractitemmodel.pro7
-rw-r--r--tests/auto/qabstractitemview/tst_qabstractitemview.cpp23
-rw-r--r--tests/auto/qboxlayout/tst_qboxlayout.cpp27
-rw-r--r--tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp25
-rw-r--r--tests/auto/qdbusreply/tst_qdbusreply.cpp16
-rw-r--r--tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp12
-rw-r--r--tests/auto/qfile/tst_qfile.cpp116
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp1
-rw-r--r--tests/auto/qfiledialog2/tst_qfiledialog2.cpp108
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp12
-rw-r--r--tests/auto/qfontcombobox/tst_qfontcombobox.cpp4
-rw-r--r--tests/auto/qftp/tst_qftp.cpp5
-rw-r--r--tests/auto/qgl/tst_qgl.cpp52
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp20
-rw-r--r--tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp49
-rw-r--r--tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp2
-rw-r--r--tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp382
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp40
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp117
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp32
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp49
-rw-r--r--tests/auto/qhttp/tst_qhttp.cpp5
-rw-r--r--tests/auto/qimagereader/images/endless-anim.gifbin0 -> 819 bytes
-rw-r--r--tests/auto/qimagereader/images/four-frames.gifbin0 -> 427 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc2
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp148
-rw-r--r--tests/auto/qlistwidget/tst_qlistwidget.cpp8
-rw-r--r--tests/auto/qobject/tst_qobject.cpp152
-rw-r--r--tests/auto/qpauseanimation/tst_qpauseanimation.cpp4
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp6
-rw-r--r--tests/auto/qpixmapcache/tst_qpixmapcache.cpp19
-rw-r--r--tests/auto/qresourceengine/tst_qresourceengine.cpp22
-rw-r--r--tests/auto/qscriptable/tst_qscriptable.cpp1
-rw-r--r--tests/auto/qsharedmemory/tst_qsharedmemory.cpp4
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp59
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp62
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp11
-rw-r--r--tests/auto/qtcpserver/test/test.pro2
-rw-r--r--tests/auto/qtcpserver/tst_qtcpserver.cpp180
-rw-r--r--tests/auto/qtcpsocket/test/test.pro2
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp24
-rw-r--r--tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp4
-rw-r--r--tests/auto/qudpsocket/test/test.pro1
-rw-r--r--tests/auto/qudpsocket/tst_qudpsocket.cpp18
-rw-r--r--tests/auto/qurl/tst_qurl.cpp7
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp17
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp30
-rw-r--r--tests/auto/selftests/tst_selftests.cpp6
-rw-r--r--tests/auto/uic/baseline/config_fromuic3.ui1647
-rw-r--r--tests/auto/uic/baseline/config_fromuic3.ui.h715
-rw-r--r--tests/auto/uic3/baseline/config.ui11
-rw-r--r--tests/auto/uic3/baseline/config.ui.410
-rw-r--r--tests/benchmarks/benchmarks.pro23
-rw-r--r--tests/benchmarks/containers-sequential/main.cpp17
-rw-r--r--tests/benchmarks/events/main.cpp15
-rw-r--r--tests/benchmarks/qbytearray/main.cpp5
-rw-r--r--tests/benchmarks/qdiriterator/main.cpp10
-rwxr-xr-xtests/benchmarks/qdiriterator/qdiriterator.pro2
-rw-r--r--tests/benchmarks/qfile/main.cpp58
-rw-r--r--tests/benchmarks/qgraphicsview/qgraphicsview.pro8
-rw-r--r--tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp238
-rw-r--r--tests/benchmarks/qhostinfo/main.cpp96
-rwxr-xr-xtests/benchmarks/qhostinfo/qhostinfo.pro13
-rw-r--r--tests/benchmarks/qstringlist/qstringlist.pro2
-rw-r--r--tests/benchmarks/qstylesheetstyle/main.cpp19
-rw-r--r--tests/benchmarks/qtcpserver/qtcpserver.pro13
-rw-r--r--tests/benchmarks/qtcpserver/tst_qtcpserver.cpp277
-rw-r--r--tests/benchmarks/qthreadstorage/qthreadstorage.pro6
-rw-r--r--tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp124
-rw-r--r--tests/manual/qgraphicsitemgroup/customitem.cpp107
-rw-r--r--tests/manual/qgraphicsitemgroup/customitem.h77
-rw-r--r--tests/manual/qgraphicsitemgroup/main.cpp51
-rw-r--r--tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro8
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.cpp260
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.h93
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.ui319
85 files changed, 5784 insertions, 709 deletions
diff --git a/tests/arthur/data/qps/aliasing.qps b/tests/arthur/data/qps/aliasing.qps
new file mode 100644
index 0000000..59878f9
--- /dev/null
+++ b/tests/arthur/data/qps/aliasing.qps
@@ -0,0 +1,156 @@
+
+path_moveTo convexPath 25 0
+path_lineTo convexPath 50 50
+path_lineTo convexPath 25 25
+path_lineTo convexPath 0 50
+path_closeSubpath convexPath
+
+pixmap_load border.png pixmap
+
+setRenderHint LineAntialiasing false
+translate 10 10
+
+begin_block drawing
+ setPen black 1
+ setBrush 7f7fff
+ drawPath convexPath
+
+ setFont "monospace" 8
+ setPen black
+ drawText 0 68 "QwErTy@"
+
+
+ setPen black 1
+ setBrush 7f7fff
+ drawRect 0 80 10 5
+
+ setPen black 1
+ setBrush noBrush
+ drawRect 20 80 10 5
+
+ setPen noPen
+ setBrush 7f7fff
+ drawRect 40 80 10 5
+
+
+ setPen black 2
+ setBrush 7f7fff
+ drawRect 0 90 10 5
+
+ setPen black 2
+ setBrush noBrush
+ drawRect 20 90 10 5
+
+ setPen noPen
+ setBrush 7f7fff
+ drawRect 40 90 10 5
+
+
+ setPen black 3
+ setBrush 7f7fff
+ drawRect 0 100 10 5
+
+ setPen black 3
+ setBrush noBrush
+ drawRect 20 100 10 5
+
+ setPen noPen
+ setBrush 7f7fff
+ drawRect 40 100 10 5
+
+
+ setPen black 1
+ setBrush noBrush
+ drawLine 10 110 20 120
+ drawLine 30 120 40 110
+
+ setPen black 2
+ setBrush noBrush
+ drawLine 10 120 20 130
+ drawLine 30 130 40 120
+
+ setPen black 3
+ setBrush noBrush
+ drawLine 10 130 20 140
+ drawLine 30 140 40 130
+
+ drawPixmap pixmap 0 150
+
+ setRenderHint SmoothPixmapTransform false
+ drawPixmap pixmap 20 150 15 15 0 0 10 10
+
+end_block
+
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+drawText 15 185 "0.0"
+
+resetMatrix
+translate 70.2 10.2
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+translate -0.2 -0.2
+drawText 15 185 "0.2"
+
+
+resetMatrix
+translate 130.4 10.4
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+translate -0.4 -0.4
+drawText 15 185 "0.4"
+
+
+resetMatrix
+translate 190.5 10.5
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+translate -0.5 -0.5
+drawText 15 185 "0.5"
+
+
+resetMatrix
+translate 250.6 10.6
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+translate -0.6 -0.6
+drawText 15 185 "0.6"
+
+
+resetMatrix
+translate 310.8 10.8
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+translate -0.8 -0.8
+drawText 15 185 "0.8"
+
+
+resetMatrix
+translate 371 11
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+drawText 15 185 "1.0"
+
+
+resetMatrix
+drawText 430 95 "Aliased"
+drawText 430 275 "Anti-Aliased" \ No newline at end of file
diff --git a/tests/arthur/data/qps/aliasing_qps.png b/tests/arthur/data/qps/aliasing_qps.png
new file mode 100644
index 0000000..183129b
--- /dev/null
+++ b/tests/arthur/data/qps/aliasing_qps.png
Binary files differ
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp
index 36d25fe..329143d 100644
--- a/tests/auto/headers/tst_headers.cpp
+++ b/tests/auto/headers/tst_headers.cpp
@@ -217,8 +217,8 @@ void tst_Headers::licenseCheck()
QCOMPARE(content.at(i++), QString("/****************************************************************************"));
if (licenseType != "3RDPARTY") {
QCOMPARE(content.at(i++), QString("**"));
- if (sourceFile.endsWith("/tests/auto/qabstractitemmodel/dynamictreemodel.cpp")
- || sourceFile.endsWith("/tests/auto/qabstractitemmodel/dynamictreemodel.h")
+ if (sourceFile.endsWith("/tests/auto/modeltest/dynamictreemodel.cpp")
+ || sourceFile.endsWith("/tests/auto/modeltest/dynamictreemodel.h")
|| sourceFile.endsWith("/src/network/kernel/qnetworkproxy_p.h"))
{
// These files are not copyrighted by Nokia.
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index 2316ba2..1ca2b3a 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -489,6 +489,7 @@ private slots:
void constructors();
void typenameWithUnsigned();
void warnOnVirtualSignal();
+ void QTBUG5590_dummyProperty();
signals:
void sigWithUnsignedArg(unsigned foo);
void sigWithSignedArg(signed foo);
@@ -1216,6 +1217,40 @@ void tst_Moc::warnOnVirtualSignal()
#endif
}
+
+class QTBUG5590_DummyObject: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool dummy)
+};
+
+class QTBUG5590_PropertyObject: public QTBUG5590_DummyObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int value2 READ value2 WRITE setValue2)
+
+ public:
+ QTBUG5590_PropertyObject() : m_value(85), m_value2(40) { }
+ int value() const { return m_value; }
+ void setValue(int value) { m_value = value; }
+ int value2() const { return m_value2; }
+ void setValue2(int value) { m_value2 = value; }
+ private:
+ int m_value, m_value2;
+};
+
+void tst_Moc::QTBUG5590_dummyProperty()
+{
+ QTBUG5590_PropertyObject o;
+ QCOMPARE(o.property("value").toInt(), 85);
+ QCOMPARE(o.property("value2").toInt(), 40);
+ o.setProperty("value", 32);
+ QCOMPARE(o.value(), 32);
+ o.setProperty("value2", 82);
+ QCOMPARE(o.value2(), 82);
+}
+
QTEST_APPLESS_MAIN(tst_Moc)
#include "tst_moc.moc"
diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.cpp b/tests/auto/modeltest/dynamictreemodel.cpp
index 24d3ab3..24d3ab3 100644
--- a/tests/auto/qabstractitemmodel/dynamictreemodel.cpp
+++ b/tests/auto/modeltest/dynamictreemodel.cpp
diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.h b/tests/auto/modeltest/dynamictreemodel.h
index 3f0d90d..3f0d90d 100644
--- a/tests/auto/qabstractitemmodel/dynamictreemodel.h
+++ b/tests/auto/modeltest/dynamictreemodel.h
diff --git a/tests/auto/modeltest/modeltest.cpp b/tests/auto/modeltest/modeltest.cpp
index 39d00f6..0ca9e14 100644
--- a/tests/auto/modeltest/modeltest.cpp
+++ b/tests/auto/modeltest/modeltest.cpp
@@ -475,8 +475,8 @@ void ModelTest::data()
void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int end )
{
// Q_UNUSED(end);
- qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString()
- << "current count of parent=" << model->rowCount ( parent ); // << "display of last=" << model->data( model->index(start-1, 0, parent) );
+// qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString()
+// << "current count of parent=" << model->rowCount ( parent ); // << "display of last=" << model->data( model->index(start-1, 0, parent) );
// qDebug() << model->index(start-1, 0, parent) << model->data( model->index(start-1, 0, parent) );
Changing c;
c.parent = parent;
@@ -495,14 +495,14 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
{
Changing c = insert.pop();
Q_ASSERT ( c.parent == parent );
- qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
- << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
-
- for (int ii=start; ii <= end; ii++)
- {
- qDebug() << "itemWasInserted:" << ii << model->data ( model->index ( ii, 0, parent ));
- }
- qDebug();
+// qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
+// << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
+
+// for (int ii=start; ii <= end; ii++)
+// {
+// qDebug() << "itemWasInserted:" << ii << model->data ( model->index ( ii, 0, parent ));
+// }
+// qDebug();
Q_ASSERT ( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) );
Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
diff --git a/tests/auto/modeltest/modeltest.pro b/tests/auto/modeltest/modeltest.pro
index 6655d85..f157da0 100644
--- a/tests/auto/modeltest/modeltest.pro
+++ b/tests/auto/modeltest/modeltest.pro
@@ -1,6 +1,6 @@
load(qttest_p4)
-SOURCES += tst_modeltest.cpp modeltest.cpp
-HEADERS += modeltest.h
+SOURCES += tst_modeltest.cpp modeltest.cpp dynamictreemodel.cpp
+HEADERS += modeltest.h dynamictreemodel.h
diff --git a/tests/auto/modeltest/tst_modeltest.cpp b/tests/auto/modeltest/tst_modeltest.cpp
index a719168..262b966 100644
--- a/tests/auto/modeltest/tst_modeltest.cpp
+++ b/tests/auto/modeltest/tst_modeltest.cpp
@@ -44,6 +44,7 @@
#include <QtGui/QtGui>
#include "modeltest.h"
+#include "dynamictreemodel.h"
class tst_ModelTest : public QObject
@@ -64,6 +65,8 @@ private slots:
void stringListModel();
void treeWidgetModel();
void standardItemModel();
+ void testInsertThroughProxy();
+ void moveSourceItems();
};
@@ -92,15 +95,15 @@ void tst_ModelTest::stringListModel()
{
QStringListModel model;
QSortFilterProxyModel proxy;
-
+
ModelTest t1(&model);
ModelTest t2(&proxy);
-
+
proxy.setSourceModel(&model);
-
+
model.setStringList(QStringList() << "2" << "3" << "1");
model.setStringList(QStringList() << "a" << "e" << "plop" << "b" << "c" );
-
+
proxy.setDynamicSortFilter(true);
proxy.setFilterRegExp(QRegExp("[^b]"));
}
@@ -110,7 +113,7 @@ void tst_ModelTest::treeWidgetModel()
QTreeWidget widget;
ModelTest t1(widget.model());
-
+
QTreeWidgetItem *root = new QTreeWidgetItem(&widget, QStringList("root"));
for (int i = 0; i < 20; ++i) {
new QTreeWidgetItem(root, QStringList(QString::number(i)));
@@ -120,7 +123,7 @@ void tst_ModelTest::treeWidgetModel()
QTreeWidgetItem *parent = new QTreeWidgetItem(&widget, QStringList("parent"));
new QTreeWidgetItem(parent, QStringList("child"));
widget.setItemHidden(parent, true);
-
+
widget.sortByColumn(0);
}
@@ -128,23 +131,153 @@ void tst_ModelTest::standardItemModel()
{
QStandardItemModel model(10,10);
QSortFilterProxyModel proxy;
-
-
+
+
ModelTest t1(&model);
ModelTest t2(&proxy);
-
+
proxy.setSourceModel(&model);
-
+
model.insertRows(2, 5);
model.removeRows(4, 5);
model.insertColumns(2, 5);
model.removeColumns(4, 5);
-
+
model.insertRows(0,5, model.index(1,1));
model.insertColumns(0,5, model.index(1,3));
-
}
+void tst_ModelTest::testInsertThroughProxy()
+{
+ DynamicTreeModel *model = new DynamicTreeModel(this);
+
+ QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
+ proxy->setSourceModel(model);
+
+ new ModelTest(proxy, this);
+
+ ModelInsertCommand *insertCommand = new ModelInsertCommand(model, this);
+ insertCommand->setNumCols(4);
+ insertCommand->setStartRow(0);
+ insertCommand->setEndRow(9);
+ // Parent is QModelIndex()
+ insertCommand->doCommand();
+
+ insertCommand = new ModelInsertCommand(model, this);
+ insertCommand->setNumCols(4);
+ insertCommand->setAncestorRowNumbers(QList<int>() << 5);
+ insertCommand->setStartRow(0);
+ insertCommand->setEndRow(9);
+ insertCommand->doCommand();
+
+ ModelMoveCommand *moveCommand = new ModelMoveCommand(model, this);
+ moveCommand->setNumCols(4);
+ moveCommand->setStartRow(0);
+ moveCommand->setEndRow(0);
+ moveCommand->setDestRow(9);
+ moveCommand->setDestAncestors(QList<int>() << 5);
+ moveCommand->doCommand();
+}
+
+/**
+ Makes the persistent index list publicly accessible
+*/
+class AccessibleProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+public:
+ AccessibleProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {}
+
+ QModelIndexList persistent()
+ {
+ return persistentIndexList();
+ }
+};
+
+class ObservingObject : public QObject
+{
+ Q_OBJECT
+public:
+ ObservingObject(AccessibleProxyModel *proxy, QObject *parent = 0)
+ : QObject(parent),
+ m_proxy(proxy)
+ {
+ connect(m_proxy, SIGNAL(layoutAboutToBeChanged()), SLOT(storePersistent()));
+ connect(m_proxy, SIGNAL(layoutChanged()), SLOT(checkPersistent()));
+ }
+
+public slots:
+
+ void storePersistent(const QModelIndex &parent)
+ {
+ for (int row = 0; row < m_proxy->rowCount(parent); ++row) {
+ QModelIndex proxyIndex = m_proxy->index(row, 0, parent);
+ QModelIndex sourceIndex = m_proxy->mapToSource(proxyIndex);
+ Q_ASSERT(proxyIndex.isValid());
+ Q_ASSERT(sourceIndex.isValid());
+ m_persistentSourceIndexes.append(sourceIndex);
+ m_persistentProxyIndexes.append(proxyIndex);
+ if (m_proxy->hasChildren(proxyIndex))
+ storePersistent(proxyIndex);
+ }
+ }
+
+ void storePersistent()
+ {
+ m_persistentSourceIndexes.clear();
+ m_persistentProxyIndexes.clear();
+ Q_ASSERT(m_proxy->persistent().isEmpty());
+ storePersistent(QModelIndex());
+ Q_ASSERT(!m_proxy->persistent().isEmpty());
+ }
+
+ void checkPersistent()
+ {
+ for (int row = 0; row < m_persistentProxyIndexes.size(); ++row) {
+ QModelIndex updatedProxy = m_persistentProxyIndexes.at(row);
+ QModelIndex updatedSource = m_persistentSourceIndexes.at(row);
+ }
+ for (int row = 0; row < m_persistentProxyIndexes.size(); ++row) {
+ QModelIndex updatedProxy = m_persistentProxyIndexes.at(row);
+ QModelIndex updatedSource = m_persistentSourceIndexes.at(row);
+ QCOMPARE(m_proxy->mapToSource(updatedProxy), updatedSource);
+ }
+ }
+
+private:
+ AccessibleProxyModel *m_proxy;
+ QList<QPersistentModelIndex> m_persistentSourceIndexes;
+ QList<QPersistentModelIndex> m_persistentProxyIndexes;
+};
+
+void tst_ModelTest::moveSourceItems()
+{
+ DynamicTreeModel *model = new DynamicTreeModel(this);
+ AccessibleProxyModel *proxy = new AccessibleProxyModel(this);
+ proxy->setSourceModel(model);
+
+ ModelInsertCommand *insertCommand = new ModelInsertCommand(model, this);
+ insertCommand->setStartRow(0);
+ insertCommand->setEndRow(2);
+ insertCommand->doCommand();
+
+ insertCommand = new ModelInsertCommand(model, this);
+ insertCommand->setAncestorRowNumbers(QList<int>() << 1);
+ insertCommand->setStartRow(0);
+ insertCommand->setEndRow(2);
+ insertCommand->doCommand();
+
+ ObservingObject observer(proxy);
+
+ ModelMoveCommand *moveCommand = new ModelMoveCommand(model, this);
+ moveCommand->setStartRow(0);
+ moveCommand->setEndRow(0);
+ moveCommand->setDestAncestors(QList<int>() << 1);
+ moveCommand->setDestRow(0);
+ moveCommand->doCommand();
+}
+
+
QTEST_MAIN(tst_ModelTest)
#include "tst_modeltest.moc"
diff --git a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
index a31868b..52c4e96 100644
--- a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
+++ b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
@@ -1,6 +1,9 @@
load(qttest_p4)
-SOURCES += tst_qabstractitemmodel.cpp dynamictreemodel.cpp
-HEADERS += dynamictreemodel.h
+
+INCLUDEPATH += $$PWD/../modeltest
+
+SOURCES += tst_qabstractitemmodel.cpp ../modeltest/dynamictreemodel.cpp ../modeltest/modeltest.cpp
+HEADERS += ../modeltest/dynamictreemodel.h ../modeltest/modeltest.h
diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
index 6479829..bf3af63 100644
--- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
@@ -48,6 +48,7 @@
#include <qlistview.h>
#include <qlistwidget.h>
#include <qtableview.h>
+#include <qtablewidget.h>
#include <qtreeview.h>
#include <qtreewidget.h>
#include <qheaderview.h>
@@ -226,6 +227,7 @@ private slots:
void shiftSelectionAfterRubberbandSelection();
void ctrlRubberbandSelection();
void QTBUG6407_extendedSelection();
+ void QTBUG6753_selectOnSelection();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -1475,5 +1477,26 @@ void tst_QAbstractItemView::QTBUG6407_extendedSelection()
}
+void tst_QAbstractItemView::QTBUG6753_selectOnSelection()
+{
+ QTableWidget table(5, 5);
+ for (int i = 0; i < table.rowCount(); ++i)
+ for (int j = 0; j < table.columnCount(); ++j)
+ table.setItem(i, j, new QTableWidgetItem("choo-be-doo-wah"));
+
+ table.show();
+ table.setSelectionMode(QAbstractItemView::ExtendedSelection);
+ table.selectAll();
+ QTest::qWaitForWindowShown(&table);
+ QModelIndex item = table.model()->index(1,1);
+ QRect itemRect = table.visualRect(item);
+ QTest::mouseMove(table.viewport(), itemRect.center());
+ QTest::mouseClick(table.viewport(), Qt::LeftButton, Qt::NoModifier, itemRect.center());
+ QTest::qWait(20);
+
+ QCOMPARE(table.selectedItems().count(), 1);
+ QCOMPARE(table.selectedItems().first(), table.item(item.row(), item.column()));
+}
+
QTEST_MAIN(tst_QAbstractItemView)
#include "tst_qabstractitemview.moc"
diff --git a/tests/auto/qboxlayout/tst_qboxlayout.cpp b/tests/auto/qboxlayout/tst_qboxlayout.cpp
index 8887288..48235e8 100644
--- a/tests/auto/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/qboxlayout/tst_qboxlayout.cpp
@@ -66,6 +66,8 @@ private slots:
void sizeConstraints();
void setGeometry();
void setStyleShouldChangeSpacing();
+
+ void taskQTBUG_7103_minMaxWidthNotRespected();
};
class CustomLayoutStyle : public QWindowsStyle
@@ -246,6 +248,31 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing()
delete style2;
}
+void tst_QBoxLayout::taskQTBUG_7103_minMaxWidthNotRespected()
+{
+ QLabel *label = new QLabel("Qt uses standard C++, but makes extensive use of the C pre-processor to enrich the language. Qt can also be used in several other programming languages via language bindings. It runs on all major platforms, and has extensive internationalization support. Non-GUI features include SQL database access, XML parsing, thread management, network support and a unified cross-platform API for file handling.");
+ label->setWordWrap(true);
+ label->setFixedWidth(200);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(label);
+ layout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding));
+
+ QWidget widget;
+ widget.setLayout(layout);
+ widget.show();
+ QTest::qWaitForWindowShown(&widget);
+
+ int height = label->height();
+
+ QRect g = widget.geometry();
+ g.setWidth(600);
+ widget.setGeometry(g);
+
+ QTest::qWait(50);
+
+ QCOMPARE(label->height(), height);
+}
QTEST_MAIN(tst_QBoxLayout)
#include "tst_qboxlayout.moc"
diff --git a/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp b/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp
index 6398d9c..82e6389 100644
--- a/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp
+++ b/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp
@@ -93,6 +93,7 @@ private slots:
}
void init();
+ void unconnected();
void simpleTypes();
void complexTypes();
void wrongTypes();
@@ -252,6 +253,30 @@ void tst_QDBusPendingReply::init()
QVERIFY(iface->isValid());
}
+void tst_QDBusPendingReply::unconnected()
+{
+ QDBusConnection con("invalid stored connection");
+ QVERIFY(!con.isConnected());
+ QDBusInterface iface("doesnt.matter", "/", "doesnt.matter", con);
+ QVERIFY(!iface.isValid());
+
+ QDBusPendingReply<> rvoid = iface.asyncCall("ReloadConfig");
+ QVERIFY(rvoid.isFinished());
+ QVERIFY(!rvoid.isValid());
+ QVERIFY(rvoid.isError());
+ rvoid.waitForFinished();
+ QVERIFY(!rvoid.isValid());
+ QVERIFY(rvoid.isError());
+
+ QDBusPendingReply<QString> rstring = iface.asyncCall("GetId");
+ QVERIFY(rstring.isFinished());
+ QVERIFY(!rstring.isValid());
+ QVERIFY(rstring.isError());
+ rstring.waitForFinished();
+ QVERIFY(!rstring.isValid());
+ QVERIFY(rstring.isError());
+}
+
void tst_QDBusPendingReply::simpleTypes()
{
QDBusPendingReply<> rvoid = iface->asyncCall("retrieveVoid");
diff --git a/tests/auto/qdbusreply/tst_qdbusreply.cpp b/tests/auto/qdbusreply/tst_qdbusreply.cpp
index 9866302..e36d288 100644
--- a/tests/auto/qdbusreply/tst_qdbusreply.cpp
+++ b/tests/auto/qdbusreply/tst_qdbusreply.cpp
@@ -93,6 +93,7 @@ private slots:
}
void init();
+ void unconnected();
void simpleTypes();
void complexTypes();
void wrongTypes();
@@ -236,6 +237,21 @@ void tst_QDBusReply::init()
QVERIFY(iface->isValid());
}
+void tst_QDBusReply::unconnected()
+{
+ QDBusConnection con("invalid stored connection");
+ QVERIFY(!con.isConnected());
+ QDBusInterface iface("doesnt.matter", "/", "doesnt.matter", con);
+ QVERIFY(!iface.isValid());
+
+ QDBusReply<void> rvoid = iface.asyncCall("ReloadConfig");
+ QVERIFY(!rvoid.isValid());
+
+ QDBusReply<QString> rstring = iface.asyncCall("GetId");
+ QVERIFY(!rstring.isValid());
+ QVERIFY(rstring.value().isEmpty());
+}
+
void tst_QDBusReply::simpleTypes()
{
QDBusReply<bool> rbool = iface->call(QDBus::BlockWithGui, "retrieveBool");
diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
index 7f03153..a3f0915 100644
--- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
@@ -148,6 +148,7 @@ private slots:
void task255471_decimalsValidation();
void taskQTBUG_5008_textFromValueAndValidate();
+ void taskQTBUG_6670_selectAllWithPrefix();
public slots:
void valueChangedHelper(const QString &);
@@ -1084,5 +1085,16 @@ void tst_QDoubleSpinBox::taskQTBUG_5008_textFromValueAndValidate()
QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value()));
}
+void tst_QDoubleSpinBox::taskQTBUG_6670_selectAllWithPrefix()
+{
+ DoubleSpinBox spin;
+ spin.setPrefix("$ ");
+ spin.lineEdit()->selectAll();
+ QTest::keyClick(spin.lineEdit(), Qt::Key_1);
+ QCOMPARE(spin.value(), 1.);
+ QTest::keyClick(spin.lineEdit(), Qt::Key_2);
+ QCOMPARE(spin.value(), 12.);
+}
+
QTEST_MAIN(tst_QDoubleSpinBox)
#include "tst_qdoublespinbox.moc"
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp
index 7ee5665..e88c222 100644
--- a/tests/auto/qfile/tst_qfile.cpp
+++ b/tests/auto/qfile/tst_qfile.cpp
@@ -129,6 +129,8 @@ private slots:
void readLine();
void readLine2();
void readLineNullInLine();
+ void readAll_data();
+ void readAll();
void readAllStdin();
void readLineStdin();
void readLineStdin_lineByLine();
@@ -220,6 +222,9 @@ public:
private:
enum FileType { OpenQFile, OpenFd, OpenStream };
+ void openStandardStreamsFileDescriptors();
+ void openStandardStreamsBufferedStreams();
+
bool openFd(QFile &file, QIODevice::OpenMode mode)
{
int fdMode = QT_OPEN_LARGEFILE | QT_OPEN_BINARY;
@@ -554,6 +559,10 @@ void tst_QFile::size()
QFETCH( QString, filename );
QFETCH( qint64, size );
+#ifdef Q_WS_WINCE
+ filename = QFileInfo(filename).absoluteFilePath();
+#endif
+
{
QFile f( filename );
QCOMPARE( f.size(), size );
@@ -564,24 +573,29 @@ void tst_QFile::size()
{
QFile f;
- int fd = QT_OPEN(filename.toLocal8Bit().constData(), QT_OPEN_RDONLY);
- QVERIFY( fd != -1 );
- QVERIFY( f.open(fd, QIODevice::ReadOnly) );
+ FILE* stream = QT_FOPEN(filename.toLocal8Bit().constData(), "rb");
+ QVERIFY( stream );
+ QVERIFY( f.open(stream, QIODevice::ReadOnly) );
QCOMPARE( f.size(), size );
f.close();
- QT_CLOSE(fd);
+ fclose(stream);
}
{
+#ifdef Q_WS_WINCE
+ QSKIP("Currently low level file I/O not well supported on Windows CE", SkipSingle);
+#endif
QFile f;
- FILE* stream = QT_FOPEN(filename.toLocal8Bit().constData(), "rb");
- QVERIFY( stream );
- QVERIFY( f.open(stream, QIODevice::ReadOnly) );
+
+ int fd = QT_OPEN(filename.toLocal8Bit().constData(), QT_OPEN_RDONLY);
+
+ QVERIFY( fd != -1 );
+ QVERIFY( f.open(fd, QIODevice::ReadOnly) );
QCOMPARE( f.size(), size );
f.close();
- fclose(stream);
+ QT_CLOSE(fd);
}
}
@@ -603,6 +617,7 @@ void tst_QFile::seek()
QVERIFY(file.seek(10));
QCOMPARE(file.pos(), qint64(10));
QCOMPARE(file.size(), qint64(0));
+ file.close();
QFile::remove("newfile.txt");
}
@@ -739,6 +754,45 @@ void tst_QFile::readLineNullInLine()
QCOMPARE(file.readLine(), QByteArray());
}
+void tst_QFile::readAll_data()
+{
+ QTest::addColumn<bool>("textMode");
+ QTest::addColumn<QString>("fileName");
+ QTest::newRow( "TextMode unixfile" ) << true << SRCDIR "testfile.txt";
+ QTest::newRow( "BinaryMode unixfile" ) << false << SRCDIR "testfile.txt";
+ QTest::newRow( "TextMode dosfile" ) << true << SRCDIR "dosfile.txt";
+ QTest::newRow( "BinaryMode dosfile" ) << false << SRCDIR "dosfile.txt";
+ QTest::newRow( "TextMode bigfile" ) << true << SRCDIR "tst_qfile.cpp";
+ QTest::newRow( "BinaryMode bigfile" ) << false << SRCDIR "tst_qfile.cpp";
+ QVERIFY(QFile(SRCDIR "tst_qfile.cpp").size() > 64*1024);
+}
+
+void tst_QFile::readAll()
+{
+ QFETCH( bool, textMode );
+ QFETCH( QString, fileName );
+
+ QFile file(fileName);
+ if (textMode)
+ QVERIFY(file.open(QFile::Text | QFile::ReadOnly));
+ else
+ QVERIFY(file.open(QFile::ReadOnly));
+
+ QByteArray a = file.readAll();
+ file.reset();
+ QVERIFY(file.pos() == 0);
+
+ QVERIFY(file.bytesAvailable() > 7);
+ QByteArray b = file.read(1);
+ char x;
+ file.getChar(&x);
+ b.append(x);
+ b.append(file.read(5));
+ b.append(file.readAll());
+
+ QCOMPARE(a, b);
+}
+
void tst_QFile::readAllStdin()
{
#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
@@ -1128,9 +1182,15 @@ void tst_QFile::copyFallback()
QVERIFY(QFile::exists("file-copy-destination.txt"));
QVERIFY(!file.isOpen());
+#ifdef Q_WS_WINCE
// Need to reset permissions on Windows to be able to delete
QVERIFY(QFile::setPermissions("file-copy-destination.txt",
- QFile::ReadOwner | QFile::WriteOwner));
+ QFile::WriteOther));
+#else
+ // Need to reset permissions on Windows to be able to delete
+ QVERIFY(QFile::setPermissions("file-copy-destination.txt",
+ QFile::ReadOwner | QFile::WriteOwner));
+#endif
QVERIFY(QFile::remove("file-copy-destination.txt"));
// Fallback copy of open file.
@@ -1139,6 +1199,7 @@ void tst_QFile::copyFallback()
QVERIFY(QFile::exists("file-copy-destination.txt"));
QVERIFY(!file.isOpen());
+ file.close();
QFile::remove("file-copy-destination.txt");
}
@@ -2239,6 +2300,7 @@ void tst_QFile::rename()
QFile file(source);
QCOMPARE(file.rename(destination), result);
+
if (result)
QCOMPARE(file.error(), QFile::NoError);
else
@@ -2367,6 +2429,7 @@ void tst_QFile::appendAndRead()
QCOMPARE(readFile.read(1 << j).size(), 1 << j);
}
+ readFile.close();
QFile::remove(QLatin1String("appendfile.txt"));
}
@@ -2608,10 +2671,15 @@ void tst_QFile::map()
QFETCH(QFile::FileError, error);
QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile";
+
+#ifdef Q_WS_WINCE
+ fileName = QFileInfo(fileName).absoluteFilePath();
+#endif
+
if (QFile::exists(fileName)) {
QVERIFY(QFile::setPermissions(fileName,
QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser));
- QFile::remove(fileName);
+ QFile::remove(fileName);
}
QFile file(fileName);
@@ -2650,8 +2718,13 @@ void tst_QFile::map()
QCOMPARE(file.error(), QFile::NoError);
// hpux wont let you map multiple times.
-#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API)
+#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API) && !defined(Q_OS_WINCE)
// exotic test to make sure that multiple maps work
+
+ // note: windows ce does not reference count mutliple maps
+ // it's essentially just the same reference but it
+ // cause a resource lock on the file which prevents it
+ // from being removed uchar *memory1 = file.map(0, file.size());
uchar *memory1 = file.map(0, file.size());
QCOMPARE(file.error(), QFile::NoError);
uchar *memory2 = file.map(0, file.size());
@@ -2687,7 +2760,6 @@ void tst_QFile::map()
QVERIFY(!memory);
QVERIFY(file.setPermissions(originalPermissions));
}
-
QVERIFY(file.remove());
}
@@ -2800,8 +2872,14 @@ void tst_QFile::openDirectory()
f1.close();
}
-void tst_QFile::openStandardStreams()
+void tst_QFile::openStandardStreamsFileDescriptors()
{
+#ifdef Q_WS_WINCE
+ //allthough Windows CE (not mobile!) has functions that allow redirecting
+ //the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW)
+ //it does not have functions to simply open them like below .
+ QSKIP("Opening standard streams on Windows CE via descriptor not implemented", SkipAll);
+#endif
// Using file descriptors
{
QFile in;
@@ -2826,7 +2904,13 @@ void tst_QFile::openStandardStreams()
QCOMPARE( err.size(), (qint64)0 );
QVERIFY( err.isSequential() );
}
+}
+void tst_QFile::openStandardStreamsBufferedStreams()
+{
+#if defined (Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QSKIP("Unix only test.", SkipAll);
+#endif
// Using streams
{
QFile in;
@@ -2853,6 +2937,12 @@ void tst_QFile::openStandardStreams()
}
}
+void tst_QFile::openStandardStreams()
+{
+ openStandardStreamsFileDescriptors();
+ openStandardStreamsBufferedStreams();
+}
+
void tst_QFile::writeNothing()
{
for (int i = 0; i < 3; ++i) {
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index 2f9410b..220e1d1 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -949,6 +949,7 @@ void tst_QFiledialog::selectFiles()
QLineEdit *lineEdit = qFindChild<QLineEdit*>(dialog, "fileNameEdit");
QVERIFY(lineEdit);
QCOMPARE(lineEdit->text(),QLatin1String("blah"));
+ delete dialog;
}
void tst_QFiledialog::viewMode()
diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
index 83ddd39..c3f88c4 100644
--- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
@@ -130,6 +130,8 @@ private slots:
void task259105_filtersCornerCases();
void QTBUG4419_lineEditSelectAll();
+ void QTBUG6558_showDirsOnly();
+ void QTBUG4842_selectFilterWithHideNameFilterDetails();
private:
QByteArray userSettings;
@@ -1040,5 +1042,111 @@ void tst_QFiledialog::QTBUG4419_lineEditSelectAll()
QCOMPARE(tempPath + QChar('/') + lineEdit->selectedText(), t->fileName());
}
+void tst_QFiledialog::QTBUG6558_showDirsOnly()
+{
+ const QString tempPath = QDir::tempPath();
+ QDir dirTemp(tempPath);
+ const QString tempName = QLatin1String("showDirsOnly.") + QString::number(qrand());
+ dirTemp.mkdir(tempName);
+ dirTemp.cd(tempName);
+ QTRY_VERIFY(dirTemp.exists());
+
+ const QString dirPath = dirTemp.absolutePath();
+ QDir dir(dirPath);
+
+ //We create two dirs
+ dir.mkdir("a");
+ dir.mkdir("b");
+
+ //Create a file
+ QFile tempFile(dirPath + "/plop.txt");
+ tempFile.open(QIODevice::WriteOnly | QIODevice::Text);
+ QTextStream out(&tempFile);
+ out << "The magic number is: " << 49 << "\n";
+ tempFile.close();
+
+ QNonNativeFileDialog fd(0, "TestFileDialog");
+
+ fd.setDirectory(dir.absolutePath());
+ fd.setViewMode(QFileDialog::List);
+ fd.setAcceptMode(QFileDialog::AcceptSave);
+ fd.setOption(QFileDialog::ShowDirsOnly, true);
+ fd.show();
+
+ QApplication::setActiveWindow(&fd);
+ QTest::qWaitForWindowShown(&fd);
+ QTRY_COMPARE(fd.isVisible(), true);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
+
+ QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
+ QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 2);
+
+ fd.setOption(QFileDialog::ShowDirsOnly, false);
+ QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 3);
+
+ fd.setOption(QFileDialog::ShowDirsOnly, true);
+ QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 2);
+
+ fd.setFileMode(QFileDialog::DirectoryOnly);
+ QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 2);
+ QTRY_COMPARE(bool(fd.options() & QFileDialog::ShowDirsOnly), true);
+
+ fd.setFileMode(QFileDialog::AnyFile);
+ QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 3);
+ QTRY_COMPARE(bool(fd.options() & QFileDialog::ShowDirsOnly), false);
+
+ fd.setDirectory(QDir::homePath());
+
+ //We remove the dirs
+ dir.rmdir("a");
+ dir.rmdir("b");
+
+ //we delete the file
+ tempFile.remove();
+
+ dirTemp.cdUp();
+ dirTemp.rmdir(tempName);
+}
+
+void tst_QFiledialog::QTBUG4842_selectFilterWithHideNameFilterDetails()
+{
+ QStringList filtersStr;
+ filtersStr << "Images (*.png *.xpm *.jpg)" << "Text files (*.txt)" << "XML files (*.xml)";
+ QString chosenFilterString("Text files (*.txt)");
+
+ QNonNativeFileDialog fd(0, "TestFileDialog");
+ fd.setAcceptMode(QFileDialog::AcceptSave);
+ fd.setOption(QFileDialog::HideNameFilterDetails, true);
+ fd.setNameFilters(filtersStr);
+ fd.selectNameFilter(chosenFilterString);
+ fd.show();
+
+ QApplication::setActiveWindow(&fd);
+ QTest::qWaitForWindowShown(&fd);
+ QTRY_COMPARE(fd.isVisible(), true);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
+
+ QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
+ //We compare the current combobox text with the stripped version
+ QCOMPARE(filters->currentText(), QString("Text files"));
+
+ QNonNativeFileDialog fd2(0, "TestFileDialog");
+ fd2.setAcceptMode(QFileDialog::AcceptSave);
+ fd2.setOption(QFileDialog::HideNameFilterDetails, false);
+ fd2.setNameFilters(filtersStr);
+ fd2.selectNameFilter(chosenFilterString);
+ fd2.show();
+
+ QApplication::setActiveWindow(&fd2);
+ QTest::qWaitForWindowShown(&fd2);
+ QTRY_COMPARE(fd2.isVisible(), true);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd2));
+
+ QComboBox *filters2 = qFindChild<QComboBox*>(&fd2, "fileTypeCombo");
+ //We compare the current combobox text with the non stripped version
+ QCOMPARE(filters2->currentText(), chosenFilterString);
+
+}
+
QTEST_MAIN(tst_QFiledialog)
#include "tst_qfiledialog2.moc"
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 1445f5b..5ea7100 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -1074,8 +1074,8 @@ void tst_QFileInfo::isHidden_data()
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
QTest::newRow("C:/RECYCLER") << QString::fromLatin1("C:/RECYCLER") << true;
- QTest::newRow("C:/RECYCLER/.") << QString::fromLatin1("C:/RECYCLER/.") << false;
- QTest::newRow("C:/RECYCLER/..") << QString::fromLatin1("C:/RECYCLER/..") << false;
+ QTest::newRow("C:/RECYCLER/.") << QString::fromLatin1("C:/RECYCLER/.") << true;
+ QTest::newRow("C:/RECYCLER/..") << QString::fromLatin1("C:/RECYCLER/..") << true;
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
@@ -1083,13 +1083,9 @@ void tst_QFileInfo::isHidden_data()
&& !QDir().mkdir("./.hidden-directory"))
qWarning("Unable to create directory './.hidden-directory'. Some tests will fail.");
- QTest::newRow("./.hidden-directory") << QString("./.hidden-directory") << true;
- QTest::newRow("./.hidden-directory/.") << QString("./.hidden-directory/.") << false;
- QTest::newRow("./.hidden-directory/..") << QString("./.hidden-directory/..") << false;
-
QTest::newRow("/path/to/.hidden-directory") << QDir::currentPath() + QString("/.hidden-directory") << true;
- QTest::newRow("/path/to/.hidden-directory/.") << QDir::currentPath() + QString("/.hidden-directory/.") << false;
- QTest::newRow("/path/to/.hidden-directory/..") << QDir::currentPath() + QString("/.hidden-directory/..") << false;
+ QTest::newRow("/path/to/.hidden-directory/.") << QDir::currentPath() + QString("/.hidden-directory/.") << true;
+ QTest::newRow("/path/to/.hidden-directory/..") << QDir::currentPath() + QString("/.hidden-directory/..") << true;
#endif
#if defined(Q_OS_MAC)
diff --git a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
index 657be06..73dfe076 100644
--- a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
+++ b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
@@ -123,9 +123,11 @@ void tst_QFontComboBox::currentFont_data()
QTest::addColumn<QFont>("currentFont");
// Normalize the names
QFont defaultFont;
+ QFontInfo fi(defaultFont);
+ defaultFont = QFont(fi.family()); // make sure we have a real font name and not something like 'Sans Serif'.
QTest::newRow("default") << defaultFont;
defaultFont.setPointSize(defaultFont.pointSize() + 10);
- QTest::newRow("default") << defaultFont;
+ QTest::newRow("default2") << defaultFont;
QFontDatabase db;
QStringList list = db.families();
for (int i = 0; i < list.count(); ++i) {
diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp
index 27c2e13..9c1670d 100644
--- a/tests/auto/qftp/tst_qftp.cpp
+++ b/tests/auto/qftp/tst_qftp.cpp
@@ -51,9 +51,6 @@
#include <stdlib.h>
#include <QNetworkProxy>
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
#include "../network-settings.h"
//TESTED_CLASS=
@@ -202,11 +199,9 @@ void tst_QFtp::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
//### doesn't work well yet.
//QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy);
-#endif
}
void tst_QFtp::initTestCase()
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index 5dc072d..a61eb8d 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -75,6 +75,7 @@ private slots:
void graphicsViewClipping();
void partialGLWidgetUpdates_data();
void partialGLWidgetUpdates();
+ void glWidgetWithAlpha();
void glWidgetRendering();
void glFBOSimpleRendering();
void glFBORendering();
@@ -251,15 +252,10 @@ void tst_QGL::getSetCheck()
// bool QGLFormat::sampleBuffers()
// void QGLFormat::setSampleBuffers(bool)
-#if !defined(QT_OPENGL_ES_2)
QCOMPARE(false, obj1.sampleBuffers());
QVERIFY(!obj1.testOption(QGL::SampleBuffers));
QVERIFY(obj1.testOption(QGL::NoSampleBuffers));
-#else
- QCOMPARE(true, obj1.sampleBuffers());
- QVERIFY(obj1.testOption(QGL::SampleBuffers));
- QVERIFY(!obj1.testOption(QGL::NoSampleBuffers));
-#endif
+
obj1.setSampleBuffers(false);
QCOMPARE(false, obj1.sampleBuffers());
QVERIFY(obj1.testOption(QGL::NoSampleBuffers));
@@ -927,6 +923,17 @@ void tst_QGL::glPBufferRendering()
QFUZZY_COMPARE_IMAGES(fb, reference);
}
+void tst_QGL::glWidgetWithAlpha()
+{
+ QGLWidget* w = new QGLWidget(QGLFormat(QGL::AlphaChannel));
+ w->show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(w);
+#endif
+
+ delete w;
+}
+
class GLWidget : public QGLWidget
{
public:
@@ -1817,17 +1824,12 @@ Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_shared_test, (qt_shared_test_fr
void tst_QGL::shareRegister()
{
#ifdef QT_BUILD_INTERNAL
- QGLShareRegister *shareReg = qgl_share_reg();
- QVERIFY(shareReg != 0);
-
// Create a context.
QGLWidget *glw1 = new QGLWidget();
glw1->makeCurrent();
// Nothing should be sharing with glw1's context yet.
- QList<const QGLContext *> list;
- list = shareReg->shares(glw1->context());
- QCOMPARE(list.size(), 0);
+ QVERIFY(!glw1->isSharing());
// Create a guard for the first context.
QGLSharedResourceGuard guard(glw1->context());
@@ -1860,16 +1862,6 @@ void tst_QGL::shareRegister()
QVERIFY(guard.context() == glw1->context());
QVERIFY(guard.id() == 3);
- // Now there are two items in the share lists.
- list = shareReg->shares(glw1->context());
- QCOMPARE(list.size(), 2);
- QVERIFY(list.contains(glw1->context()));
- QVERIFY(list.contains(glw2->context()));
- list = shareReg->shares(glw2->context());
- QCOMPARE(list.size(), 2);
- QVERIFY(list.contains(glw1->context()));
- QVERIFY(list.contains(glw2->context()));
-
// Check the sharing relationships.
QVERIFY(QGLContext::areSharing(glw1->context(), glw1->context()));
QVERIFY(QGLContext::areSharing(glw2->context(), glw2->context()));
@@ -1895,18 +1887,6 @@ void tst_QGL::shareRegister()
QVERIFY(qt_shared_test()->value(glw2->context()) == res1);
QVERIFY(qt_shared_test()->value(glw3->context()) == res3);
- // First two should still be sharing, but third is in its own list.
- list = shareReg->shares(glw1->context());
- QCOMPARE(list.size(), 2);
- QVERIFY(list.contains(glw1->context()));
- QVERIFY(list.contains(glw2->context()));
- list = shareReg->shares(glw2->context());
- QCOMPARE(list.size(), 2);
- QVERIFY(list.contains(glw1->context()));
- QVERIFY(list.contains(glw2->context()));
- list = shareReg->shares(glw3->context());
- QCOMPARE(list.size(), 0);
-
// Check the sharing relationships again.
QVERIFY(QGLContext::areSharing(glw1->context(), glw1->context()));
QVERIFY(QGLContext::areSharing(glw2->context(), glw2->context()));
@@ -1944,10 +1924,6 @@ void tst_QGL::shareRegister()
QVERIFY(guard3.context() == glw3->context());
QVERIFY(guard3.id() == 5);
- // Re-check the share list for the second context (should be empty now).
- list = shareReg->shares(glw2->context());
- QCOMPARE(list.size(), 0);
-
// Clean up and check that the resources are properly deleted.
delete glw2;
QCOMPARE(tst_QGLResource::deletions, 1);
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 6e78522..1cb9f0d 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -90,6 +90,7 @@ private slots:
void parallelToHalfLayout();
void globalSpacing();
void graphicsAnchorHandling();
+ void invalidHierarchyCheck();
};
class RectWidget : public QGraphicsWidget
@@ -2058,5 +2059,24 @@ void tst_QGraphicsAnchorLayout::graphicsAnchorHandling()
delete a;
}
+void tst_QGraphicsAnchorLayout::invalidHierarchyCheck()
+{
+ QGraphicsWidget window(0, Qt::Window);
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
+ window.setLayout(l);
+
+ QCOMPARE(l->count(), 0);
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): "
+ "You cannot add the parent of the layout to the layout.");
+ QVERIFY(!l->addAnchor(l, Qt::AnchorLeft, &window, Qt::AnchorLeft));
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): "
+ "You cannot add the parent of the layout to the layout.");
+ l->addAnchors(l, &window);
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): "
+ "You cannot add the parent of the layout to the layout.");
+ l->addCornerAnchors(l, Qt::TopLeftCorner, &window, Qt::TopLeftCorner);
+ QCOMPARE(l->count(), 0);
+}
+
QTEST_MAIN(tst_QGraphicsAnchorLayout)
#include "tst_qgraphicsanchorlayout.moc"
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
index 259df4d..69fc118 100644
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -69,6 +69,7 @@ private slots:
void opacity();
void grayscale();
void colorize();
+ void drawPixmapItem();
};
void tst_QGraphicsEffect::initTestCase()
@@ -465,6 +466,54 @@ void tst_QGraphicsEffect::colorize()
QCOMPARE(image.pixel(10, 10), qRgb(122, 193, 66));
}
+class PixmapItemEffect : public QGraphicsEffect
+{
+public:
+ PixmapItemEffect(const QPixmap &source)
+ : QGraphicsEffect()
+ , pixmap(source)
+ , repaints(0)
+ {}
+
+ QRectF boundingRectFor(const QRectF &rect) const
+ { return rect; }
+
+ void draw(QPainter *painter)
+ {
+ QVERIFY(sourcePixmap(Qt::LogicalCoordinates).pixmapData() == pixmap.pixmapData());
+ QVERIFY((painter->worldTransform().type() <= QTransform::TxTranslate) == (sourcePixmap(Qt::DeviceCoordinates).pixmapData() == pixmap.pixmapData()));
+
+ ++repaints;
+ }
+ QPixmap pixmap;
+ int repaints;
+};
+
+void tst_QGraphicsEffect::drawPixmapItem()
+{
+ QImage image(32, 32, QImage::Format_RGB32);
+ QPainter p(&image);
+ p.fillRect(0, 0, 32, 16, Qt::blue);
+ p.fillRect(0, 16, 32, 16, Qt::red);
+ p.end();
+
+ QGraphicsScene scene;
+ QGraphicsPixmapItem *item = new QGraphicsPixmapItem(QPixmap::fromImage(image));
+ scene.addItem(item);
+
+ PixmapItemEffect *effect = new PixmapItemEffect(item->pixmap());
+ item->setGraphicsEffect(effect);
+
+ QGraphicsView view(&scene);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ item->rotate(180);
+ QTest::qWait(50);
+
+ QTRY_VERIFY(effect->repaints >= 2);
+}
+
QTEST_MAIN(tst_QGraphicsEffect)
#include "tst_qgraphicseffect.moc"
diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index 9991ab4..7a0d40a 100644
--- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
@@ -352,7 +352,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data()
QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates)
<< int(QGraphicsEffect::PadToEffectiveBoundingRect)
- << QSize(30, 30) << QPoint(-10, -10)
+ << QSize(20, 20) << QPoint(-5, -5)
<< 0x00000000u;
QTest::newRow("dev,nopad") << int(Qt::DeviceCoordinates)
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index cd1eedd..3d95f92 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -108,6 +108,157 @@ private slots:
void task236367_maxSizeHint();
};
+class RectWidget : public QGraphicsWidget
+{
+public:
+ RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){}
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+ {
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ painter->drawRoundRect(rect());
+ painter->drawLine(rect().topLeft(), rect().bottomRight());
+ painter->drawLine(rect().bottomLeft(), rect().topRight());
+ }
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
+ {
+ if (m_sizeHints[which].isValid()) {
+ return m_sizeHints[which];
+ }
+ return QGraphicsWidget::sizeHint(which, constraint);
+ }
+
+ void setSizeHint(Qt::SizeHint which, const QSizeF &size) {
+ m_sizeHints[which] = size;
+ updateGeometry();
+ }
+
+ QSizeF m_sizeHints[Qt::NSizeHints];
+};
+
+struct ItemDesc
+{
+ ItemDesc(int row, int col)
+ : m_pos(qMakePair(row, col)),
+ m_rowSpan(1),
+ m_colSpan(1),
+ m_sizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)),
+ m_align(0)
+ {
+ }
+
+ ItemDesc &rowSpan(int span) {
+ m_rowSpan = span;
+ return (*this);
+ }
+
+ ItemDesc &colSpan(int span) {
+ m_colSpan = span;
+ return (*this);
+ }
+
+ ItemDesc &sizePolicy(const QSizePolicy &sp) {
+ m_sizePolicy = sp;
+ return (*this);
+ }
+
+ ItemDesc &sizePolicy(QSizePolicy::Policy horAndVer) {
+ m_sizePolicy = QSizePolicy(horAndVer, horAndVer);
+ return (*this);
+ }
+
+ ItemDesc &sizePolicyH(QSizePolicy::Policy hor) {
+ m_sizePolicy.setHorizontalPolicy(hor);
+ return (*this);
+ }
+
+ ItemDesc &sizePolicyV(QSizePolicy::Policy ver) {
+ m_sizePolicy.setVerticalPolicy(ver);
+ return (*this);
+ }
+
+ ItemDesc &sizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver) {
+ m_sizePolicy = QSizePolicy(hor, ver);
+ return (*this);
+ }
+
+ ItemDesc &sizeHint(Qt::SizeHint which, const QSizeF &sh) {
+ m_sizeHints[which] = sh;
+ return (*this);
+ }
+
+ ItemDesc &preferredSizeHint(const QSizeF &sh) {
+ m_sizeHints[Qt::PreferredSize] = sh;
+ return (*this);
+ }
+
+ ItemDesc &minSize(const QSizeF &sz) {
+ m_sizes[Qt::MinimumSize] = sz;
+ return (*this);
+ }
+ ItemDesc &preferredSize(const QSizeF &sz) {
+ m_sizes[Qt::PreferredSize] = sz;
+ return (*this);
+ }
+ ItemDesc &maxSize(const QSizeF &sz) {
+ m_sizes[Qt::MaximumSize] = sz;
+ return (*this);
+ }
+
+ ItemDesc &alignment(Qt::Alignment alignment) {
+ m_align = alignment;
+ return (*this);
+ }
+
+ void apply(QGraphicsGridLayout *layout, QGraphicsWidget *item) {
+ item->setSizePolicy(m_sizePolicy);
+ for (int i = 0; i < Qt::NSizeHints; ++i) {
+ if (!m_sizes[i].isValid())
+ continue;
+ switch ((Qt::SizeHint)i) {
+ case Qt::MinimumSize:
+ item->setMinimumSize(m_sizes[i]);
+ break;
+ case Qt::PreferredSize:
+ item->setPreferredSize(m_sizes[i]);
+ break;
+ case Qt::MaximumSize:
+ item->setMaximumSize(m_sizes[i]);
+ break;
+ default:
+ qWarning("not implemented");
+ break;
+ }
+ }
+ layout->addItem(item, m_pos.first, m_pos.second, m_rowSpan, m_colSpan);
+ layout->setAlignment(item, m_align);
+ }
+
+ void apply(QGraphicsGridLayout *layout, RectWidget *item) {
+ for (int i = 0; i < Qt::NSizeHints; ++i)
+ item->setSizeHint((Qt::SizeHint)i, m_sizeHints[i]);
+ apply(layout, static_cast<QGraphicsWidget*>(item));
+ }
+
+//private:
+ QPair<int,int> m_pos; // row,col
+ int m_rowSpan;
+ int m_colSpan;
+ QSizePolicy m_sizePolicy;
+ QSizeF m_sizeHints[Qt::NSizeHints];
+ QSizeF m_sizes[Qt::NSizeHints];
+ Qt::Alignment m_align;
+};
+
+typedef QList<ItemDesc> ItemList;
+Q_DECLARE_METATYPE(ItemList);
+
+typedef QList<QSizeF> SizeList;
+Q_DECLARE_METATYPE(SizeList);
+
+
// This will be called before the first test function is executed.
// It is only called once.
void tst_QGraphicsGridLayout::initTestCase()
@@ -190,36 +341,6 @@ void tst_QGraphicsGridLayout::qgraphicsgridlayout()
layout.verticalSpacing();
}
-class RectWidget : public QGraphicsWidget
-{
-public:
- RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){}
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
- {
- Q_UNUSED(option);
- Q_UNUSED(widget);
- painter->drawRoundRect(rect());
- painter->drawLine(rect().topLeft(), rect().bottomRight());
- painter->drawLine(rect().bottomLeft(), rect().topRight());
- }
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
- {
- if (m_sizeHints[which].isValid()) {
- return m_sizeHints[which];
- }
- return QGraphicsWidget::sizeHint(which, constraint);
- }
-
- void setSizeHint(Qt::SizeHint which, const QSizeF &size) {
- m_sizeHints[which] = size;
- updateGeometry();
- }
-
- QSizeF m_sizeHints[Qt::NSizeHints];
-};
-
static void populateLayout(QGraphicsGridLayout *gridLayout, int width, int height)
{
for (int y = 0; y < height; ++y) {
@@ -1144,7 +1265,7 @@ void tst_QGraphicsGridLayout::setColumnSpacing()
}
void tst_QGraphicsGridLayout::setGeometry_data()
-{
+{
QTest::addColumn<QRectF>("rect");
QTest::newRow("null") << QRectF();
QTest::newRow("normal") << QRectF(0,0, 50, 50);
@@ -1233,28 +1354,84 @@ void tst_QGraphicsGridLayout::setSpacing()
void tst_QGraphicsGridLayout::sizeHint_data()
{
+ QTest::addColumn<ItemList>("itemDescriptions");
+ QTest::addColumn<QSizeF>("expectedMinimumSizeHint");
+ QTest::addColumn<QSizeF>("expectedPreferredSizeHint");
+ QTest::addColumn<QSizeF>("expectedMaximumSizeHint");
+
+ QTest::newRow("rowSpan_larger_than_rows") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(50,300))
+ .maxSize(QSizeF(50,300))
+ .rowSpan(2)
+ << ItemDesc(0,1)
+ .minSize(QSizeF(50,0))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSize(50, 1000))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(50,0))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSize(50, 1000))
+ )
+ << QSizeF(100, 300)
+ << QSizeF(100, 300)
+ << QSizeF(100, 2000);
+
+ QTest::newRow("rowSpan_smaller_than_rows") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(50, 0))
+ .preferredSize(QSizeF(50, 50))
+ .maxSize(QSizeF(50, 300))
+ .rowSpan(2)
+ << ItemDesc(0,1)
+ .minSize(QSizeF(50, 50))
+ .preferredSize(QSizeF(50, 50))
+ .maxSize(QSize(50, 50))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(50, 50))
+ .preferredSize(QSizeF(50, 50))
+ .maxSize(QSize(50, 50))
+ )
+ << QSizeF(100, 100)
+ << QSizeF(100, 100)
+ << QSizeF(100, 100);
- /*
- QTest::addColumn<Qt::SizeHint>("which");
- QTest::addColumn<QSizeF>("constraint");
- QTest::addColumn<QSizeF>("sizeHint");
- QTest::newRow("null") << 0;
- */
}
// public QSizeF sizeHint(Qt::SizeHint which, QSizeF const& constraint = QSizeF()) const
void tst_QGraphicsGridLayout::sizeHint()
{
- /*
- QFETCH(Qt::SizeHint, which);
- QFETCH(QSizeF, constraint);
- QFETCH(QSizeF, sizeHint);
+ QFETCH(ItemList, itemDescriptions);
+ QFETCH(QSizeF, expectedMinimumSizeHint);
+ QFETCH(QSizeF, expectedPreferredSizeHint);
+ QFETCH(QSizeF, expectedMaximumSizeHint);
- QGraphicsGridLayout layout;
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout;
+ scene.addItem(widget);
+ widget->setLayout(layout);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0.0);
+ widget->setContentsMargins(0, 0, 0, 0);
+
+ int i;
+ for (i = 0; i < itemDescriptions.count(); ++i) {
+ ItemDesc desc = itemDescriptions.at(i);
+ RectWidget *item = new RectWidget(widget);
+ desc.apply(layout, item);
+ }
+
+ QApplication::sendPostedEvents(0, 0);
+
+ widget->show();
+ view.show();
+ view.resize(400,300);
+ QCOMPARE(layout->sizeHint(Qt::MinimumSize), expectedMinimumSizeHint);
+ QCOMPARE(layout->sizeHint(Qt::PreferredSize), expectedPreferredSizeHint);
+ QCOMPARE(layout->sizeHint(Qt::MaximumSize), expectedMaximumSizeHint);
- layout.sizeHint();
- */
- QSKIP("Test unimplemented", SkipSingle);
}
void tst_QGraphicsGridLayout::verticalSpacing_data()
@@ -1373,121 +1550,6 @@ void tst_QGraphicsGridLayout::removeLayout()
QCOMPARE(pushButton->geometry(), r2);
}
-struct ItemDesc
-{
- ItemDesc(int row, int col)
- : m_pos(qMakePair(row, col)),
- m_rowSpan(1),
- m_colSpan(1),
- m_sizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)),
- m_align(0)
- {
- }
-
- ItemDesc &rowSpan(int span) {
- m_rowSpan = span;
- return (*this);
- }
-
- ItemDesc &colSpan(int span) {
- m_colSpan = span;
- return (*this);
- }
-
- ItemDesc &sizePolicy(const QSizePolicy &sp) {
- m_sizePolicy = sp;
- return (*this);
- }
-
- ItemDesc &sizePolicy(QSizePolicy::Policy horAndVer) {
- m_sizePolicy = QSizePolicy(horAndVer, horAndVer);
- return (*this);
- }
-
- ItemDesc &sizePolicyH(QSizePolicy::Policy hor) {
- m_sizePolicy.setHorizontalPolicy(hor);
- return (*this);
- }
-
- ItemDesc &sizePolicyV(QSizePolicy::Policy ver) {
- m_sizePolicy.setVerticalPolicy(ver);
- return (*this);
- }
-
- ItemDesc &sizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver) {
- m_sizePolicy = QSizePolicy(hor, ver);
- return (*this);
- }
-
- ItemDesc &sizeHint(Qt::SizeHint which, const QSizeF &sh) {
- m_sizeHints[which] = sh;
- return (*this);
- }
-
- ItemDesc &preferredSizeHint(const QSizeF &sh) {
- m_sizeHints[Qt::PreferredSize] = sh;
- return (*this);
- }
-
- ItemDesc &minSize(const QSizeF &sz) {
- m_sizes[Qt::MinimumSize] = sz;
- return (*this);
- }
- ItemDesc &preferredSize(const QSizeF &sz) {
- m_sizes[Qt::PreferredSize] = sz;
- return (*this);
- }
- ItemDesc &maxSize(const QSizeF &sz) {
- m_sizes[Qt::MaximumSize] = sz;
- return (*this);
- }
-
- ItemDesc &alignment(Qt::Alignment alignment) {
- m_align = alignment;
- return (*this);
- }
-
- void apply(QGraphicsGridLayout *layout, RectWidget *item) {
- item->setSizePolicy(m_sizePolicy);
- for (int i = 0; i < Qt::NSizeHints; ++i) {
- item->setSizeHint((Qt::SizeHint)i, m_sizeHints[i]);
- if (!m_sizes[i].isValid())
- continue;
- switch ((Qt::SizeHint)i) {
- case Qt::MinimumSize:
- item->setMinimumSize(m_sizes[i]);
- break;
- case Qt::PreferredSize:
- item->setPreferredSize(m_sizes[i]);
- break;
- case Qt::MaximumSize:
- item->setMaximumSize(m_sizes[i]);
- break;
- default:
- qWarning("not implemented");
- break;
- }
- }
- layout->addItem(item, m_pos.first, m_pos.second, m_rowSpan, m_colSpan);
- layout->setAlignment(item, m_align);
- }
-
-//private:
- QPair<int,int> m_pos; // row,col
- int m_rowSpan;
- int m_colSpan;
- QSizePolicy m_sizePolicy;
- QSizeF m_sizeHints[Qt::NSizeHints];
- QSizeF m_sizes[Qt::NSizeHints];
- Qt::Alignment m_align;
-};
-
-typedef QList<ItemDesc> ItemList;
-Q_DECLARE_METATYPE(ItemList);
-
-typedef QList<QSizeF> SizeList;
-Q_DECLARE_METATYPE(SizeList);
-
void tst_QGraphicsGridLayout::defaultStretchFactors_data()
{
QTest::addColumn<ItemList>("itemDescriptions");
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 6266933..03a587a 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -233,6 +233,7 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
hints = painter->renderHints();
+ painter->setBrush(brush);
painter->drawRect(boundingRect());
++repaints;
}
@@ -247,6 +248,7 @@ public:
QPainter::RenderHints hints;
int repaints;
QRectF br;
+ QBrush brush;
};
class tst_QGraphicsItem : public QObject
@@ -316,6 +318,7 @@ private slots:
void childrenBoundingRect3();
void group();
void setGroup();
+ void setGroup2();
void nestedGroups();
void warpChildrenIntoGroup();
void removeFromGroup();
@@ -1351,6 +1354,7 @@ void tst_QGraphicsItem::selected()
view.setFixedSize(250, 250);
view.show();
+ QTest::qWaitForWindowShown(&view);
qApp->processEvents();
qApp->processEvents();
@@ -3343,6 +3347,35 @@ void tst_QGraphicsItem::setGroup()
QCOMPARE(rect->parentItem(), (QGraphicsItem *)0);
}
+void tst_QGraphicsItem::setGroup2()
+{
+ QGraphicsScene scene;
+ QGraphicsItemGroup group;
+ scene.addItem(&group);
+
+ QGraphicsRectItem *rect = scene.addRect(50,50,50,50,Qt::NoPen,Qt::black);
+ rect->setTransformOriginPoint(50,50);
+ rect->setRotation(45);
+ rect->setScale(1.5);
+ rect->translate(20,20);
+ group.translate(-30,-40);
+ group.setRotation(180);
+ group.setScale(0.5);
+
+ QTransform oldSceneTransform = rect->sceneTransform();
+ rect->setGroup(&group);
+ QCOMPARE(rect->sceneTransform(), oldSceneTransform);
+
+ group.setRotation(20);
+ group.setScale(2);
+ rect->setRotation(90);
+ rect->setScale(0.8);
+
+ oldSceneTransform = rect->sceneTransform();
+ rect->setGroup(0);
+ QCOMPARE(rect->sceneTransform(), oldSceneTransform);
+}
+
void tst_QGraphicsItem::nestedGroups()
{
QGraphicsItemGroup *group1 = new QGraphicsItemGroup;
@@ -7646,17 +7679,20 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
EventTester *item1 = new EventTester;
item1->br = itemBoundingRect;
item1->setPos(-200, -200);
+ item1->brush = Qt::red;
EventTester *item2 = new EventTester;
item2->br = itemBoundingRect;
item2->setFlag(QGraphicsItem::ItemIgnoresTransformations);
item2->setParentItem(item1);
item2->setPos(200, 200);
+ item2->brush = Qt::green;
EventTester *item3 = new EventTester;
item3->br = itemBoundingRect;
item3->setParentItem(item2);
item3->setPos(80, 80);
+ item3->brush = Qt::blue;
scene.addItem(item1);
QTest::qWait(100);
@@ -7671,8 +7707,8 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
item1->setGraphicsEffect(shadow);
QTest::qWait(50);
- // Make sure all items are repainted.
- QCOMPARE(item1->repaints, 1);
+ // Make sure all visible items are repainted.
+ QCOMPARE(item1->repaints, 0);
QCOMPARE(item2->repaints, 1);
QCOMPARE(item3->repaints, 1);
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 797e1fb..9e4321b 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -211,6 +211,7 @@ private slots:
void centerOnDirtyItem();
void mouseTracking();
void mouseTracking2();
+ void mouseTracking3();
void render();
void exposeRegion();
void update_data();
@@ -3403,6 +3404,102 @@ void tst_QGraphicsView::mouseTracking2()
QCOMPARE(spy.count(), 1);
}
+void tst_QGraphicsView::mouseTracking3()
+{
+ // Mouse tracking should be automatically enabled if AnchorUnderMouse is used for
+ // view transform or resize. We never disable mouse tracking if it is already enabled.
+
+ { // Make sure we enable mouse tracking when using AnchorUnderMouse for view transformation.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsView view(&scene);
+ QVERIFY(!view.viewport()->hasMouseTracking());
+
+ view.setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+
+ { // Make sure we enable mouse tracking when using AnchorUnderMouse for view resizing.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsView view(&scene);
+ QVERIFY(!view.viewport()->hasMouseTracking());
+
+ view.setResizeAnchor(QGraphicsView::AnchorUnderMouse);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+
+ { // Make sure we don't disable mouse tracking in setViewport/setScene (transformation anchor).
+ QGraphicsView view;
+ view.setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+ QVERIFY(view.viewport()->hasMouseTracking());
+
+ QWidget *viewport = new QWidget;
+ view.setViewport(viewport);
+ QVERIFY(viewport->hasMouseTracking());
+
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ view.setScene(&scene);
+ QVERIFY(viewport->hasMouseTracking());
+ }
+
+ { // Make sure we don't disable mouse tracking in setViewport/setScene (resize anchor).
+ QGraphicsView view;
+ view.setResizeAnchor(QGraphicsView::AnchorUnderMouse);
+ QVERIFY(view.viewport()->hasMouseTracking());
+
+ QWidget *viewport = new QWidget;
+ view.setViewport(viewport);
+ QVERIFY(viewport->hasMouseTracking());
+
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ view.setScene(&scene);
+ QVERIFY(viewport->hasMouseTracking());
+ }
+
+ // Make sure we don't disable mouse tracking when adding an item (transformation anchor).
+ { // Adding an item to the scene before the scene is set on the view.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
+ scene.addItem(item);
+
+ QGraphicsView view;
+ view.setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+ view.setScene(&scene);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+
+ { // Adding an item to the scene after the scene is set on the view.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsView view(&scene);
+ view.setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+
+ QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
+ scene.addItem(item);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+
+ // Make sure we don't disable mouse tracking when adding an item (resize anchor).
+ { // Adding an item to the scene before the scene is set on the view.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
+ scene.addItem(item);
+
+ QGraphicsView view;
+ view.setResizeAnchor(QGraphicsView::AnchorUnderMouse);
+ view.setScene(&scene);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+
+ { // Adding an item to the scene after the scene is set on the view.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsView view(&scene);
+ view.setResizeAnchor(QGraphicsView::AnchorUnderMouse);
+
+ QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
+ scene.addItem(item);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+}
+
class RenderTester : public QGraphicsRectItem
{
public:
@@ -3601,7 +3698,7 @@ void tst_QGraphicsView::inputMethodSensitivity()
item->setFlag(QGraphicsItem::ItemIsFocusable);
scene.addItem(item);
scene.setFocusItem(item);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
item->setFlag(QGraphicsItem::ItemAcceptsInputMethod, false);
@@ -3616,35 +3713,35 @@ void tst_QGraphicsView::inputMethodSensitivity()
scene.addItem(item2);
scene.setFocusItem(item2);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item2);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2));
scene.setFocusItem(item);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
view.setScene(0);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
view.setScene(&scene);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
scene.setFocusItem(item2);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item2);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2));
view.setScene(0);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item2);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2));
scene.setFocusItem(item);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
view.setScene(&scene);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
}
class InputContextTester : public QInputContext
@@ -3878,7 +3975,7 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect()
{ lastBackgroundExposedRect = rect; }
QRectF lastBackgroundExposedRect;
};
-
+
class CustomRectItem : public QGraphicsRectItem
{
public:
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 3303df5..a835259 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -168,6 +168,7 @@ private slots:
void task236127_bspTreeIndexFails();
void task243004_setStyleCrash();
void task250119_shortcutContext();
+ void QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems();
};
@@ -2855,6 +2856,37 @@ void tst_QGraphicsWidget::polishEvent2()
QVERIFY(widget->events.contains(QEvent::Polish));
}
+void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems()
+{
+ QGraphicsScene scene;
+ QGraphicsWidget* parent1 = new QGraphicsWidget;
+ QGraphicsWidget* child1_0 = new QGraphicsWidget;
+ QGraphicsWidget* child1_1 = new QGraphicsWidget;
+
+ QGraphicsWidget* parent2 = new QGraphicsWidget;
+
+ // Add the parent and child to the scene.
+ scene.addItem(parent1);
+ child1_0->setParentItem(parent1);
+ child1_1->setParentItem(parent1);
+
+ // Hide and show the child.
+ child1_0->setParentItem(NULL);
+ scene.removeItem(child1_0);
+
+ // Remove parent from the scene.
+ scene.removeItem(parent1);
+
+ delete child1_0;
+ delete child1_1;
+ delete parent1;
+
+ // Add an item into the scene.
+ scene.addItem(parent2);
+
+ //This should not crash
+}
+
QTEST_MAIN(tst_QGraphicsWidget)
#include "tst_qgraphicswidget.moc"
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index 4d63e10..348c41b 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -88,6 +88,7 @@
#endif
#include "../network-settings.h"
+#include "../../shared/util.h"
//TESTED_CLASS=
//TESTED_FILES=
@@ -124,6 +125,9 @@ private slots:
void raceCondition();
void threadSafety();
+ void multipleSameLookups();
+ void multipleDifferentLookups();
+
protected slots:
void resultsReady(const QHostInfo &);
@@ -131,6 +135,7 @@ private:
bool ipv6LookupsAvailable;
bool ipv6Available;
bool lookupDone;
+ int lookupsDoneCounter;
QHostInfo lookupResults;
};
@@ -411,11 +416,53 @@ void tst_QHostInfo::threadSafety()
}
}
+// this test is for the multi-threaded QHostInfo rewrite. It is about getting results at all,
+// not about getting correct IPs
+void tst_QHostInfo::multipleSameLookups()
+{
+ const int COUNT = 10;
+ lookupsDoneCounter = 0;
+
+ for (int i = 0; i < COUNT; i++)
+ QHostInfo::lookupHost("localhost", this, SLOT(resultsReady(const QHostInfo)));
+
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+
+ // spin two seconds more to see if it is not more :)
+ QTestEventLoop::instance().enterLoop(2);
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+}
+
+// this test is for the multi-threaded QHostInfo rewrite. It is about getting results at all,
+// not about getting correct IPs
+void tst_QHostInfo::multipleDifferentLookups()
+{
+ QStringList hostnameList;
+ hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no"
+ << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com"
+ << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----";
+
+ const int COUNT = hostnameList.size();
+ lookupsDoneCounter = 0;
+
+ for (int i = 0; i < hostnameList.size(); i++)
+ QHostInfo::lookupHost(hostnameList.at(i), this, SLOT(resultsReady(const QHostInfo)));
+
+ // give some time
+ QTestEventLoop::instance().enterLoop(5);
+ // try_verify gives some more time
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+
+ // spin two seconds more to see if it is not more than expected
+ QTestEventLoop::instance().enterLoop(2);
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+}
+
void tst_QHostInfo::resultsReady(const QHostInfo &hi)
{
lookupDone = true;
lookupResults = hi;
-
+ lookupsDoneCounter++;
QTestEventLoop::instance().exitLoop();
}
diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/qhttp/tst_qhttp.cpp
index b4b6ceb..92ab3d8 100644
--- a/tests/auto/qhttp/tst_qhttp.cpp
+++ b/tests/auto/qhttp/tst_qhttp.cpp
@@ -57,9 +57,6 @@
# include <qsslsocket.h>
#endif
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
#include "../network-settings.h"
//TESTED_CLASS=
@@ -198,9 +195,7 @@ void tst_QHttp::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
-#endif
}
void tst_QHttp::initTestCase()
diff --git a/tests/auto/qimagereader/images/endless-anim.gif b/tests/auto/qimagereader/images/endless-anim.gif
new file mode 100644
index 0000000..00df8da
--- /dev/null
+++ b/tests/auto/qimagereader/images/endless-anim.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/four-frames.gif b/tests/auto/qimagereader/images/four-frames.gif
new file mode 100644
index 0000000..6aff2e0
--- /dev/null
+++ b/tests/auto/qimagereader/images/four-frames.gif
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index 11b9406..58f2f74 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -57,5 +57,7 @@
<file>images/qt6.gif</file>
<file>images/qt7.gif</file>
<file>images/qt8.gif</file>
+ <file>images/endless-anim.gif</file>
+ <file>images/four-frames.gif</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 15b1c1c..8cfaac5 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -141,6 +141,7 @@ private slots:
#if defined QTEST_HAVE_GIF
void gifHandlerBugs();
void animatedGif();
+ void gifImageCount();
#endif
void readCorruptImage_data();
@@ -322,7 +323,15 @@ void tst_QImageReader::setScaledSize_data()
QTest::newRow("PPM: test") << "test.ppm" << QSize(10, 10) << QByteArray("ppm");
QTest::newRow("XBM: gnus") << "gnus" << QSize(200, 200) << QByteArray("xbm");
#ifdef QTEST_HAVE_JPEG
- QTest::newRow("JPEG: beavis") << "beavis" << QSize(200, 200) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis A") << "beavis" << QSize(200, 200) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis B") << "beavis" << QSize(175, 175) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis C") << "beavis" << QSize(100, 100) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis D") << "beavis" << QSize(100, 200) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis E") << "beavis" << QSize(200, 100) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis F") << "beavis" << QSize(87, 87) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis G") << "beavis" << QSize(50, 45) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis H") << "beavis" << QSize(43, 43) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis I") << "beavis" << QSize(25, 25) << QByteArray("jpeg");
#endif // QTEST_HAVE_JPEG
#ifdef QTEST_HAVE_GIF
QTest::newRow("GIF: earth") << "earth" << QSize(200, 200) << QByteArray("gif");
@@ -717,6 +726,13 @@ void tst_QImageReader::gifHandlerBugs()
QVERIFY(!im1.isNull()); QVERIFY(!im2.isNull());
QCOMPARE(im1.convertToFormat(QImage::Format_ARGB32), im2.convertToFormat(QImage::Format_ARGB32));
}
+
+ // Check the undocumented feature.
+ {
+ QImageReader io(prefix + "endless-anim.gif");
+ QVERIFY(io.canRead());
+ QCOMPARE(io.loopCount(), -1);
+ }
}
void tst_QImageReader::animatedGif()
@@ -731,6 +747,136 @@ void tst_QImageReader::animatedGif()
image = io.read();
}
}
+
+// http://bugreports.qt.nokia.com/browse/QTBUG-6696
+// Check the count of images in various call orders...
+void tst_QImageReader::gifImageCount()
+{
+ // just read every frame... and see how much we got..
+ {
+ QImageReader io(":images/four-frames.gif");
+
+ QVERIFY(io.canRead());
+ QImage blackFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QImage whiteFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QImage greenFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QImage blueFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QImage emptyFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(blackFrame.pixel(0,0), qRgb(0, 0, 0));
+ QCOMPARE(blackFrame.size(), QSize(64,64));
+
+ QCOMPARE(whiteFrame.pixel(0,0), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(whiteFrame.size(), QSize(64,64));
+
+ QCOMPARE(greenFrame.pixel(0,0), qRgb(0x0, 0xff, 0x0));
+ QCOMPARE(greenFrame.size(), QSize(64,64));
+
+ QCOMPARE(blueFrame.pixel(0,0), qRgb(0x0, 0x0, 0xff));
+ QCOMPARE(blueFrame.size(), QSize(64,64));
+ QVERIFY(emptyFrame.isNull());
+ }
+
+ // Read and get the size
+ {
+ QImageReader io(":images/four-frames.gif");
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage blackFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage whiteFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage greenFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage blueFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(io.size(), QSize());
+ QCOMPARE(io.size(), QSize());
+ QVERIFY(!io.canRead());
+ QImage emptyFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(blackFrame.pixel(0,0), qRgb(0, 0, 0));
+ QCOMPARE(blackFrame.size(), QSize(64,64));
+
+ QCOMPARE(whiteFrame.pixel(0,0), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(whiteFrame.size(), QSize(64,64));
+
+ QCOMPARE(greenFrame.pixel(0,0), qRgb(0x0, 0xff, 0x0));
+ QCOMPARE(greenFrame.size(), QSize(64,64));
+
+ QCOMPARE(blueFrame.pixel(0,0), qRgb(0x0, 0x0, 0xff));
+ QCOMPARE(blueFrame.size(), QSize(64,64));
+ QVERIFY(emptyFrame.isNull());
+ }
+
+ // Do a Size query as substitute for canRead
+ {
+ QImageReader io(":images/four-frames.gif");
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage blackFrame = io.read();
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage whiteFrame = io.read();
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage greenFrame = io.read();
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage blueFrame = io.read();
+
+ QCOMPARE(io.size(), QSize());
+ QVERIFY(!io.canRead());
+ QImage emptyFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(blackFrame.pixel(0,0), qRgb(0, 0, 0));
+ QCOMPARE(blackFrame.size(), QSize(64,64));
+
+ QCOMPARE(whiteFrame.pixel(0,0), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(whiteFrame.size(), QSize(64,64));
+
+ QCOMPARE(greenFrame.pixel(0,0), qRgb(0x0, 0xff, 0x0));
+ QCOMPARE(greenFrame.size(), QSize(64,64));
+
+ QCOMPARE(blueFrame.pixel(0,0), qRgb(0x0, 0x0, 0xff));
+ QCOMPARE(blueFrame.size(), QSize(64,64));
+ QVERIFY(emptyFrame.isNull());
+ }
+}
#endif
class Server : public QObject
diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp
index 863c308..e165190 100644
--- a/tests/auto/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp
@@ -862,12 +862,18 @@ void tst_QListWidget::moveItemsPriv_data()
QTest::newRow("Empty") << 0 << 0 << 0 << false;
QTest::newRow("Overflow src") << 5 << 5 << 2 << false;
QTest::newRow("Underflow src") << 5 << -1 << 2 << false;
- QTest::newRow("Overflow dst") << 5 << 2 << 5 << false;
+ QTest::newRow("Overflow dst") << 5 << 2 << 6 << false;
QTest::newRow("Underflow dst") << 5 << 2 << -1 << false;
QTest::newRow("Same place") << 5 << 2 << 2 << false;
QTest::newRow("Up") << 5 << 4 << 2 << true;
QTest::newRow("Down") << 5 << 2 << 4 << true;
QTest::newRow("QTBUG-6532 assert") << 5 << 0 << 1 << false;
+ QTest::newRow("QTBUG-6565 to the end") << 5 << 3 << 5 << true;
+ QTest::newRow("Same place 2") << 2 << 0 << 1 << false;
+ QTest::newRow("swap") << 2 << 0 << 2 << true;
+ QTest::newRow("swap2") << 4 << 1 << 3 << true;
+ QTest::newRow("swap3") << 4 << 3 << 2 << true;
+ QTest::newRow("swap4") << 2 << 1 << 0 << true;
}
void tst_QListWidget::moveItemsPriv()
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 67a9c46..75d7a0a 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -126,6 +126,7 @@ private slots:
void deleteQObjectWhenDeletingEvent();
void overloads();
void isSignalConnected();
+ void qMetaObjectConnect();
protected:
};
@@ -3058,10 +3059,8 @@ void tst_QObject::isSignalConnected()
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig05()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig15()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig29()")));
- if (sizeof(void *) >= 8) { //on 32bit isSignalConnected only works with the first 32 signals
- QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig60()")));
- QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()")));
- }
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig60()")));
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()")));
#endif
QObject::connect(&o, SIGNAL(sig00()), &o, SIGNAL(sig69()));
@@ -3115,6 +3114,8 @@ void tst_QObject::isSignalConnected()
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig04()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig21()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig25()")));
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig55()")));
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()")));
#endif
emit o.sig00();
@@ -3125,5 +3126,148 @@ void tst_QObject::isSignalConnected()
QCOMPARE(o.rec, 2);
}
+void tst_QObject::qMetaObjectConnect()
+{
+ SenderObject *s = new SenderObject;
+ ReceiverObject *r1 = new ReceiverObject;
+ ReceiverObject *r2 = new ReceiverObject;
+ r1->reset();
+ r2->reset();
+ ReceiverObject::sequence = 0;
+
+ int signal1Index = s->metaObject()->indexOfSignal("signal1()");
+ int signal3Index = s->metaObject()->indexOfSignal("signal3()");
+ int slot1Index = r1->metaObject()->indexOfSlot("slot1()");
+ int slot2Index = r1->metaObject()->indexOfSlot("slot2()");
+ int slot3Index = r1->metaObject()->indexOfSlot("slot3()");
+
+ QVERIFY(slot1Index > 0);
+ QVERIFY(slot2Index > 0);
+ QVERIFY(slot3Index > 0);
+
+ QVERIFY( QMetaObject::connect( s, signal1Index, r1, slot1Index) );
+ QVERIFY( QMetaObject::connect( s, signal3Index, r2, slot3Index) );
+ QVERIFY( QMetaObject::connect( s, -1, r2, slot2Index) );
+
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ s->emitSignal1();
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 1 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ s->emitSignal2();
+ s->emitSignal3();
+ s->emitSignal4();
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 4 );
+ QCOMPARE( r2->count_slot3, 1 );
+
+ QVERIFY( QMetaObject::disconnect( s, signal1Index, r1, slot1Index) );
+ QVERIFY( QMetaObject::disconnect( s, signal3Index, r2, slot3Index) );
+ QVERIFY( QMetaObject::disconnect( s, -1, r2, slot2Index) );
+
+ s->emitSignal1();
+ s->emitSignal2();
+ s->emitSignal3();
+ s->emitSignal4();
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 4 );
+ QCOMPARE( r2->count_slot3, 1 );
+
+ //some "dynamic" signal
+ QVERIFY( QMetaObject::connect( s, s->metaObject()->methodOffset() + 20, r1, slot3Index) );
+ QVERIFY( QMetaObject::connect( s, s->metaObject()->methodOffset() + 35, r2, slot1Index) );
+ QVERIFY( QMetaObject::connect( s, -1, r1, slot2Index) );
+
+ r1->reset();
+ r2->reset();
+
+ void *args[] = { 0 , 0 };
+ QMetaObject::activate(s, s->metaObject()->methodOffset() + 20, args);
+ QMetaObject::activate(s, s->metaObject()->methodOffset() + 48, args);
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 2 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ QMetaObject::activate(s, s->metaObject()->methodOffset() + 35, args);
+ s->emitSignal1();
+ s->emitSignal2();
+
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 5 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 1 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ delete s;
+ r1->reset();
+ r2->reset();
+
+#define SIGNAL_INDEX(S) obj1.metaObject()->indexOfSignal(QMetaObject::normalizedSignature(#S))
+ OverloadObject obj1;
+ QObject obj2, obj3;
+
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int)) , r1, slot1Index);
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *)) , r2, slot1Index);
+
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *, QObject *)) , r1, slot2Index);
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *)) , r2, slot2Index);
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int, int)) , r1, slot3Index);
+
+ emit obj1.sig(0.5); //connected to nothing
+ emit obj1.sig(1, 'a'); //connected to nothing
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ emit obj1.sig(1); //this signal is connected
+ emit obj1.sig(&obj2);
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 1 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ emit obj1.sig(&obj2, &obj3); //this signal is connected
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 1 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 1 );
+ QCOMPARE( r2->count_slot2, 1 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ delete r1;
+ delete r2;
+
+}
+
QTEST_MAIN(tst_QObject)
#include "tst_qobject.moc"
diff --git a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp
index 4d0a7a7..a421228 100644
--- a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp
+++ b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp
@@ -99,7 +99,7 @@ private slots:
void changeDirectionWhileRunning();
void noTimerUpdates_data();
void noTimerUpdates();
- void mulitplePauseAnimations();
+ void multiplePauseAnimations();
void pauseAndPropertyAnimations();
void pauseResume();
void sequentialPauseGroup();
@@ -169,7 +169,7 @@ void tst_QPauseAnimation::noTimerUpdates()
QCOMPARE(animation.m_updateCurrentTimeCount, 1 + loopCount);
}
-void tst_QPauseAnimation::mulitplePauseAnimations()
+void tst_QPauseAnimation::multiplePauseAnimations()
{
EnableConsistentTiming enabled;
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 0effd01..0164c9d 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -1289,6 +1289,12 @@ void tst_QPixmap::copy()
QPixmap expected(10, 10);
expected.fill(Qt::blue);
QVERIFY(lenientCompare(dest, expected));
+
+ QPixmap trans;
+ trans.fill(Qt::transparent);
+
+ QPixmap transCopy = trans.copy();
+ QVERIFY(pixmapsAreEqual(&trans, &transCopy));
}
#ifdef QT3_SUPPORT
diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
index 9775d36..c89a182 100644
--- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
@@ -70,6 +70,7 @@ private slots:
void remove();
void clear();
void pixmapKey();
+ void noLeak();
};
static QPixmapCache::KeyData* getPrivate(QPixmapCache::Key &key)
@@ -482,5 +483,23 @@ void tst_QPixmapCache::pixmapKey()
QVERIFY(!getPrivate(key8));
}
+extern int q_QPixmapCache_keyHashSize();
+
+void tst_QPixmapCache::noLeak()
+{
+ QPixmapCache::Key key;
+
+ int oldSize = q_QPixmapCache_keyHashSize();
+ for (int i = 0; i < 100; ++i) {
+ QPixmap pm(128, 128);
+ pm.fill(Qt::transparent);
+ key = QPixmapCache::insert(pm);
+ QPixmapCache::remove(key);
+ }
+ int newSize = q_QPixmapCache_keyHashSize();
+
+ QCOMPARE(oldSize, newSize);
+}
+
QTEST_MAIN(tst_QPixmapCache)
#include "tst_qpixmapcache.moc"
diff --git a/tests/auto/qresourceengine/tst_qresourceengine.cpp b/tests/auto/qresourceengine/tst_qresourceengine.cpp
index cc6eda3..ed7de23 100644
--- a/tests/auto/qresourceengine/tst_qresourceengine.cpp
+++ b/tests/auto/qresourceengine/tst_qresourceengine.cpp
@@ -62,6 +62,7 @@ private slots:
void searchPath_data();
void searchPath();
void doubleSlashInRoot();
+ void setLocale();
private:
QString builddir;
@@ -460,6 +461,27 @@ void tst_QResourceEngine::doubleSlashInRoot()
QVERIFY(QFile::exists("://secondary_root/runtime_resource/search_file.txt"));
}
+void tst_QResourceEngine::setLocale()
+{
+ QLocale::setDefault(QLocale::c());
+
+ // default constructed QResource gets the default locale
+ QResource resource;
+ resource.setFileName("aliasdir/aliasdir.txt");
+ QVERIFY(!resource.isCompressed());
+
+ // change the default locale and make sure it doesn't affect the resource
+ QLocale::setDefault(QLocale("de_CH"));
+ QVERIFY(!resource.isCompressed());
+
+ // then explicitly set the locale on qresource
+ resource.setLocale(QLocale("de_CH"));
+ QVERIFY(resource.isCompressed());
+
+ // the reset the default locale back
+ QLocale::setDefault(QLocale::system());
+}
+
QTEST_MAIN(tst_QResourceEngine)
#include "tst_qresourceengine.moc"
diff --git a/tests/auto/qscriptable/tst_qscriptable.cpp b/tests/auto/qscriptable/tst_qscriptable.cpp
index c0945d8..7ed0a8a 100644
--- a/tests/auto/qscriptable/tst_qscriptable.cpp
+++ b/tests/auto/qscriptable/tst_qscriptable.cpp
@@ -332,7 +332,6 @@ void tst_QScriptable::thisObject()
{
QVERIFY(!m_scriptable.oofThisObject().isValid());
m_engine.evaluate("o.oof = 123");
- QEXPECT_FAIL("", "QTBUG-5749: Setter doesn't get called when it's in the prototype", Continue);
QVERIFY(m_scriptable.oofThisObject().strictlyEquals(m_engine.evaluate("o")));
}
{
diff --git a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
index f72b6f7..4148594 100644
--- a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
+++ b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
@@ -756,12 +756,12 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
++failedProcesses;
}
- producer.waitForFinished(5000);
+ QVERIFY(producer.waitForFinished(5000));
bool consumerFailed = false;
while (!consumers.isEmpty()) {
- consumers.first()->waitForFinished(2000);
+ QVERIFY(consumers.first()->waitForFinished(3000));
if (consumers.first()->state() == QProcess::Running ||
consumers.first()->exitStatus() != QProcess::NormalExit ||
consumers.first()->exitCode() != 0) {
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index cb4e103..1d39c67 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -768,9 +768,7 @@ void tst_QSqlDatabase::checkValues(const FieldDef fieldDefs[], QSqlDatabase db)
rec->setValue(fieldDefs[ i ].fieldName(), fieldDefs[ i ].val);
// qDebug(QString("inserting %1 into %2").arg(fieldDefs[ i ].val.toString()).arg(fieldDefs[ i ].fieldName()));
}
- if (!cur.insert()) {
- QFAIL(QString("Couldn't insert record: %1 %2").arg(cur.lastError().databaseText()).arg(cur.lastError().driverText()));
- }
+ QVERIFY_SQL(cur, insert());
cur.setForwardOnly(true);
QVERIFY_SQL(cur, select("id = " + QString::number(pkey - 1)));
QVERIFY_SQL(cur, next());
@@ -833,9 +831,7 @@ void tst_QSqlDatabase::checkNullValues(const FieldDef fieldDefs[], QSqlDatabase
else
rec->setValue(fieldDefs[ i ].fieldName(), fieldDefs[ i ].val);
}
- if (!cur.insert()) {
- QFAIL(QString("Couldn't insert record: %1 %2").arg(cur.lastError().databaseText()).arg(cur.lastError().driverText()));
- }
+ QVERIFY_SQL(cur, insert());
cur.setForwardOnly(true);
QVERIFY_SQL(cur, select("id = " + QString::number(pkey - 1)));
QVERIFY_SQL(cur, next());
@@ -907,12 +903,8 @@ void tst_QSqlDatabase::recordOCI()
CHECK_DATABASE(db);
// runtime check for Oracle version since V8 doesn't support TIMESTAMPs
- if (tst_Databases::getOraVersion(db) >= 9) {
- qDebug("Detected Oracle >= 9, TIMESTAMP test enabled");
- hasTimeStamp = true;
- } else {
- qDebug("Detected Oracle < 9, TIMESTAMP test disabled");
- }
+ if (tst_Databases::getOraVersion(db) >= 9)
+ hasTimeStamp = true;
FieldDef tsdef;
FieldDef tstzdef;
@@ -923,11 +915,11 @@ void tst_QSqlDatabase::recordOCI()
static const QDateTime dt(QDate::currentDate(), QTime(1, 2, 3, 0));
if (hasTimeStamp) {
- tsdef = FieldDef("timestamp", QVariant::DateTime, dt);
- tstzdef = FieldDef("timestamp with time zone", QVariant::DateTime, dt);
- tsltzdef = FieldDef("timestamp with local time zone", QVariant::DateTime, dt);
- intytm = FieldDef("interval year to month", QVariant::String, QString("+01-01"));
- intdts = FieldDef("interval day to second", QVariant::String, QString("+01 00:00:01.000000"));
+ tsdef = FieldDef("timestamp", QVariant::DateTime, dt);
+ tstzdef = FieldDef("timestamp with time zone", QVariant::DateTime, dt);
+ tsltzdef = FieldDef("timestamp with local time zone", QVariant::DateTime, dt);
+ intytm = FieldDef("interval year to month", QVariant::String, QString("+01-01"));
+ intdts = FieldDef("interval day to second", QVariant::String, QString("+01 00:00:01.000000"));
}
const FieldDef fieldDefs[] = {
@@ -937,21 +929,19 @@ void tst_QSqlDatabase::recordOCI()
FieldDef("nvarchar2(20)", QVariant::String, QString("blah4")),
FieldDef("number(10,5)", QVariant::Double, 1.1234567),
FieldDef("date", QVariant::DateTime, dt),
-#ifdef QT3_SUPPORT
-//X? FieldDef("long raw", QVariant::ByteArray, QByteArray(Q3CString("blah5"))),
- FieldDef("raw(2000)", QVariant::ByteArray, QByteArray(Q3CString("blah6")), false),
- FieldDef("blob", QVariant::ByteArray, QByteArray(Q3CString("blah7"))),
-#endif
-//FIXME FieldDef("clob", QVariant::CString, Q3CString("blah8")),
-//FIXME FieldDef("nclob", QVariant::CString, Q3CString("blah9")),
-//X FieldDef("bfile", QVariant::ByteArray, QByteArray(Q3CString("blah10"))),
-
- intytm,
- intdts,
- tsdef,
- tstzdef,
- tsltzdef,
- FieldDef()
+ FieldDef("long raw", QVariant::ByteArray, QByteArray("blah5")),
+ FieldDef("raw(2000)", QVariant::ByteArray, QByteArray("blah6"), false),
+ FieldDef("blob", QVariant::ByteArray, QByteArray("blah7")),
+ FieldDef("clob", QVariant::String, QString("blah8")),
+ FieldDef("nclob", QVariant::String, QString("blah9")),
+// FieldDef("bfile", QVariant::ByteArray, QByteArray("blah10")),
+
+ intytm,
+ intdts,
+ tsdef,
+ tstzdef,
+ tsltzdef,
+ FieldDef()
};
const int fieldCount = createFieldTable(fieldDefs, db);
@@ -959,9 +949,8 @@ void tst_QSqlDatabase::recordOCI()
commonFieldTest(fieldDefs, db, fieldCount);
checkNullValues(fieldDefs, db);
- for (int i = 0; i < ITERATION_COUNT; ++i) {
- checkValues(fieldDefs, db);
- }
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ checkValues(fieldDefs, db);
// some additional tests
QSqlRecord rec = db.record(qTableName("qtestfields"));
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index a8908fd..5b6da30 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -201,6 +201,10 @@ private slots:
void QTBUG_5251();
void QTBUG_6421_data() { generic_data("QOCI"); }
void QTBUG_6421();
+ void QTBUG_6618_data() { generic_data("QODBC"); }
+ void QTBUG_6618();
+ void QTBUG_6852_data() { generic_data("QMYSQL"); }
+ void QTBUG_6852();
private:
// returns all database connections
@@ -2961,5 +2965,63 @@ void tst_QSqlQuery::QTBUG_6421()
QCOMPARE(q.value(0).toString(), QLatin1String("\"COL3\""));
}
+void tst_QSqlQuery::QTBUG_6618()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ if (!tst_Databases::isSqlServer( db ))
+ QSKIP("SQL Server specific test", SkipSingle);
+
+ QSqlQuery q(db);
+ q.exec( "drop procedure " + qTableName( "tst_raiseError" ) ); //non-fatal
+ QString errorString;
+ for (int i=0;i<110;i++)
+ errorString+="reallylong";
+ errorString+=" error";
+ QVERIFY_SQL( q, exec("create procedure " + qTableName( "tst_raiseError" ) + " as\n"
+ "begin\n"
+ " raiserror('" + errorString + "', 16, 1)\n"
+ "end\n" ));
+ q.exec( "{call " + qTableName( "tst_raiseError" ) + "}" );
+ QVERIFY(q.lastError().text().contains(errorString));
+}
+
+void tst_QSqlQuery::QTBUG_6852()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ if ( tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt()<5 )
+ QSKIP( "Test requires MySQL >= 5.0", SkipSingle );
+
+ QSqlQuery q(db);
+ QString tableName(qTableName(QLatin1String("bug6421"))), procName(qTableName(QLatin1String("bug6421_proc")));
+
+ QVERIFY_SQL(q, exec("DROP PROCEDURE IF EXISTS "+procName));
+ tst_Databases::safeDropTable(db, tableName);
+ QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+"(\n"
+ "MainKey INT NOT NULL,\n"
+ "OtherTextCol VARCHAR(45) NOT NULL,\n"
+ "PRIMARY KEY(`MainKey`))"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" VALUES(0, \"Disabled\")"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" VALUES(5, \"Error Only\")"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" VALUES(10, \"Enabled\")"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" VALUES(15, \"Always\")"));
+ QVERIFY_SQL(q, exec("CREATE PROCEDURE "+procName+"()\n"
+ "READS SQL DATA\n"
+ "BEGIN\n"
+ " SET @st = 'SELECT MainKey, OtherTextCol from "+tableName+"';\n"
+ " PREPARE stmt from @st;\n"
+ " EXECUTE stmt;\n"
+ "END;"));
+
+ QVERIFY_SQL(q, exec("CALL "+procName+"()"));
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 0);
+ QCOMPARE(q.value(1).toString(), QLatin1String("Disabled"));
+}
+
+
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 169a688..09c8c5f 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -51,13 +51,8 @@
#include <QtNetwork/qtcpserver.h>
#include <QtTest/QtTest>
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
-#ifdef TEST_QNETWORK_PROXY
#include <QNetworkProxy>
#include <QAuthenticator>
-#endif
#include "../network-settings.h"
@@ -253,7 +248,6 @@ void tst_QSslSocket::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy);
QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic);
@@ -261,14 +255,12 @@ void tst_QSslSocket::initTestCase_data()
QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic);
// uncomment the line below when NTLM works
// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm);
-#endif
}
void tst_QSslSocket::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString();
QNetworkProxy proxy;
@@ -295,15 +287,12 @@ void tst_QSslSocket::init()
break;
}
QNetworkProxy::setApplicationProxy(proxy);
-#endif
}
}
void tst_QSslSocket::cleanup()
{
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
}
#ifndef QT_NO_OPENSSL
diff --git a/tests/auto/qtcpserver/test/test.pro b/tests/auto/qtcpserver/test/test.pro
index bdeaa92..123c79e 100644
--- a/tests/auto/qtcpserver/test/test.pro
+++ b/tests/auto/qtcpserver/test/test.pro
@@ -32,7 +32,5 @@ QT = core network
MOC_DIR=tmp
-DEFINES += TEST_QNETWORK_PROXY
-
diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp
index 8b86111..4567435 100644
--- a/tests/auto/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp
@@ -66,11 +66,9 @@
#include <qplatformdefs.h>
#include <qhostinfo.h>
-#ifdef TEST_QNETWORK_PROXY
-# include <QNetworkProxy>
+#include <QNetworkProxy>
Q_DECLARE_METATYPE(QNetworkProxy)
Q_DECLARE_METATYPE(QList<QNetworkProxy>)
-#endif
#include "../network-settings.h"
@@ -95,9 +93,6 @@ private slots:
void constructing();
void clientServerLoop();
void ipv6Server();
- void ipv4LoopbackPerformanceTest();
- void ipv6LoopbackPerformanceTest();
- void ipv4PerformanceTest();
void crashTests();
void maxPendingConnections();
void listenError();
@@ -106,12 +101,10 @@ private slots:
void listenWhileListening();
void addressReusable();
void setNewSocketDescriptorBlocking();
-#ifdef TEST_QNETWORK_PROXY
void invalidProxy_data();
void invalidProxy();
void proxyFactory_data();
void proxyFactory();
-#endif
};
// Testing get/set functions
@@ -143,29 +136,23 @@ void tst_QTcpServer::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
-#endif
}
void tst_QTcpServer::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
}
-#endif
}
}
void tst_QTcpServer::cleanup()
{
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
}
//----------------------------------------------------------------------------------
@@ -258,159 +245,6 @@ void tst_QTcpServer::ipv6Server()
}
//----------------------------------------------------------------------------------
-void tst_QTcpServer::ipv4LoopbackPerformanceTest()
-{
- QFETCH_GLOBAL(bool, setProxy);
- if (setProxy)
- return;
-
- QTcpServer server;
- QVERIFY(server.listen(QHostAddress::LocalHost));
-
- QVERIFY(server.isListening());
-
- QTcpSocket clientA;
- clientA.connectToHost(QHostAddress::LocalHost, server.serverPort());
- QVERIFY(clientA.waitForConnected(5000));
- QVERIFY(clientA.state() == QAbstractSocket::ConnectedState);
-
- QVERIFY(server.waitForNewConnection());
- QTcpSocket *clientB = server.nextPendingConnection();
- QVERIFY(clientB);
-
- QByteArray buffer(16384, '@');
- QTime stopWatch;
- stopWatch.start();
- qlonglong totalWritten = 0;
- while (stopWatch.elapsed() < 5000) {
- QVERIFY(clientA.write(buffer.data(), buffer.size()) > 0);
- clientA.flush();
- totalWritten += buffer.size();
- while (clientB->waitForReadyRead(100)) {
- if (clientB->bytesAvailable() == 16384)
- break;
- }
- clientB->read(buffer.data(), buffer.size());
- clientB->write(buffer.data(), buffer.size());
- clientB->flush();
- totalWritten += buffer.size();
- while (clientA.waitForReadyRead(100)) {
- if (clientA.bytesAvailable() == 16384)
- break;
- }
- clientA.read(buffer.data(), buffer.size());
- }
-
- qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
- server.serverAddress().toString().toLatin1().constData(),
- totalWritten / (1024.0 * 1024.0),
- stopWatch.elapsed() / 1000.0,
- (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
-
- delete clientB;
-}
-
-//----------------------------------------------------------------------------------
-void tst_QTcpServer::ipv6LoopbackPerformanceTest()
-{
-#if defined(Q_OS_SYMBIAN)
- QSKIP("Symbian: IPv6 is not yet supported", SkipAll);
-#endif
- QTcpServer server;
- if (!server.listen(QHostAddress::LocalHostIPv6, 0)) {
- QVERIFY(server.serverError() == QAbstractSocket::UnsupportedSocketOperationError);
- } else {
- QTcpSocket clientA;
- clientA.connectToHost(server.serverAddress(), server.serverPort());
- QVERIFY(clientA.waitForConnected(5000));
-
- QVERIFY(server.waitForNewConnection(5000));
- QTcpSocket *clientB = server.nextPendingConnection();
- QVERIFY(clientB);
-
- QByteArray buffer(16384, '@');
- QTime stopWatch;
- stopWatch.start();
- qlonglong totalWritten = 0;
- while (stopWatch.elapsed() < 5000) {
- clientA.write(buffer.data(), buffer.size());
- clientA.flush();
- totalWritten += buffer.size();
- while (clientB->waitForReadyRead(100)) {
- if (clientB->bytesAvailable() == 16384)
- break;
- }
- clientB->read(buffer.data(), buffer.size());
- clientB->write(buffer.data(), buffer.size());
- clientB->flush();
- totalWritten += buffer.size();
- while (clientA.waitForReadyRead(100)) {
- if (clientA.bytesAvailable() == 16384)
- break;
- }
- clientA.read(buffer.data(), buffer.size());
- }
-
- qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
- server.serverAddress().toString().toLatin1().constData(),
- totalWritten / (1024.0 * 1024.0),
- stopWatch.elapsed() / 1000.0,
- (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
- delete clientB;
- }
-}
-
-//----------------------------------------------------------------------------------
-void tst_QTcpServer::ipv4PerformanceTest()
-{
- QTcpSocket probeSocket;
- probeSocket.connectToHost(QtNetworkSettings::serverName(), 143);
- QVERIFY(probeSocket.waitForConnected(5000));
-
- QTcpServer server;
- QVERIFY(server.listen(probeSocket.localAddress(), 0));
-
- QTcpSocket clientA;
- clientA.connectToHost(server.serverAddress(), server.serverPort());
- QVERIFY(clientA.waitForConnected(5000));
-
- QVERIFY(server.waitForNewConnection(5000));
- QTcpSocket *clientB = server.nextPendingConnection();
- QVERIFY(clientB);
-
- QByteArray buffer(16384, '@');
- QTime stopWatch;
- stopWatch.start();
- qlonglong totalWritten = 0;
- while (stopWatch.elapsed() < 5000) {
- qlonglong writtenA = clientA.write(buffer.data(), buffer.size());
- clientA.flush();
- totalWritten += buffer.size();
- while (clientB->waitForReadyRead(100)) {
- if (clientB->bytesAvailable() == writtenA)
- break;
- }
- clientB->read(buffer.data(), buffer.size());
- qlonglong writtenB = clientB->write(buffer.data(), buffer.size());
- clientB->flush();
- totalWritten += buffer.size();
- while (clientA.waitForReadyRead(100)) {
- if (clientA.bytesAvailable() == writtenB)
- break;
- }
- clientA.read(buffer.data(), buffer.size());
- }
-
- qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
- probeSocket.localAddress().toString().toLatin1().constData(),
- totalWritten / (1024.0 * 1024.0),
- stopWatch.elapsed() / 1000.0,
- (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
-
- delete clientB;
-}
-
-//----------------------------------------------------------------------------------
void tst_QTcpServer::crashTests()
{
QTcpServer server;
@@ -423,12 +257,10 @@ void tst_QTcpServer::maxPendingConnections()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 only 1 connection is allowed ever", SkipAll);
}
-#endif
}
//### sees to fail sometimes ... a timing issue with the test on windows
QTcpServer server;
@@ -464,12 +296,10 @@ void tst_QTcpServer::listenError()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 we can not make hard requirements on the address or port", SkipAll);
}
-#endif
}
QTcpServer server;
QVERIFY(!server.listen(QHostAddress("1.2.3.4"), 0));
@@ -513,12 +343,10 @@ void tst_QTcpServer::waitForConnectionTest()
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("Localhost servers don't work well with SOCKS5", SkipAll);
}
-#endif
}
QTcpSocket findLocalIpSocket;
@@ -624,12 +452,10 @@ void tst_QTcpServer::addressReusable()
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 this test does not make senans at the momment", SkipAll);
}
-#endif
}
#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QString signalName = QString::fromLatin1("/test_signal.txt");
@@ -667,12 +493,10 @@ void tst_QTcpServer::setNewSocketDescriptorBlocking()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 we can not make the socket descripter blocking", SkipAll);
}
-#endif
}
SeverWithBlockingSockets server;
QVERIFY(server.listen());
@@ -683,7 +507,6 @@ void tst_QTcpServer::setNewSocketDescriptorBlocking()
QVERIFY(server.ok);
}
-#ifdef TEST_QNETWORK_PROXY
void tst_QTcpServer::invalidProxy_data()
{
QTest::addColumn<int>("type");
@@ -838,7 +661,6 @@ void tst_QTcpServer::proxyFactory()
// Sometimes, error codes change for the better
QTEST(int(server.serverError()), "expectedError");
}
-#endif
QTEST_MAIN(tst_QTcpServer)
#include "tst_qtcpserver.moc"
diff --git a/tests/auto/qtcpsocket/test/test.pro b/tests/auto/qtcpsocket/test/test.pro
index 0f93def..c4369df 100644
--- a/tests/auto/qtcpsocket/test/test.pro
+++ b/tests/auto/qtcpsocket/test/test.pro
@@ -13,8 +13,6 @@ vxworks:QT -= gui
symbian: TARGET.EPOCHEAPSIZE="0x100 0x1000000"
-#DEFINES += TEST_QNETWORK_PROXY
-
TARGET = tst_qtcpsocket
win32 {
diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
index 863b8f5..c6d39ba 100644
--- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
@@ -82,9 +82,6 @@
#include <QTime>
#include <QTimer>
#include <QDebug>
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
// RVCT compiles also unused inline methods
# include <QNetworkProxy>
@@ -194,12 +191,11 @@ private slots:
void increaseReadBufferSize();
void taskQtBug5799ConnectionErrorWaitForConnected();
void taskQtBug5799ConnectionErrorEventLoop();
-#ifdef TEST_QNETWORK_PROXY
+
void invalidProxy_data();
void invalidProxy();
void proxyFactory_data();
void proxyFactory();
-#endif
protected slots:
void nonBlockingIMAP_hostFound();
@@ -270,17 +266,15 @@ void tst_QTcpSocket::initTestCase_data()
qDebug() << QtNetworkSettings::serverName();
QTest::newRow("WithoutProxy") << false << 0 << false;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false;
QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false;
QTest::newRow("WithHttpProxy") << true << int(HttpProxy) << false;
QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic) << false;
// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm) << false;
-#endif
+
#ifndef QT_NO_OPENSSL
QTest::newRow("WithoutProxy SSL") << false << 0 << true;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true;
QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true;
@@ -288,14 +282,12 @@ void tst_QTcpSocket::initTestCase_data()
QTest::newRow("WithHttpProxyBasicAuth SSL") << true << int(HttpProxy | AuthBasic) << true;
// QTest::newRow("WithHttpProxyNtlmAuth SSL") << true << int(HttpProxy | AuthNtlm) << true;
#endif
-#endif
}
void tst_QTcpSocket::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString();
QNetworkProxy proxy;
@@ -322,7 +314,6 @@ void tst_QTcpSocket::init()
break;
}
QNetworkProxy::setApplicationProxy(proxy);
-#endif
}
}
@@ -345,9 +336,7 @@ QTcpSocket *tst_QTcpSocket::newSocket() const
void tst_QTcpSocket::cleanup()
{
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
}
void tst_QTcpSocket::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth)
@@ -1322,9 +1311,7 @@ void tst_QTcpSocket::synchronousApi()
void tst_QTcpSocket::dontCloseOnTimeout()
{
QTcpServer server;
-#ifdef TEST_QNETWORK_PROXY
server.setProxy(QNetworkProxy(QNetworkProxy::NoProxy));
-#endif
QVERIFY(server.listen());
QHostAddress serverAddress = QHostAddress::LocalHost;
@@ -1793,9 +1780,6 @@ void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead()
QCOMPARE(readyReadSpy.count(), 1);
QString s = socket->readLine();
-#ifdef TEST_QNETWORK_PROXY
- QNetworkProxy::ProxyType proxyType = QNetworkProxy::applicationProxy().type();
-#endif
QCOMPARE(s.toLatin1().constData(), QtNetworkSettings::expectedReplyIMAP().constData());
QCOMPARE(socket->bytesAvailable(), qint64(0));
@@ -2252,9 +2236,6 @@ void tst_QTcpSocket::taskQtBug5799ConnectionErrorEventLoop()
QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit());
}
-
-
-#ifdef TEST_QNETWORK_PROXY
void tst_QTcpSocket::invalidProxy_data()
{
QTest::addColumn<int>("type");
@@ -2433,7 +2414,6 @@ void tst_QTcpSocket::proxyFactory()
delete socket;
}
-#endif
QTEST_MAIN(tst_QTcpSocket)
diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
index cfcbcfb..a61de99 100644
--- a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
+++ b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
@@ -175,6 +175,10 @@ void tst_QTextOdfWriter::testWriteStyle1_data()
"<style:style style:name=\"c4\" style:family=\"text\"><style:text-properties fo:font-style=\"italic\" fo:font-family=\"Sans\"/></style:style>";
QTest::newRow("bold+italic") << text1 << 25 <<
"<style:style style:name=\"c4\" style:family=\"text\"><style:text-properties fo:font-style=\"italic\" fo:font-weight=\"bold\" fo:font-family=\"Sans\"/></style:style>";
+ QString colorText = "<span style=\"color: #00FF00; background-color: #FF0000;\"> Color Text </span>";
+ QTest::newRow("green/red") << colorText << 3 <<
+ "<style:style style:name=\"c4\" style:family=\"text\"><style:text-properties fo:font-family=\"Sans\" fo:color=\"#00ff00\" fo:background-color=\"#ff0000\"/></style:style>";
+
}
void tst_QTextOdfWriter::testWriteStyle1()
diff --git a/tests/auto/qudpsocket/test/test.pro b/tests/auto/qudpsocket/test/test.pro
index 2e0a020..44d3d30 100644
--- a/tests/auto/qudpsocket/test/test.pro
+++ b/tests/auto/qudpsocket/test/test.pro
@@ -3,7 +3,6 @@ SOURCES += ../tst_qudpsocket.cpp
QT = core network
MOC_DIR=tmp
-DEFINES += TEST_QNETWORK_PROXY
win32 {
CONFIG(debug, debug|release) {
diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp
index 160d74c..e3ab9bc 100644
--- a/tests/auto/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp
@@ -49,10 +49,7 @@
#include <qhostaddress.h>
#include <qhostinfo.h>
#include <qmap.h>
-#ifdef TEST_QNETWORK_PROXY
-# include <QNetworkProxy>
-#endif
-
+#include <QNetworkProxy>
#include <qstringlist.h>
#include "../network-settings.h"
@@ -118,32 +115,23 @@ void tst_QUdpSocket::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
-#endif
}
void tst_QUdpSocket::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
}
-#endif
}
}
void tst_QUdpSocket::cleanup()
{
- QFETCH_GLOBAL(bool, setProxy);
- if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
- }
}
@@ -204,12 +192,10 @@ void tst_QUdpSocket::broadcasting()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 Broadcast is not supported.", SkipSingle);
}
-#endif
}
#ifdef Q_OS_AIX
QSKIP("Broadcast does not work on darko", SkipAll);
@@ -539,12 +525,10 @@ void tst_QUdpSocket::bindMode()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 explicit port binding is not supported.", SkipAll);
}
-#endif
}
QUdpSocket socket;
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index 03e77aa..70cfb61 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -1682,6 +1682,12 @@ void tst_QUrl::toString_constructed_data()
<< QByteArray("//qt.nokia.com/index.html");
QTest::newRow("data2") << QString::fromLatin1("file") << n << n << n << -1 << QString::fromLatin1("/root") << QByteArray()
<< n << QString::fromLatin1("file:///root") << QByteArray("file:///root");
+ QTest::newRow("userAndPass") << QString::fromLatin1("http") << QString::fromLatin1("dfaure") << QString::fromLatin1("kde")
+ << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n
+ << QString::fromLatin1("http://dfaure:kde@kde.org:443/") << QByteArray("http://dfaure:kde@kde.org:443/");
+ QTest::newRow("PassWithoutUser") << QString::fromLatin1("http") << n << QString::fromLatin1("kde")
+ << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n
+ << QString::fromLatin1("http://:kde@kde.org:443/") << QByteArray("http://:kde@kde.org:443/");
}
void tst_QUrl::toString_constructed()
@@ -1717,6 +1723,7 @@ void tst_QUrl::toString_constructed()
QVERIFY(url.isValid());
QCOMPARE(url.toString(), asString);
+ QCOMPARE(QString::fromLatin1(url.toEncoded()), QString::fromLatin1(asEncoded)); // readable in case of differences
QCOMPARE(url.toEncoded(), asEncoded);
}
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index 3d68a73..ae0131c 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -272,6 +272,8 @@ private slots:
void numericalConvert();
void moreCustomTypes();
void variantInVariant();
+
+ void colorInteger();
};
Q_DECLARE_METATYPE(QDate)
@@ -3388,5 +3390,20 @@ void tst_QVariant::variantInVariant()
QCOMPARE(qvariant_cast<QVariant>(var9), var1);
}
+void tst_QVariant::colorInteger()
+{
+ QVariant v = QColor(Qt::red);
+ QCOMPARE(v.type(), QVariant::Color);
+ QCOMPARE(v.value<QColor>(), QColor(Qt::red));
+
+ v.setValue(1000);
+ QCOMPARE(v.type(), QVariant::Int);
+ QCOMPARE(v.toInt(), 1000);
+
+ v.setValue(QColor(Qt::yellow));
+ QCOMPARE(v.type(), QVariant::Color);
+ QCOMPARE(v.value<QColor>(), QColor(Qt::yellow));
+}
+
QTEST_MAIN(tst_QVariant)
#include "tst_qvariant.moc"
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 3e14b56..2d04cc5 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -66,6 +66,8 @@
#include <private/qapplication_p.h>
#include <qcalendarwidget.h>
#include <qmainwindow.h>
+#include <qdockwidget.h>
+#include <qtoolbar.h>
#include <QtGui/qpaintengine.h>
#include <private/qbackingstore_p.h>
@@ -356,6 +358,7 @@ private slots:
void paintOnScreenPossible();
#endif
void reparentStaticWidget();
+ void QTBUG6883_reparentStaticWidget2();
#ifdef Q_WS_QWS
void updateOutsideSurfaceClip();
#endif
@@ -8728,6 +8731,31 @@ void tst_QWidget::reparentStaticWidget()
// Please don't crash.
paintOnScreen.resize(paintOnScreen.size() + QSize(2, 2));
QTest::qWait(20);
+
+}
+
+void tst_QWidget::QTBUG6883_reparentStaticWidget2()
+{
+ QMainWindow mw;
+ QDockWidget *one = new QDockWidget("one", &mw);
+ mw.addDockWidget(Qt::LeftDockWidgetArea, one , Qt::Vertical);
+
+ QWidget *child = new QWidget();
+ child->setPalette(Qt::red);
+ child->setAutoFillBackground(true);
+ child->setAttribute(Qt::WA_StaticContents);
+ child->resize(100, 100);
+ one->setWidget(child);
+
+ QToolBar *mainTools = mw.addToolBar("Main Tools");
+ mainTools->addWidget(new QLineEdit);
+
+ mw.show();
+ QTest::qWaitForWindowShown(&mw);
+
+ one->setFloating(true);
+ QTest::qWait(20);
+ //do not crash
}
#ifdef Q_WS_QWS
@@ -9726,7 +9754,7 @@ public:
void deleteBackingStore()
{
if (static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) {
- delete static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore;
+ delete static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore;
static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore = 0;
}
}
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 579f4eb..ed3b08e 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -182,12 +182,12 @@ void tst_Selftests::runSubTest_data()
#endif
QTest::newRow("benchlibeventcounter") << "benchlibeventcounter" << QStringList("-eventcounter");
QTest::newRow("benchliboptions") << "benchliboptions" << QStringList("-eventcounter");
- QTest::newRow("benchlibwalltime") << "benchlibwalltime" << QStringList();
- //### This test is affected by the speed of the CPU and whether the tick counter is
- //### monotonically increasing. It won't work on some machines so leave it off by default.
+ //### These tests are affected by timing and whether the CPU tick counter is
+ //### monotonically increasing. They won't work on some machines so leave them off by default.
//### Feel free to uncomment for your own testing.
#if 0
+ QTest::newRow("benchlibwalltime") << "benchlibwalltime" << QStringList();
QTest::newRow("benchlibtickcounter") << "benchlibtickcounter" << QStringList("-tickcounter");
#endif
diff --git a/tests/auto/uic/baseline/config_fromuic3.ui b/tests/auto/uic/baseline/config_fromuic3.ui
new file mode 100644
index 0000000..0bd6256
--- /dev/null
+++ b/tests/auto/uic/baseline/config_fromuic3.ui
@@ -0,0 +1,1647 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0" stdsetdef="1">
+ <author></author>
+ <comment>*********************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+*********************************************************************</comment>
+ <exportmacro></exportmacro>
+ <class>Config</class>
+ <widget class="QDialog" name="Config">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>481</width>
+ <height>645</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Configure</string>
+ </property>
+ <property name="windowIcon">
+ <pixmap>logo.png</pixmap>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item row="0" column="1">
+ <widget class="Q3ButtonGroup" name="ButtonGroup2">
+ <property name="title">
+ <string>Depth</string>
+ </property>
+ <widget class="QRadioButton" name="depth_1">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>19</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>1 bit monochrome</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="depth_4gray">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>44</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>4 bit grayscale</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="depth_8">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>69</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>8 bit</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="depth_12">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>94</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>12 (16) bit</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="depth_16">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>119</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>16 bit</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="depth_32">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>144</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>32 bit</string>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ <item row="4" column="0" rowspan="1" colspan="2">
+ <layout class="QHBoxLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item>
+ <spacer name="Horizontal Spacing2">
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonOk">
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCancel">
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0" rowspan="1" colspan="2">
+ <widget class="QCheckBox" name="touchScreen">
+ <property name="text">
+ <string>Emulate touch screen (no mouse move).</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" rowspan="1" colspan="2">
+ <widget class="Q3GroupBox" name="GroupBox1">
+ <property name="title">
+ <string>Gamma</string>
+ </property>
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item row="6" column="0">
+ <widget class="QLabel" name="TextLabel3">
+ <property name="text">
+ <string>Blue</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QSlider" name="bslider">
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>63</red>
+ <green>63</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>38</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>38</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ </palette>
+ </property>
+ <property name="maximum">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2">
+ <widget class="QLabel" name="blabel">
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <spacer name="Spacer3">
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="TextLabel2">
+ <property name="text">
+ <string>Green</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QSlider" name="gslider">
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>63</red>
+ <green>255</green>
+ <blue>63</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>127</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>170</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>255</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>127</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>170</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>255</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>127</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>170</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ </palette>
+ </property>
+ <property name="maximum">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="2">
+ <widget class="QLabel" name="glabel">
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="TextLabel7">
+ <property name="text">
+ <string>All</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="TextLabel8">
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSlider" name="gammaslider">
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ </palette>
+ </property>
+ <property name="maximum">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="TextLabel1_2">
+ <property name="text">
+ <string>Red</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLabel" name="rlabel">
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QSlider" name="rslider">
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>63</green>
+ <blue>63</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>38</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>38</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ </palette>
+ </property>
+ <property name="maximum">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <spacer name="Spacer2">
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1">
+ <spacer name="Spacer4">
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </spacer>
+ </item>
+ <item row="8" column="0" rowspan="1" colspan="3">
+ <widget class="QPushButton" name="PushButton3">
+ <property name="text">
+ <string>Set all to 1.0</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3" rowspan="9" colspan="1">
+ <widget class="GammaView" name="MyCustomWidget1"/>
+ </item>
+ <item row="7" column="1">
+ <spacer name="Spacer5">
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="Q3ButtonGroup" name="ButtonGroup1">
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Size</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QRadioButton" name="size_240_320">
+ <property name="text">
+ <string>240x320 &quot;PDA&quot;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="size_320_240">
+ <property name="text">
+ <string>320x240 &quot;TV&quot;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="size_640_480">
+ <property name="text">
+ <string>640x480 &quot;VGA&quot;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QRadioButton" name="size_custom">
+ <property name="text">
+ <string>Custom</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="size_width">
+ <property name="maximum">
+ <number>1280</number>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="singleStep">
+ <number>16</number>
+ </property>
+ <property name="value">
+ <number>400</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="size_height">
+ <property name="maximum">
+ <number>1024</number>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="singleStep">
+ <number>16</number>
+ </property>
+ <property name="value">
+ <number>300</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QRadioButton" name="size_skin">
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Skin</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="skin">
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <item>
+ <property name="text">
+ <string>pda.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>ipaq.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>qpe.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>cassiopeia.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>other.skin</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0" rowspan="1" colspan="2">
+ <widget class="QLabel" name="TextLabel1">
+ <property name="text">
+ <string>&lt;p&gt;Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth &lt;i&gt;above&lt;/i&gt;. You may freely modify the Gamma &lt;i&gt;below&lt;/i&gt;.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="test_for_useless_buttongroupId">
+ <property name="text">
+ <string>Test</string>
+ </property>
+ <property name="buttonGroupId">
+ <string>1</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>GammaView</class>
+ <extends>QWidget</extends>
+ <header location="local">gammaview.h</header>
+ <sizehint>
+ <width>64</width>
+ <height>64</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>3</hordata>
+ <verdata>3</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ </customwidgets>
+ <images>
+ <image name="image0">
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+ </images>
+ <connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>Config</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>Config</receiver>
+ <slot>reject()</slot>
+ </connection>
+ </connections>
+</ui>
diff --git a/tests/auto/uic/baseline/config_fromuic3.ui.h b/tests/auto/uic/baseline/config_fromuic3.ui.h
new file mode 100644
index 0000000..ec20d05
--- /dev/null
+++ b/tests/auto/uic/baseline/config_fromuic3.ui.h
@@ -0,0 +1,715 @@
+/*
+*********************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+*********************************************************************
+*/
+
+/********************************************************************************
+** Form generated from reading UI file 'config_fromuic3.ui'
+**
+** Created: Thu Dec 17 12:48:42 2009
+** by: Qt User Interface Compiler version 4.6.1
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef CONFIG_FROMUIC3_H
+#define CONFIG_FROMUIC3_H
+
+#include <Qt3Support/Q3ButtonGroup>
+#include <Qt3Support/Q3GroupBox>
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QCheckBox>
+#include <QtGui/QComboBox>
+#include <QtGui/QDialog>
+#include <QtGui/QGridLayout>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QHeaderView>
+#include <QtGui/QLabel>
+#include <QtGui/QPushButton>
+#include <QtGui/QRadioButton>
+#include <QtGui/QSlider>
+#include <QtGui/QSpacerItem>
+#include <QtGui/QSpinBox>
+#include <QtGui/QVBoxLayout>
+#include "gammaview.h"
+
+QT_BEGIN_NAMESPACE
+
+class Ui_Config
+{
+public:
+ QGridLayout *gridLayout;
+ Q3ButtonGroup *ButtonGroup2;
+ QRadioButton *depth_1;
+ QRadioButton *depth_4gray;
+ QRadioButton *depth_8;
+ QRadioButton *depth_12;
+ QRadioButton *depth_16;
+ QRadioButton *depth_32;
+ QHBoxLayout *hboxLayout;
+ QSpacerItem *Horizontal_Spacing2;
+ QPushButton *buttonOk;
+ QPushButton *buttonCancel;
+ QCheckBox *touchScreen;
+ Q3GroupBox *GroupBox1;
+ QGridLayout *gridLayout1;
+ QLabel *TextLabel3;
+ QSlider *bslider;
+ QLabel *blabel;
+ QSpacerItem *Spacer3;
+ QLabel *TextLabel2;
+ QSlider *gslider;
+ QLabel *glabel;
+ QLabel *TextLabel7;
+ QLabel *TextLabel8;
+ QSlider *gammaslider;
+ QLabel *TextLabel1_2;
+ QLabel *rlabel;
+ QSlider *rslider;
+ QSpacerItem *Spacer2;
+ QSpacerItem *Spacer4;
+ QPushButton *PushButton3;
+ GammaView *MyCustomWidget1;
+ QSpacerItem *Spacer5;
+ Q3ButtonGroup *ButtonGroup1;
+ QVBoxLayout *vboxLayout;
+ QRadioButton *size_240_320;
+ QRadioButton *size_320_240;
+ QRadioButton *size_640_480;
+ QHBoxLayout *hboxLayout1;
+ QRadioButton *size_custom;
+ QSpinBox *size_width;
+ QSpinBox *size_height;
+ QHBoxLayout *hboxLayout2;
+ QRadioButton *size_skin;
+ QComboBox *skin;
+ QLabel *TextLabel1;
+ QRadioButton *test_for_useless_buttongroupId;
+
+ void setupUi(QDialog *Config)
+ {
+ if (Config->objectName().isEmpty())
+ Config->setObjectName(QString::fromUtf8("Config"));
+ Config->resize(481, 645);
+ Config->setWindowIcon(QPixmap(QString::fromUtf8("logo.png")));
+ Config->setSizeGripEnabled(true);
+ gridLayout = new QGridLayout(Config);
+ gridLayout->setSpacing(6);
+ gridLayout->setContentsMargins(11, 11, 11, 11);
+ gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
+ ButtonGroup2 = new Q3ButtonGroup(Config);
+ ButtonGroup2->setObjectName(QString::fromUtf8("ButtonGroup2"));
+ depth_1 = new QRadioButton(ButtonGroup2);
+ depth_1->setObjectName(QString::fromUtf8("depth_1"));
+ depth_1->setGeometry(QRect(11, 19, 229, 19));
+ depth_4gray = new QRadioButton(ButtonGroup2);
+ depth_4gray->setObjectName(QString::fromUtf8("depth_4gray"));
+ depth_4gray->setGeometry(QRect(11, 44, 229, 19));
+ depth_8 = new QRadioButton(ButtonGroup2);
+ depth_8->setObjectName(QString::fromUtf8("depth_8"));
+ depth_8->setGeometry(QRect(11, 69, 229, 19));
+ depth_12 = new QRadioButton(ButtonGroup2);
+ depth_12->setObjectName(QString::fromUtf8("depth_12"));
+ depth_12->setGeometry(QRect(11, 94, 229, 19));
+ depth_16 = new QRadioButton(ButtonGroup2);
+ depth_16->setObjectName(QString::fromUtf8("depth_16"));
+ depth_16->setGeometry(QRect(11, 119, 229, 19));
+ depth_32 = new QRadioButton(ButtonGroup2);
+ depth_32->setObjectName(QString::fromUtf8("depth_32"));
+ depth_32->setGeometry(QRect(11, 144, 229, 19));
+
+ gridLayout->addWidget(ButtonGroup2, 0, 1, 1, 1);
+
+ hboxLayout = new QHBoxLayout();
+ hboxLayout->setSpacing(6);
+ hboxLayout->setContentsMargins(0, 0, 0, 0);
+ hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
+ Horizontal_Spacing2 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+ hboxLayout->addItem(Horizontal_Spacing2);
+
+ buttonOk = new QPushButton(Config);
+ buttonOk->setObjectName(QString::fromUtf8("buttonOk"));
+ buttonOk->setAutoDefault(true);
+ buttonOk->setDefault(true);
+
+ hboxLayout->addWidget(buttonOk);
+
+ buttonCancel = new QPushButton(Config);
+ buttonCancel->setObjectName(QString::fromUtf8("buttonCancel"));
+ buttonCancel->setAutoDefault(true);
+
+ hboxLayout->addWidget(buttonCancel);
+
+
+ gridLayout->addLayout(hboxLayout, 4, 0, 1, 2);
+
+ touchScreen = new QCheckBox(Config);
+ touchScreen->setObjectName(QString::fromUtf8("touchScreen"));
+
+ gridLayout->addWidget(touchScreen, 2, 0, 1, 2);
+
+ GroupBox1 = new Q3GroupBox(Config);
+ GroupBox1->setObjectName(QString::fromUtf8("GroupBox1"));
+ GroupBox1->setColumnLayout(0, Qt::Vertical);
+ GroupBox1->layout()->setSpacing(6);
+ GroupBox1->layout()->setContentsMargins(11, 11, 11, 11);
+ gridLayout1 = new QGridLayout();
+ QBoxLayout *boxlayout = qobject_cast<QBoxLayout *>(GroupBox1->layout());
+ if (boxlayout)
+ boxlayout->addLayout(gridLayout1);
+ gridLayout1->setAlignment(Qt::AlignTop);
+ gridLayout1->setObjectName(QString::fromUtf8("gridLayout1"));
+ TextLabel3 = new QLabel(GroupBox1);
+ TextLabel3->setObjectName(QString::fromUtf8("TextLabel3"));
+ TextLabel3->setWordWrap(false);
+
+ gridLayout1->addWidget(TextLabel3, 6, 0, 1, 1);
+
+ bslider = new QSlider(GroupBox1);
+ bslider->setObjectName(QString::fromUtf8("bslider"));
+ QPalette palette;
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(1), QColor(0, 0, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(2), QColor(127, 127, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(3), QColor(63, 63, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(4), QColor(0, 0, 127));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(5), QColor(0, 0, 170));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(1), QColor(0, 0, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(2), QColor(127, 127, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(3), QColor(38, 38, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(4), QColor(0, 0, 127));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(5), QColor(0, 0, 170));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(0), QColor(128, 128, 128));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(1), QColor(0, 0, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(2), QColor(127, 127, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(3), QColor(38, 38, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(4), QColor(0, 0, 127));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(5), QColor(0, 0, 170));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(8), QColor(128, 128, 128));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ bslider->setPalette(palette);
+ bslider->setMaximum(400);
+ bslider->setValue(100);
+ bslider->setOrientation(Qt::Horizontal);
+
+ gridLayout1->addWidget(bslider, 6, 1, 1, 1);
+
+ blabel = new QLabel(GroupBox1);
+ blabel->setObjectName(QString::fromUtf8("blabel"));
+ blabel->setWordWrap(false);
+
+ gridLayout1->addWidget(blabel, 6, 2, 1, 1);
+
+ Spacer3 = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+
+ gridLayout1->addItem(Spacer3, 5, 1, 1, 1);
+
+ TextLabel2 = new QLabel(GroupBox1);
+ TextLabel2->setObjectName(QString::fromUtf8("TextLabel2"));
+ TextLabel2->setWordWrap(false);
+
+ gridLayout1->addWidget(TextLabel2, 4, 0, 1, 1);
+
+ gslider = new QSlider(GroupBox1);
+ gslider->setObjectName(QString::fromUtf8("gslider"));
+ QPalette palette1;
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(1), QColor(0, 255, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(2), QColor(127, 255, 127));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(3), QColor(63, 255, 63));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(4), QColor(0, 127, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(5), QColor(0, 170, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(1), QColor(0, 255, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(2), QColor(127, 255, 127));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(3), QColor(38, 255, 38));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(4), QColor(0, 127, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(5), QColor(0, 170, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(0), QColor(128, 128, 128));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(1), QColor(0, 255, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(2), QColor(127, 255, 127));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(3), QColor(38, 255, 38));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(4), QColor(0, 127, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(5), QColor(0, 170, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(8), QColor(128, 128, 128));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ gslider->setPalette(palette1);
+ gslider->setMaximum(400);
+ gslider->setValue(100);
+ gslider->setOrientation(Qt::Horizontal);
+
+ gridLayout1->addWidget(gslider, 4, 1, 1, 1);
+
+ glabel = new QLabel(GroupBox1);
+ glabel->setObjectName(QString::fromUtf8("glabel"));
+ glabel->setWordWrap(false);
+
+ gridLayout1->addWidget(glabel, 4, 2, 1, 1);
+
+ TextLabel7 = new QLabel(GroupBox1);
+ TextLabel7->setObjectName(QString::fromUtf8("TextLabel7"));
+ TextLabel7->setWordWrap(false);
+
+ gridLayout1->addWidget(TextLabel7, 0, 0, 1, 1);
+
+ TextLabel8 = new QLabel(GroupBox1);
+ TextLabel8->setObjectName(QString::fromUtf8("TextLabel8"));
+ TextLabel8->setWordWrap(false);
+
+ gridLayout1->addWidget(TextLabel8, 0, 2, 1, 1);
+
+ gammaslider = new QSlider(GroupBox1);
+ gammaslider->setObjectName(QString::fromUtf8("gammaslider"));
+ QPalette palette2;
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(1), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(2), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(3), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(4), QColor(127, 127, 127));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(5), QColor(170, 170, 170));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(1), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(2), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(3), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(4), QColor(127, 127, 127));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(5), QColor(170, 170, 170));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(0), QColor(128, 128, 128));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(1), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(2), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(3), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(4), QColor(127, 127, 127));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(5), QColor(170, 170, 170));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(8), QColor(128, 128, 128));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ gammaslider->setPalette(palette2);
+ gammaslider->setMaximum(400);
+ gammaslider->setValue(100);
+ gammaslider->setOrientation(Qt::Horizontal);
+
+ gridLayout1->addWidget(gammaslider, 0, 1, 1, 1);
+
+ TextLabel1_2 = new QLabel(GroupBox1);
+ TextLabel1_2->setObjectName(QString::fromUtf8("TextLabel1_2"));
+ TextLabel1_2->setWordWrap(false);
+
+ gridLayout1->addWidget(TextLabel1_2, 2, 0, 1, 1);
+
+ rlabel = new QLabel(GroupBox1);
+ rlabel->setObjectName(QString::fromUtf8("rlabel"));
+ rlabel->setWordWrap(false);
+
+ gridLayout1->addWidget(rlabel, 2, 2, 1, 1);
+
+ rslider = new QSlider(GroupBox1);
+ rslider->setObjectName(QString::fromUtf8("rslider"));
+ QPalette palette3;
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(1), QColor(255, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(2), QColor(255, 127, 127));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(3), QColor(255, 63, 63));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(4), QColor(127, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(5), QColor(170, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(1), QColor(255, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(2), QColor(255, 127, 127));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(3), QColor(255, 38, 38));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(4), QColor(127, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(5), QColor(170, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(0), QColor(128, 128, 128));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(1), QColor(255, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(2), QColor(255, 127, 127));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(3), QColor(255, 38, 38));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(4), QColor(127, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(5), QColor(170, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(8), QColor(128, 128, 128));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ rslider->setPalette(palette3);
+ rslider->setMaximum(400);
+ rslider->setValue(100);
+ rslider->setOrientation(Qt::Horizontal);
+
+ gridLayout1->addWidget(rslider, 2, 1, 1, 1);
+
+ Spacer2 = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+
+ gridLayout1->addItem(Spacer2, 3, 1, 1, 1);
+
+ Spacer4 = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+
+ gridLayout1->addItem(Spacer4, 1, 1, 1, 1);
+
+ PushButton3 = new QPushButton(GroupBox1);
+ PushButton3->setObjectName(QString::fromUtf8("PushButton3"));
+
+ gridLayout1->addWidget(PushButton3, 8, 0, 1, 3);
+
+ MyCustomWidget1 = new GammaView(GroupBox1);
+ MyCustomWidget1->setObjectName(QString::fromUtf8("MyCustomWidget1"));
+
+ gridLayout1->addWidget(MyCustomWidget1, 0, 3, 9, 1);
+
+ Spacer5 = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+
+ gridLayout1->addItem(Spacer5, 7, 1, 1, 1);
+
+
+ gridLayout->addWidget(GroupBox1, 3, 0, 1, 2);
+
+ ButtonGroup1 = new Q3ButtonGroup(Config);
+ ButtonGroup1->setObjectName(QString::fromUtf8("ButtonGroup1"));
+ QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5));
+ sizePolicy.setHorizontalStretch(0);
+ sizePolicy.setVerticalStretch(0);
+ sizePolicy.setHeightForWidth(ButtonGroup1->sizePolicy().hasHeightForWidth());
+ ButtonGroup1->setSizePolicy(sizePolicy);
+ ButtonGroup1->setColumnLayout(0, Qt::Vertical);
+ ButtonGroup1->layout()->setSpacing(6);
+ ButtonGroup1->layout()->setContentsMargins(11, 11, 11, 11);
+ vboxLayout = new QVBoxLayout();
+ QBoxLayout *boxlayout1 = qobject_cast<QBoxLayout *>(ButtonGroup1->layout());
+ if (boxlayout1)
+ boxlayout1->addLayout(vboxLayout);
+ vboxLayout->setAlignment(Qt::AlignTop);
+ vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
+ size_240_320 = new QRadioButton(ButtonGroup1);
+ size_240_320->setObjectName(QString::fromUtf8("size_240_320"));
+
+ vboxLayout->addWidget(size_240_320);
+
+ size_320_240 = new QRadioButton(ButtonGroup1);
+ size_320_240->setObjectName(QString::fromUtf8("size_320_240"));
+
+ vboxLayout->addWidget(size_320_240);
+
+ size_640_480 = new QRadioButton(ButtonGroup1);
+ size_640_480->setObjectName(QString::fromUtf8("size_640_480"));
+
+ vboxLayout->addWidget(size_640_480);
+
+ hboxLayout1 = new QHBoxLayout();
+ hboxLayout1->setSpacing(6);
+ hboxLayout1->setContentsMargins(0, 0, 0, 0);
+ hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
+ size_custom = new QRadioButton(ButtonGroup1);
+ size_custom->setObjectName(QString::fromUtf8("size_custom"));
+
+ hboxLayout1->addWidget(size_custom);
+
+ size_width = new QSpinBox(ButtonGroup1);
+ size_width->setObjectName(QString::fromUtf8("size_width"));
+ size_width->setMaximum(1280);
+ size_width->setMinimum(1);
+ size_width->setSingleStep(16);
+ size_width->setValue(400);
+
+ hboxLayout1->addWidget(size_width);
+
+ size_height = new QSpinBox(ButtonGroup1);
+ size_height->setObjectName(QString::fromUtf8("size_height"));
+ size_height->setMaximum(1024);
+ size_height->setMinimum(1);
+ size_height->setSingleStep(16);
+ size_height->setValue(300);
+
+ hboxLayout1->addWidget(size_height);
+
+
+ vboxLayout->addLayout(hboxLayout1);
+
+ hboxLayout2 = new QHBoxLayout();
+ hboxLayout2->setSpacing(6);
+ hboxLayout2->setContentsMargins(0, 0, 0, 0);
+ hboxLayout2->setObjectName(QString::fromUtf8("hboxLayout2"));
+ size_skin = new QRadioButton(ButtonGroup1);
+ size_skin->setObjectName(QString::fromUtf8("size_skin"));
+ QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(0), static_cast<QSizePolicy::Policy>(0));
+ sizePolicy1.setHorizontalStretch(0);
+ sizePolicy1.setVerticalStretch(0);
+ sizePolicy1.setHeightForWidth(size_skin->sizePolicy().hasHeightForWidth());
+ size_skin->setSizePolicy(sizePolicy1);
+
+ hboxLayout2->addWidget(size_skin);
+
+ skin = new QComboBox(ButtonGroup1);
+ skin->setObjectName(QString::fromUtf8("skin"));
+ QSizePolicy sizePolicy2(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(0));
+ sizePolicy2.setHorizontalStretch(0);
+ sizePolicy2.setVerticalStretch(0);
+ sizePolicy2.setHeightForWidth(skin->sizePolicy().hasHeightForWidth());
+ skin->setSizePolicy(sizePolicy2);
+
+ hboxLayout2->addWidget(skin);
+
+
+ vboxLayout->addLayout(hboxLayout2);
+
+
+ gridLayout->addWidget(ButtonGroup1, 0, 0, 1, 1);
+
+ TextLabel1 = new QLabel(Config);
+ TextLabel1->setObjectName(QString::fromUtf8("TextLabel1"));
+ TextLabel1->setWordWrap(false);
+
+ gridLayout->addWidget(TextLabel1, 1, 0, 1, 2);
+
+ test_for_useless_buttongroupId = new QRadioButton(Config);
+ test_for_useless_buttongroupId->setObjectName(QString::fromUtf8("test_for_useless_buttongroupId"));
+
+ gridLayout->addWidget(test_for_useless_buttongroupId, 0, 0, 1, 1);
+
+
+ retranslateUi(Config);
+ QObject::connect(buttonOk, SIGNAL(clicked()), Config, SLOT(accept()));
+ QObject::connect(buttonCancel, SIGNAL(clicked()), Config, SLOT(reject()));
+
+ QMetaObject::connectSlotsByName(Config);
+ } // setupUi
+
+ void retranslateUi(QDialog *Config)
+ {
+ Config->setWindowTitle(QApplication::translate("Config", "Configure", 0, QApplication::UnicodeUTF8));
+ ButtonGroup2->setTitle(QApplication::translate("Config", "Depth", 0, QApplication::UnicodeUTF8));
+ depth_1->setText(QApplication::translate("Config", "1 bit monochrome", 0, QApplication::UnicodeUTF8));
+ depth_4gray->setText(QApplication::translate("Config", "4 bit grayscale", 0, QApplication::UnicodeUTF8));
+ depth_8->setText(QApplication::translate("Config", "8 bit", 0, QApplication::UnicodeUTF8));
+ depth_12->setText(QApplication::translate("Config", "12 (16) bit", 0, QApplication::UnicodeUTF8));
+ depth_16->setText(QApplication::translate("Config", "16 bit", 0, QApplication::UnicodeUTF8));
+ depth_32->setText(QApplication::translate("Config", "32 bit", 0, QApplication::UnicodeUTF8));
+ buttonOk->setText(QApplication::translate("Config", "&OK", 0, QApplication::UnicodeUTF8));
+ buttonCancel->setText(QApplication::translate("Config", "&Cancel", 0, QApplication::UnicodeUTF8));
+ touchScreen->setText(QApplication::translate("Config", "Emulate touch screen (no mouse move).", 0, QApplication::UnicodeUTF8));
+ GroupBox1->setTitle(QApplication::translate("Config", "Gamma", 0, QApplication::UnicodeUTF8));
+ TextLabel3->setText(QApplication::translate("Config", "Blue", 0, QApplication::UnicodeUTF8));
+ blabel->setText(QApplication::translate("Config", "1.0", 0, QApplication::UnicodeUTF8));
+ TextLabel2->setText(QApplication::translate("Config", "Green", 0, QApplication::UnicodeUTF8));
+ glabel->setText(QApplication::translate("Config", "1.0", 0, QApplication::UnicodeUTF8));
+ TextLabel7->setText(QApplication::translate("Config", "All", 0, QApplication::UnicodeUTF8));
+ TextLabel8->setText(QApplication::translate("Config", "1.0", 0, QApplication::UnicodeUTF8));
+ TextLabel1_2->setText(QApplication::translate("Config", "Red", 0, QApplication::UnicodeUTF8));
+ rlabel->setText(QApplication::translate("Config", "1.0", 0, QApplication::UnicodeUTF8));
+ PushButton3->setText(QApplication::translate("Config", "Set all to 1.0", 0, QApplication::UnicodeUTF8));
+ ButtonGroup1->setTitle(QApplication::translate("Config", "Size", 0, QApplication::UnicodeUTF8));
+ size_240_320->setText(QApplication::translate("Config", "240x320 \"PDA\"", 0, QApplication::UnicodeUTF8));
+ size_320_240->setText(QApplication::translate("Config", "320x240 \"TV\"", 0, QApplication::UnicodeUTF8));
+ size_640_480->setText(QApplication::translate("Config", "640x480 \"VGA\"", 0, QApplication::UnicodeUTF8));
+ size_custom->setText(QApplication::translate("Config", "Custom", 0, QApplication::UnicodeUTF8));
+ size_skin->setText(QApplication::translate("Config", "Skin", 0, QApplication::UnicodeUTF8));
+ skin->clear();
+ skin->insertItems(0, QStringList()
+ << QApplication::translate("Config", "pda.skin", 0, QApplication::UnicodeUTF8)
+ << QApplication::translate("Config", "ipaq.skin", 0, QApplication::UnicodeUTF8)
+ << QApplication::translate("Config", "qpe.skin", 0, QApplication::UnicodeUTF8)
+ << QApplication::translate("Config", "cassiopeia.skin", 0, QApplication::UnicodeUTF8)
+ << QApplication::translate("Config", "other.skin", 0, QApplication::UnicodeUTF8)
+ );
+ TextLabel1->setText(QApplication::translate("Config", "<p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth <i>above</i>. You may freely modify the Gamma <i>below</i>.", 0, QApplication::UnicodeUTF8));
+ test_for_useless_buttongroupId->setText(QApplication::translate("Config", "Test", 0, QApplication::UnicodeUTF8));
+ } // retranslateUi
+
+
+protected:
+ enum IconID
+ {
+ image0_ID,
+ unknown_ID
+ };
+ static QPixmap qt_get_icon(IconID id)
+ {
+ static const char* const image0_data[] = {
+"22 22 2 1",
+". c None",
+"# c #a4c610",
+"........######........",
+".....###########......",
+"....##############....",
+"...################...",
+"..######......######..",
+"..#####........#####..",
+".#####.......#..#####.",
+".####.......###..####.",
+"####.......#####..####",
+"####......#####...####",
+"####....#######...####",
+"####....######....####",
+"####...########...####",
+".####.##########..####",
+".####..####.#########.",
+".#####..##...########.",
+"..#####.......#######.",
+"..######......######..",
+"...###################",
+"....##################",
+"......###########.###.",
+"........######.....#.."};
+
+
+ switch (id) {
+ case image0_ID: return QPixmap((const char**)image0_data);
+ default: return QPixmap();
+ } // switch
+ } // icon
+
+};
+
+namespace Ui {
+ class Config: public Ui_Config {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // CONFIG_FROMUIC3_H
diff --git a/tests/auto/uic3/baseline/config.ui b/tests/auto/uic3/baseline/config.ui
index 1ffeab3..dc02682 100644
--- a/tests/auto/uic3/baseline/config.ui
+++ b/tests/auto/uic3/baseline/config.ui
@@ -1648,6 +1648,17 @@
<string>&lt;p&gt;Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth &lt;i&gt;above&lt;/i&gt;. You may freely modify the Gamma &lt;i&gt;below&lt;/i&gt;.</string>
</property>
</widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>test_for_useless_buttongroupId</cstring>
+ </property>
+ <property name="text">
+ <string>Test</string>
+ </property>
+ <property name="buttonGroupId">
+ <string>1</string>
+ </property>
+ </widget>
</grid>
</widget>
<customwidgets>
diff --git a/tests/auto/uic3/baseline/config.ui.4 b/tests/auto/uic3/baseline/config.ui.4
index 17e6a7c..0bd6256 100644
--- a/tests/auto/uic3/baseline/config.ui.4
+++ b/tests/auto/uic3/baseline/config.ui.4
@@ -1595,6 +1595,16 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QRadioButton" name="test_for_useless_buttongroupId">
+ <property name="text">
+ <string>Test</string>
+ </property>
+ <property name="buttonGroupId">
+ <string>1</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index 9170039..7bb4bb1 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -5,6 +5,7 @@ SUBDIRS = containers-associative \
qbytearray \
qfileinfo \
qfile_vs_qnetworkaccessmanager \
+ qhostinfo \
qpainter \
qtestlib-simple events \
qiodevice \
@@ -20,6 +21,26 @@ SUBDIRS = containers-associative \
qregion \
qvariant \
qwidget \
- qtwidgets
+ qtwidgets \
+ qapplication \
+ qdir \
+ qdiriterator \
+ qgraphicsanchorlayout \
+ qgraphicsitem \
+ qgraphicswidget \
+ qmetaobject \
+ qpixmapcache \
+ qquaternion \
+ qscriptclass \
+ qscriptengine \
+ qscriptvalue \
+ qstringbuilder \
+ qstylesheetstyle \
+ qsvgrenderer \
+ qtcpserver \
+ qtableview \
+ qthreadstorage
+
+
contains(QT_CONFIG, opengl): SUBDIRS += opengl
diff --git a/tests/benchmarks/containers-sequential/main.cpp b/tests/benchmarks/containers-sequential/main.cpp
index 76643ca..885db3e 100644
--- a/tests/benchmarks/containers-sequential/main.cpp
+++ b/tests/benchmarks/containers-sequential/main.cpp
@@ -59,7 +59,7 @@ public:
};
template <typename T>
-static T * f(T *ts) // dummy function to prevent code from being optimized away by the compiler
+T * f(T *ts) // dummy function to prevent code from being optimized away by the compiler
{
return ts;
}
@@ -81,7 +81,7 @@ class UseCases_QVector : public UseCases<T>
void lookup(int size)
{
QVector<T> v;
-
+
T t;
for (int i = 0; i < size; ++i)
v.append(t);
@@ -113,7 +113,7 @@ class UseCases_stdvector : public UseCases<T>
void lookup(int size)
{
std::vector<T> v;
-
+
T t;
for (int i = 0; i < size; ++i)
v.push_back(t);
@@ -132,6 +132,13 @@ struct Large { // A "large" item type
int x[1000];
};
+// Symbian devices typically have limited memory
+#ifdef Q_OS_SYMBIAN
+# define LARGE_MAX_SIZE 2000
+#else
+# define LARGE_MAX_SIZE 20000
+#endif
+
class tst_vector_vs_std : public QObject
{
Q_OBJECT
@@ -190,7 +197,7 @@ void tst_vector_vs_std::insert_Large_data()
QTest::addColumn<bool>("useStd");
QTest::addColumn<int>("size");
- for (int size = 10; size < 20000; size += 100) {
+ for (int size = 10; size < LARGE_MAX_SIZE; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size;
QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size;
@@ -236,7 +243,7 @@ void tst_vector_vs_std::lookup_Large_data()
QTest::addColumn<bool>("useStd");
QTest::addColumn<int>("size");
- for (int size = 10; size < 20000; size += 100) {
+ for (int size = 10; size < LARGE_MAX_SIZE; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size;
QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size;
diff --git a/tests/benchmarks/events/main.cpp b/tests/benchmarks/events/main.cpp
index 7c9de8f..09d6c53 100644
--- a/tests/benchmarks/events/main.cpp
+++ b/tests/benchmarks/events/main.cpp
@@ -47,6 +47,7 @@ class PingPong : public QObject
{
public:
void setPeer(QObject *peer);
+ void resetCounter() {m_counter = 100;}
protected:
bool event(QEvent *e);
@@ -69,7 +70,7 @@ bool PingPong::event(QEvent *)
QEvent *e = new QEvent(QEvent::User);
QCoreApplication::postEvent(m_peer, e);
} else {
- QCoreApplication::quit();
+ QTestEventLoop::instance().exitLoop();
}
return true;
}
@@ -149,6 +150,10 @@ void EventsBench::sendEvent()
void EventsBench::postEvent_data()
{
QTest::addColumn<bool>("filterEvents");
+ // The first time an eventloop is executed, the case runs radically slower at least
+ // on some platforms, so test the "no eventfilter" case to get a comparable results
+ // with the "eventfilter" case.
+ QTest::newRow("first time, no eventfilter") << false;
QTest::newRow("no eventfilter") << false;
QTest::newRow("eventfilter") << true;
}
@@ -164,8 +169,14 @@ void EventsBench::postEvent()
ping.installEventFilter(this);
pong.installEventFilter(this);
}
- QEvent *e = new QEvent(QEvent::User);
+
QBENCHMARK {
+ // In case multiple iterations are done, event needs to be created inside the QBENCHMARK,
+ // or it gets deleted once first iteration exits and can cause a crash. Similarly,
+ // ping and pong need their counters reset.
+ QEvent *e = new QEvent(QEvent::User);
+ ping.resetCounter();
+ pong.resetCounter();
QCoreApplication::postEvent(&ping, e);
QTestEventLoop::instance().enterLoop( 61 );
}
diff --git a/tests/benchmarks/qbytearray/main.cpp b/tests/benchmarks/qbytearray/main.cpp
index 6a481f1..78c5b16 100644
--- a/tests/benchmarks/qbytearray/main.cpp
+++ b/tests/benchmarks/qbytearray/main.cpp
@@ -73,6 +73,11 @@ void tst_qbytearray::append()
{
QFETCH(int, size);
+#ifdef Q_OS_SYMBIAN
+ if (size > 1000000)
+ QSKIP("Skipped due to limited memory in many Symbian devices.", SkipSingle);
+#endif
+
QByteArray ba;
QBENCHMARK {
QByteArray ba2(size, 'x');
diff --git a/tests/benchmarks/qdiriterator/main.cpp b/tests/benchmarks/qdiriterator/main.cpp
index 2a400e3..9e4e53e 100644
--- a/tests/benchmarks/qdiriterator/main.cpp
+++ b/tests/benchmarks/qdiriterator/main.cpp
@@ -73,7 +73,7 @@ private slots:
void tst_qdiriterator::data()
{
-#ifdef Q_OS_WINCE
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QByteArray qtdir = qPrintable(QCoreApplication::applicationDirPath());
qtdir += "/depot";
#else
@@ -148,9 +148,9 @@ static int posix_helper(const char *dirpath)
int count = 0;
while ((entry = ::readdir(dir))) {
- if (qstrcmp(entry->d_name, ".") == 0)
+ if (qstrcmp(entry->d_name, ".") == 0)
continue;
- if (qstrcmp(entry->d_name, "..") == 0)
+ if (qstrcmp(entry->d_name, "..") == 0)
continue;
++count;
QByteArray ba = dirpath;
@@ -198,7 +198,7 @@ void tst_qdiriterator::diriterator()
//QDir::AllEntries | QDir::Hidden,
QDir::Files,
QDirIterator::Subdirectories);
-
+
while (dir.hasNext()) {
dir.next();
//printf("%s\n", qPrintable(dir.fileName()));
@@ -231,7 +231,7 @@ void tst_qdiriterator::fsiterator()
//QDir::Files | QDir::NoDotAndDotDot,
QDir::Files,
QFileSystemIterator::Subdirectories);
-
+
for (; !dir.atEnd(); dir.next()) {
dump && printf("%d %s\n",
dir.fileInfo().isDir(),
diff --git a/tests/benchmarks/qdiriterator/qdiriterator.pro b/tests/benchmarks/qdiriterator/qdiriterator.pro
index fb4b753..e06d746 100755
--- a/tests/benchmarks/qdiriterator/qdiriterator.pro
+++ b/tests/benchmarks/qdiriterator/qdiriterator.pro
@@ -15,7 +15,7 @@ SOURCES += main.cpp
SOURCES += qfilesystemiterator.cpp
HEADERS += qfilesystemiterator.h
-wince*: {
+wince*|symbian: {
corelibdir.sources = $$QT_SOURCE_TREE/src/corelib
corelibdir.path = ./depot/src
DEPLOYMENT += corelibdir
diff --git a/tests/benchmarks/qfile/main.cpp b/tests/benchmarks/qfile/main.cpp
index d3f6ab5..4217077 100644
--- a/tests/benchmarks/qfile/main.cpp
+++ b/tests/benchmarks/qfile/main.cpp
@@ -128,12 +128,18 @@ private:
QString tmpDirName;
};
+Q_DECLARE_METATYPE(tst_qfile::BenchmarkType)
+Q_DECLARE_METATYPE(QIODevice::OpenMode)
+Q_DECLARE_METATYPE(QIODevice::OpenModeFlag)
+
void tst_qfile::createFile()
{
+ removeFile(); // Cleanup in case previous test case aborted before cleaning up
+
QTemporaryFile tmpFile;
tmpFile.setAutoRemove(false);
if (!tmpFile.open())
- ::_exit(1);
+ ::exit(1);
filename = tmpFile.fileName();
tmpFile.close();
}
@@ -217,7 +223,6 @@ void tst_qfile::readBigFile_data(BenchmarkType type, QIODevice::OpenModeFlag t,
for (int i=0; i<bs_entries; ++i)
QTest::newRow((QString("BS: %1, Flags: %2" )).arg(bs[i]).arg(flagstring).toLatin1().constData()) << type << bs[i] << t << b;
-
}
void tst_qfile::readBigFile()
@@ -227,8 +232,12 @@ void tst_qfile::readBigFile()
QFETCH(QFile::OpenModeFlag, textMode);
QFETCH(QFile::OpenModeFlag, bufferedMode);
- char buffer[BUFSIZE]; // we can't allocate buffers nice and dynamically in c++
- removeFile();
+#ifndef Q_OS_WIN
+ if (testType == Win32Benchmark)
+ QSKIP("This is Windows only benchmark.", SkipSingle);
+#endif
+
+ char *buffer = new char[BUFSIZE];
createFile();
fillFile();
@@ -297,6 +306,9 @@ void tst_qfile::readBigFile()
}
break;
}
+
+ removeFile();
+ delete[] buffer;
}
void tst_qfile::seek_data()
@@ -374,6 +386,8 @@ void tst_qfile::seek()
}
break;
}
+
+ removeFile();
}
void tst_qfile::open_data()
@@ -392,7 +406,6 @@ void tst_qfile::open()
{
QFETCH(tst_qfile::BenchmarkType, testType);
- removeFile();
createFile();
switch (testType) {
@@ -435,6 +448,7 @@ void tst_qfile::open()
file.open(cfile, QIODevice::ReadOnly);
file.close();
}
+ ::fclose(cfile);
}
break;
case(Win32Benchmark): {
@@ -456,6 +470,7 @@ void tst_qfile::open()
break;
}
+ removeFile();
}
@@ -515,15 +530,20 @@ void tst_qfile::readSmallFiles_data(BenchmarkType type, QIODevice::OpenModeFlag
void tst_qfile::createSmallFiles()
{
QDir dir = QDir::temp();
- Q_ASSERT(dir.mkdir("tst"));
+ dir.mkdir("tst");
dir.cd("tst");
tmpDirName = dir.absolutePath();
+#ifdef Q_OS_SYMBIAN
+ for (int i = 0; i < 100; ++i)
+#else
for (int i = 0; i < 1000; ++i)
+#endif
{
QFile f(tmpDirName+"/"+QString::number(i));
f.open(QIODevice::WriteOnly);
- f.seek(512);
+ f.seek(511);
+ f.putChar('\n');
f.close();
}
}
@@ -544,17 +564,22 @@ void tst_qfile::readSmallFiles()
QFETCH(QFile::OpenModeFlag, textMode);
QFETCH(QFile::OpenModeFlag, bufferedMode);
- removeSmallFiles();
+#ifndef Q_OS_WIN
+ if (testType == Win32Benchmark)
+ QSKIP("This is Windows only benchmark.", SkipSingle);
+#endif
+
createSmallFiles();
+
QDir dir(tmpDirName);
- const QStringList files = dir.entryList(QDir::NoDotAndDotDot|QDir::NoSymLinks);
- char buffer[BUFSIZE]; // we can't allocate buffers nice and dynamically in c++
+ const QStringList files = dir.entryList(QDir::NoDotAndDotDot|QDir::NoSymLinks|QDir::Files);
+ char *buffer = new char[BUFSIZE];
switch (testType) {
case(QFileBenchmark): {
QList<QFile*> fileList;
Q_FOREACH(QString file, files) {
- QFile *f = new QFile(file);
+ QFile *f = new QFile(tmpDirName+ "/" + file);
f->open(QIODevice::ReadOnly|textMode|bufferedMode);
fileList.append(f);
}
@@ -576,7 +601,7 @@ void tst_qfile::readSmallFiles()
case(QFSFileEngineBenchmark): {
QList<QFSFileEngine*> fileList;
Q_FOREACH(QString file, files) {
- QFSFileEngine *fse = new QFSFileEngine(file);
+ QFSFileEngine *fse = new QFSFileEngine(tmpDirName+ "/" + file);
fse->open(QIODevice::ReadOnly|textMode|bufferedMode);
fileList.append(fse);
}
@@ -596,7 +621,7 @@ void tst_qfile::readSmallFiles()
case(PosixBenchmark): {
QList<FILE*> fileList;
Q_FOREACH(QString file, files) {
- fileList.append(::fopen(QFile::encodeName(file).constData(), "rb"));
+ fileList.append(::fopen(QFile::encodeName(tmpDirName+ "/" + file).constData(), "rb"));
}
QBENCHMARK {
@@ -640,11 +665,10 @@ void tst_qfile::readSmallFiles()
}
break;
}
-}
-Q_DECLARE_METATYPE(tst_qfile::BenchmarkType)
-Q_DECLARE_METATYPE(QIODevice::OpenMode)
-Q_DECLARE_METATYPE(QIODevice::OpenModeFlag)
+ removeSmallFiles();
+ delete[] buffer;
+}
QTEST_MAIN(tst_qfile)
diff --git a/tests/benchmarks/qgraphicsview/qgraphicsview.pro b/tests/benchmarks/qgraphicsview/qgraphicsview.pro
index d9db8c9..927d731 100644
--- a/tests/benchmarks/qgraphicsview/qgraphicsview.pro
+++ b/tests/benchmarks/qgraphicsview/qgraphicsview.pro
@@ -6,3 +6,11 @@ SOURCES += tst_qgraphicsview.cpp
RESOURCES += qgraphicsview.qrc
include(chiptester/chiptester.pri)
+
+symbian {
+ qt_not_deployed {
+ plugins.sources = qjpeg.dll
+ plugins.path = imageformats
+ DEPLOYMENT += plugins
+ }
+}
diff --git a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
index aadd56c..cf65e5d 100644
--- a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
@@ -62,25 +62,25 @@ class QEventWaiter : public QEventLoop
{
public:
QEventWaiter(QObject *receiver, QEvent::Type type)
- : waiting(false), t(type)
+ : waiting(false), t(type)
{
- receiver->installEventFilter(this);
+ receiver->installEventFilter(this);
}
void wait()
{
- waiting = true;
- exec();
+ waiting = true;
+ exec();
}
bool eventFilter(QObject *receiver, QEvent *event)
{
- Q_UNUSED(receiver);
- if (waiting && event->type() == t) {
- waiting = false;
- exit();
- }
- return false;
+ Q_UNUSED(receiver);
+ if (waiting && event->type() == t) {
+ waiting = false;
+ exit();
+ }
+ return false;
}
private:
@@ -166,20 +166,26 @@ void tst_QGraphicsView::paintSingleItem()
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ view.viewport()->render(&painter);
}
}
+#ifdef Q_OS_SYMBIAN
+# define DEEP_STACKING_COUNT 200
+#else
+# define DEEP_STACKING_COUNT 1000
+#endif
+
void tst_QGraphicsView::paintDeepStackingItems()
{
QGraphicsScene scene(0, 0, 100, 100);
QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10);
QGraphicsRectItem *lastRect = item;
- for (int i = 0; i < 1000; ++i) {
- QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
- rect->setPos(1, 1);
- rect->setParentItem(lastRect);
- lastRect = rect;
+ for (int i = 0; i < DEEP_STACKING_COUNT; ++i) {
+ QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
+ rect->setPos(1, 1);
+ rect->setParentItem(lastRect);
+ lastRect = rect;
}
QGraphicsView view(&scene);
@@ -192,7 +198,7 @@ void tst_QGraphicsView::paintDeepStackingItems()
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ view.viewport()->render(&painter);
}
}
@@ -202,11 +208,11 @@ void tst_QGraphicsView::paintDeepStackingItems_clipped()
QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10);
item->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
QGraphicsRectItem *lastRect = item;
- for (int i = 0; i < 1000; ++i) {
- QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
- rect->setPos(1, 1);
- rect->setParentItem(lastRect);
- lastRect = rect;
+ for (int i = 0; i < DEEP_STACKING_COUNT; ++i) {
+ QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
+ rect->setPos(1, 1);
+ rect->setParentItem(lastRect);
+ lastRect = rect;
}
QGraphicsView view(&scene);
@@ -219,7 +225,7 @@ void tst_QGraphicsView::paintDeepStackingItems_clipped()
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ view.viewport()->render(&painter);
}
}
@@ -239,8 +245,8 @@ void tst_QGraphicsView::moveSingleItem()
int n = 1;
QBENCHMARK {
item->setPos(25 * n, 25 * n);
- waiter.wait();
- n = n ? 0 : 1;
+ waiter.wait();
+ n = n ? 0 : 1;
}
}
@@ -382,18 +388,18 @@ void tst_QGraphicsView::chipTester()
tester.setOpenGL(opengl);
tester.setOperation(ChipTester::Operation(operation));
QBENCHMARK {
- tester.runBenchmark();
+ tester.runBenchmark();
}
}
static void addChildHelper(QGraphicsItem *parent, int n, bool rotate)
{
if (!n)
- return;
+ return;
QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0, 0, 50, 50), parent);
item->setPos(10, 10);
if (rotate)
- item->rotate(10);
+ item->rotate(10);
addChildHelper(item, n - 1, rotate);
}
@@ -421,12 +427,12 @@ void tst_QGraphicsView::deepNesting()
QGraphicsScene scene;
for (int y = 0; y < 15; ++y) {
- for (int x = 0; x < 15; ++x) {
- QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50));
- if (rotate) item1->rotate(10);
- item1->setPos(x * 25, y * 25);
- addChildHelper(item1, 30, rotate);
- }
+ for (int x = 0; x < 15; ++x) {
+ QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50));
+ if (rotate) item1->rotate(10);
+ item1->setPos(x * 25, y * 25);
+ addChildHelper(item1, 30, rotate);
+ }
}
scene.setItemIndexMethod(bsp ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex);
scene.setSortCacheEnabled(sortCache);
@@ -441,11 +447,11 @@ void tst_QGraphicsView::deepNesting()
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
- CALLGRIND_START_INSTRUMENTATION
+ CALLGRIND_START_INSTRUMENTATION
#endif
- view.viewport()->repaint();
+ view.viewport()->repaint();
#ifdef CALLGRIND_DEBUG
- CALLGRIND_STOP_INSTRUMENTATION
+ CALLGRIND_STOP_INSTRUMENTATION
#endif
}
}
@@ -456,36 +462,36 @@ public:
AnimatedPixmapItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0)
: QGraphicsPixmapItem(parent), rotateFactor(0), scaleFactor(0)
{
- rotate = rot;
- scale = scal;
- xspeed = x;
- yspeed = y;
+ rotate = rot;
+ scale = scal;
+ xspeed = x;
+ yspeed = y;
}
protected:
void advance(int i)
- {
- if (!i)
- return;
- int x = int(pos().x()) + pixmap().width();
- x += xspeed;
- x = (x % (300 + pixmap().width() * 2)) - pixmap().width();
- int y = int(pos().y()) + pixmap().width();
- y += yspeed;
- y = (y % (300 + pixmap().width() * 2)) - pixmap().width();
- setPos(x, y);
-
- int rot = rotateFactor;
- int sca = scaleFactor;
+ {
+ if (!i)
+ return;
+ int x = int(pos().x()) + pixmap().width();
+ x += xspeed;
+ x = (x % (300 + pixmap().width() * 2)) - pixmap().width();
+ int y = int(pos().y()) + pixmap().width();
+ y += yspeed;
+ y = (y % (300 + pixmap().width() * 2)) - pixmap().width();
+ setPos(x, y);
+
+ int rot = rotateFactor;
+ int sca = scaleFactor;
if (rotate)
- rotateFactor = 1 + (rot + xspeed) % 360;
+ rotateFactor = 1 + (rot + xspeed) % 360;
if (scale)
- scaleFactor = 1 + (sca + yspeed) % 50;
+ scaleFactor = 1 + (sca + yspeed) % 50;
- if (rotate || scale) {
- qreal s = 0.5 + scaleFactor / 50.0;
- setTransform(QTransform().rotate(rotateFactor).scale(s, s));
- }
+ if (rotate || scale) {
+ qreal s = 0.5 + scaleFactor / 50.0;
+ setTransform(QTransform().rotate(rotateFactor).scale(s, s));
+ }
}
private:
@@ -543,38 +549,38 @@ void tst_QGraphicsView::imageRiver()
view.show();
QPixmap pix(":/images/designer.png");
- QVERIFY(!pix.isNull());
+ QVERIFY(!pix.isNull());
QList<QGraphicsItem *> items;
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
for (int i = 0; i < 100; ++i) {
- AnimatedPixmapItem *item;
- if (direction == 0) item = new AnimatedPixmapItem((i % 4) + 1, 0, rotation, scale);
- if (direction == 1) item = new AnimatedPixmapItem(0, (i % 4) + 1, rotation, scale);
- if (direction == 2) item = new AnimatedPixmapItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
- item->setPixmap(pix);
+ AnimatedPixmapItem *item;
+ if (direction == 0) item = new AnimatedPixmapItem((i % 4) + 1, 0, rotation, scale);
+ if (direction == 1) item = new AnimatedPixmapItem(0, (i % 4) + 1, rotation, scale);
+ if (direction == 2) item = new AnimatedPixmapItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
+ item->setPixmap(pix);
int rnd1, rnd2;
str >> rnd1 >> rnd2;
- item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
- -pix.height() + rnd2 % (view.height() + pix.height()));
- scene.addItem(item);
+ item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
+ -pix.height() + rnd2 % (view.height() + pix.height()));
+ scene.addItem(item);
}
view.count = 0;
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
- CALLGRIND_START_INSTRUMENTATION
+ CALLGRIND_START_INSTRUMENTATION
#endif
- for (int i = 0; i < 100; ++i) {
- scene.advance();
- while (view.count < (i+1))
- qApp->processEvents();
- }
+ for (int i = 0; i < 100; ++i) {
+ scene.advance();
+ while (view.count < (i+1))
+ qApp->processEvents();
+ }
#ifdef CALLGRIND_DEBUG
- CALLGRIND_STOP_INSTRUMENTATION
+ CALLGRIND_STOP_INSTRUMENTATION
#endif
}
}
@@ -585,38 +591,38 @@ public:
AnimatedTextItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0)
: QGraphicsSimpleTextItem(parent), rotateFactor(0), scaleFactor(25)
{
- setText("River of text");
- rotate = rot;
- scale = scal;
- xspeed = x;
- yspeed = y;
+ setText("River of text");
+ rotate = rot;
+ scale = scal;
+ xspeed = x;
+ yspeed = y;
}
protected:
void advance(int i)
- {
- if (!i)
- return;
- QRect r = boundingRect().toRect();
- int x = int(pos().x()) + r.width();
- x += xspeed;
- x = (x % (300 + r.width() * 2)) - r.width();
- int y = int(pos().y()) + r.width();
- y += yspeed;
- y = (y % (300 + r.width() * 2)) - r.width();
- setPos(x, y);
-
- int rot = rotateFactor;
- int sca = scaleFactor;
+ {
+ if (!i)
+ return;
+ QRect r = boundingRect().toRect();
+ int x = int(pos().x()) + r.width();
+ x += xspeed;
+ x = (x % (300 + r.width() * 2)) - r.width();
+ int y = int(pos().y()) + r.width();
+ y += yspeed;
+ y = (y % (300 + r.width() * 2)) - r.width();
+ setPos(x, y);
+
+ int rot = rotateFactor;
+ int sca = scaleFactor;
if (rotate)
- rotateFactor = 1 + (rot + xspeed) % 360;
+ rotateFactor = 1 + (rot + xspeed) % 360;
if (scale)
- scaleFactor = 1 + (sca + yspeed) % 50;
+ scaleFactor = 1 + (sca + yspeed) % 50;
- if (rotate || scale) {
- qreal s = 0.5 + scaleFactor / 50.0;
- setTransform(QTransform().rotate(rotateFactor).scale(s, s));
- }
+ if (rotate || scale) {
+ qreal s = 0.5 + scaleFactor / 50.0;
+ setTransform(QTransform().rotate(rotateFactor).scale(s, s));
+ }
}
private:
@@ -657,37 +663,37 @@ void tst_QGraphicsView::textRiver()
view.show();
QPixmap pix(":/images/designer.png");
- QVERIFY(!pix.isNull());
+ QVERIFY(!pix.isNull());
QList<QGraphicsItem *> items;
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
for (int i = 0; i < 100; ++i) {
- AnimatedTextItem *item;
- if (direction == 0) item = new AnimatedTextItem((i % 4) + 1, 0, rotation, scale);
- if (direction == 1) item = new AnimatedTextItem(0, (i % 4) + 1, rotation, scale);
- if (direction == 2) item = new AnimatedTextItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
+ AnimatedTextItem *item;
+ if (direction == 0) item = new AnimatedTextItem((i % 4) + 1, 0, rotation, scale);
+ if (direction == 1) item = new AnimatedTextItem(0, (i % 4) + 1, rotation, scale);
+ if (direction == 2) item = new AnimatedTextItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
int rnd1, rnd2;
str >> rnd1 >> rnd2;
- item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
- -pix.height() + rnd2 % (view.height() + pix.height()));
- scene.addItem(item);
+ item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
+ -pix.height() + rnd2 % (view.height() + pix.height()));
+ scene.addItem(item);
}
view.count = 0;
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
- CALLGRIND_START_INSTRUMENTATION
+ CALLGRIND_START_INSTRUMENTATION
#endif
- for (int i = 0; i < 100; ++i) {
- scene.advance();
- while (view.count < (i+1))
- qApp->processEvents();
- }
+ for (int i = 0; i < 100; ++i) {
+ scene.advance();
+ while (view.count < (i+1))
+ qApp->processEvents();
+ }
#ifdef CALLGRIND_DEBUG
- CALLGRIND_STOP_INSTRUMENTATION
+ CALLGRIND_STOP_INSTRUMENTATION
#endif
}
}
diff --git a/tests/benchmarks/qhostinfo/main.cpp b/tests/benchmarks/qhostinfo/main.cpp
new file mode 100644
index 0000000..80d0fd8
--- /dev/null
+++ b/tests/benchmarks/qhostinfo/main.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QDebug>
+#include <QHostInfo>
+#include <QStringList>
+#include <QString>
+
+#include <qtest.h>
+#include <qtesteventloop.h>
+
+class tst_qhostinfo : public QObject
+{
+ Q_OBJECT
+private slots:
+ void lookupSpeed();
+};
+
+class SignalReceiver : public QObject
+{
+ Q_OBJECT
+public:
+ SignalReceiver(int nrc) : receiveCount(0), neededReceiveCount(nrc) {};
+ int receiveCount;
+ int neededReceiveCount;
+public slots:
+ void resultsReady(const QHostInfo) {
+ receiveCount++;
+ if (receiveCount == neededReceiveCount)
+ QTestEventLoop::instance().exitLoop();
+ }
+};
+
+void tst_qhostinfo::lookupSpeed()
+{
+ QStringList hostnameList;
+ hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no"
+ << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com"
+ << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----";
+ // also add some duplicates:
+ hostnameList << "www.nokia.com" << "127.0.0.1" << "www.trolltech.com";
+ const int COUNT = hostnameList.size();
+
+ SignalReceiver receiver(COUNT);
+
+ QBENCHMARK {
+ for (int i = 0; i < hostnameList.size(); i++)
+ QHostInfo::lookupHost(hostnameList.at(i), &receiver, SLOT(resultsReady(const QHostInfo)));
+ QTestEventLoop::instance().enterLoop(20);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ }
+}
+
+
+QTEST_MAIN(tst_qhostinfo)
+
+#include "main.moc"
diff --git a/tests/benchmarks/qhostinfo/qhostinfo.pro b/tests/benchmarks/qhostinfo/qhostinfo.pro
new file mode 100755
index 0000000..f18d6d7
--- /dev/null
+++ b/tests/benchmarks/qhostinfo/qhostinfo.pro
@@ -0,0 +1,13 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qhostinfo
+DEPENDPATH += .
+INCLUDEPATH += .
+
+QT -= gui
+QT += network
+
+CONFIG += release
+
+# Input
+SOURCES += main.cpp
diff --git a/tests/benchmarks/qstringlist/qstringlist.pro b/tests/benchmarks/qstringlist/qstringlist.pro
index f9ebd59..11cceb0 100644
--- a/tests/benchmarks/qstringlist/qstringlist.pro
+++ b/tests/benchmarks/qstringlist/qstringlist.pro
@@ -2,3 +2,5 @@ load(qttest_p4)
TARGET = tst_qstringlist
QT -= gui
SOURCES += main.cpp
+
+symbian: LIBS += -llibpthread
diff --git a/tests/benchmarks/qstylesheetstyle/main.cpp b/tests/benchmarks/qstylesheetstyle/main.cpp
index 19efcab..d6fa48c 100644
--- a/tests/benchmarks/qstylesheetstyle/main.cpp
+++ b/tests/benchmarks/qstylesheetstyle/main.cpp
@@ -49,16 +49,16 @@ class tst_qstylesheetstyle : public QObject
private slots:
void empty();
void empty_events();
-
+
void simple();
void simple_events();
-
+
void grid_data();
void grid();
-
+
private:
QWidget *buildSimpleWidgets();
-
+
};
@@ -103,7 +103,7 @@ void tst_qstylesheetstyle::empty_events()
delete w;
}
-static const char *simple_css =
+static const char *simple_css =
" QLineEdit { background: red; } QPushButton { border: 1px solid yellow; color: pink; } \n"
" QCheckBox { margin: 3px 5px; background-color:red; } QAbstractButton { background-color: #456; } \n"
" QFrame { padding: 3px; } QLabel { color: black } QSpinBox:hover { background-color:blue; } ";
@@ -138,7 +138,7 @@ void tst_qstylesheetstyle::grid_data()
QTest::addColumn<bool>("events");
QTest::addColumn<bool>("show");
QTest::addColumn<int>("N");
- for (int n = 5; n <= 25; n += 5) {
+ for (int n = 5; n <= 25; n += 5) {
const QByteArray nString = QByteArray::number(n*n);
QTest::newRow(("simple--" + nString).constData()) << false << false << n;
QTest::newRow(("events--" + nString).constData()) << true << false << n;
@@ -153,6 +153,13 @@ void tst_qstylesheetstyle::grid()
QFETCH(bool, show);
QFETCH(int, N);
+#ifdef Q_OS_SYMBIAN
+ // Symbian has limited stack (max 80k), which will run out when N >= 20 due to
+ // QWidget::show() using recursion among grid labels somewhere down the line.
+ if (show && N >= 20)
+ QSKIP("Grid too big for device to show", SkipSingle);
+#endif
+
QWidget *w = new QWidget();
QGridLayout *layout = new QGridLayout(w);
w->setLayout(layout);
diff --git a/tests/benchmarks/qtcpserver/qtcpserver.pro b/tests/benchmarks/qtcpserver/qtcpserver.pro
new file mode 100644
index 0000000..e7bf13a
--- /dev/null
+++ b/tests/benchmarks/qtcpserver/qtcpserver.pro
@@ -0,0 +1,13 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qtcpserver
+DEPENDPATH += .
+INCLUDEPATH += .
+
+QT -= gui
+QT += network
+
+CONFIG += release
+
+# Input
+SOURCES += tst_qtcpserver.cpp
diff --git a/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp
new file mode 100644
index 0000000..07640b8
--- /dev/null
+++ b/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp
@@ -0,0 +1,277 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// Just to get Q_OS_SYMBIAN
+#include <qglobal.h>
+
+#include <QtTest/QtTest>
+
+
+#include <qcoreapplication.h>
+#include <qtcpsocket.h>
+#include <qtcpserver.h>
+#include <qhostaddress.h>
+#include <qprocess.h>
+#include <qstringlist.h>
+#include <qplatformdefs.h>
+#include <qhostinfo.h>
+
+#include <QNetworkProxy>
+Q_DECLARE_METATYPE(QNetworkProxy)
+Q_DECLARE_METATYPE(QList<QNetworkProxy>)
+
+#include "../../auto/network-settings.h"
+
+//TESTED_CLASS=
+//TESTED_FILES=
+
+class tst_QTcpServer : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QTcpServer();
+ virtual ~tst_QTcpServer();
+
+
+public slots:
+ void initTestCase_data();
+ void init();
+ void cleanup();
+private slots:
+ void ipv4LoopbackPerformanceTest();
+ void ipv6LoopbackPerformanceTest();
+ void ipv4PerformanceTest();
+};
+
+tst_QTcpServer::tst_QTcpServer()
+{
+ Q_SET_DEFAULT_IAP
+}
+
+tst_QTcpServer::~tst_QTcpServer()
+{
+}
+
+void tst_QTcpServer::initTestCase_data()
+{
+ QTest::addColumn<bool>("setProxy");
+ QTest::addColumn<int>("proxyType");
+
+ QTest::newRow("WithoutProxy") << false << 0;
+ QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
+}
+
+void tst_QTcpServer::init()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy) {
+ QFETCH_GLOBAL(int, proxyType);
+ if (proxyType == QNetworkProxy::Socks5Proxy) {
+ QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
+ }
+ }
+}
+
+void tst_QTcpServer::cleanup()
+{
+ QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
+}
+
+//----------------------------------------------------------------------------------
+void tst_QTcpServer::ipv4LoopbackPerformanceTest()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ QTcpServer server;
+ QVERIFY(server.listen(QHostAddress::LocalHost));
+
+ QVERIFY(server.isListening());
+
+ QTcpSocket clientA;
+ clientA.connectToHost(QHostAddress::LocalHost, server.serverPort());
+ QVERIFY(clientA.waitForConnected(5000));
+ QVERIFY(clientA.state() == QAbstractSocket::ConnectedState);
+
+ QVERIFY(server.waitForNewConnection());
+ QTcpSocket *clientB = server.nextPendingConnection();
+ QVERIFY(clientB);
+
+ QByteArray buffer(16384, '@');
+ QTime stopWatch;
+ stopWatch.start();
+ qlonglong totalWritten = 0;
+ while (stopWatch.elapsed() < 5000) {
+ QVERIFY(clientA.write(buffer.data(), buffer.size()) > 0);
+ clientA.flush();
+ totalWritten += buffer.size();
+ while (clientB->waitForReadyRead(100)) {
+ if (clientB->bytesAvailable() == 16384)
+ break;
+ }
+ clientB->read(buffer.data(), buffer.size());
+ clientB->write(buffer.data(), buffer.size());
+ clientB->flush();
+ totalWritten += buffer.size();
+ while (clientA.waitForReadyRead(100)) {
+ if (clientA.bytesAvailable() == 16384)
+ break;
+ }
+ clientA.read(buffer.data(), buffer.size());
+ }
+
+ qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
+ server.serverAddress().toString().toLatin1().constData(),
+ totalWritten / (1024.0 * 1024.0),
+ stopWatch.elapsed() / 1000.0,
+ (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
+
+ delete clientB;
+}
+
+//----------------------------------------------------------------------------------
+void tst_QTcpServer::ipv6LoopbackPerformanceTest()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian: IPv6 is not yet supported", SkipAll);
+#endif
+ QTcpServer server;
+ if (!server.listen(QHostAddress::LocalHostIPv6, 0)) {
+ QVERIFY(server.serverError() == QAbstractSocket::UnsupportedSocketOperationError);
+ } else {
+ QTcpSocket clientA;
+ clientA.connectToHost(server.serverAddress(), server.serverPort());
+ QVERIFY(clientA.waitForConnected(5000));
+
+ QVERIFY(server.waitForNewConnection(5000));
+ QTcpSocket *clientB = server.nextPendingConnection();
+ QVERIFY(clientB);
+
+ QByteArray buffer(16384, '@');
+ QTime stopWatch;
+ stopWatch.start();
+ qlonglong totalWritten = 0;
+ while (stopWatch.elapsed() < 5000) {
+ clientA.write(buffer.data(), buffer.size());
+ clientA.flush();
+ totalWritten += buffer.size();
+ while (clientB->waitForReadyRead(100)) {
+ if (clientB->bytesAvailable() == 16384)
+ break;
+ }
+ clientB->read(buffer.data(), buffer.size());
+ clientB->write(buffer.data(), buffer.size());
+ clientB->flush();
+ totalWritten += buffer.size();
+ while (clientA.waitForReadyRead(100)) {
+ if (clientA.bytesAvailable() == 16384)
+ break;
+ }
+ clientA.read(buffer.data(), buffer.size());
+ }
+
+ qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
+ server.serverAddress().toString().toLatin1().constData(),
+ totalWritten / (1024.0 * 1024.0),
+ stopWatch.elapsed() / 1000.0,
+ (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
+ delete clientB;
+ }
+}
+
+//----------------------------------------------------------------------------------
+void tst_QTcpServer::ipv4PerformanceTest()
+{
+ QTcpSocket probeSocket;
+ probeSocket.connectToHost(QtNetworkSettings::serverName(), 143);
+ QVERIFY(probeSocket.waitForConnected(5000));
+
+ QTcpServer server;
+ QVERIFY(server.listen(probeSocket.localAddress(), 0));
+
+ QTcpSocket clientA;
+ clientA.connectToHost(server.serverAddress(), server.serverPort());
+ QVERIFY(clientA.waitForConnected(5000));
+
+ QVERIFY(server.waitForNewConnection(5000));
+ QTcpSocket *clientB = server.nextPendingConnection();
+ QVERIFY(clientB);
+
+ QByteArray buffer(16384, '@');
+ QTime stopWatch;
+ stopWatch.start();
+ qlonglong totalWritten = 0;
+ while (stopWatch.elapsed() < 5000) {
+ qlonglong writtenA = clientA.write(buffer.data(), buffer.size());
+ clientA.flush();
+ totalWritten += buffer.size();
+ while (clientB->waitForReadyRead(100)) {
+ if (clientB->bytesAvailable() == writtenA)
+ break;
+ }
+ clientB->read(buffer.data(), buffer.size());
+ qlonglong writtenB = clientB->write(buffer.data(), buffer.size());
+ clientB->flush();
+ totalWritten += buffer.size();
+ while (clientA.waitForReadyRead(100)) {
+ if (clientA.bytesAvailable() == writtenB)
+ break;
+ }
+ clientA.read(buffer.data(), buffer.size());
+ }
+
+ qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
+ probeSocket.localAddress().toString().toLatin1().constData(),
+ totalWritten / (1024.0 * 1024.0),
+ stopWatch.elapsed() / 1000.0,
+ (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
+
+ delete clientB;
+}
+
+QTEST_MAIN(tst_QTcpServer)
+#include "tst_qtcpserver.moc"
diff --git a/tests/benchmarks/qthreadstorage/qthreadstorage.pro b/tests/benchmarks/qthreadstorage/qthreadstorage.pro
new file mode 100644
index 0000000..f9c1978
--- /dev/null
+++ b/tests/benchmarks/qthreadstorage/qthreadstorage.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qthreadstorage
+
+SOURCES += tst_qthreadstorage.cpp
+
diff --git a/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp b/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp
new file mode 100644
index 0000000..c00bf5a
--- /dev/null
+++ b/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtCore>
+
+//TESTED_FILES=
+
+QThreadStorage<int *> dummy[8];
+
+QThreadStorage<QString *> tls1;
+
+class tst_QThreadStorage : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QThreadStorage();
+ virtual ~tst_QThreadStorage();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void construct();
+ void get();
+ void set();
+};
+
+tst_QThreadStorage::tst_QThreadStorage()
+{
+}
+
+tst_QThreadStorage::~tst_QThreadStorage()
+{
+}
+
+void tst_QThreadStorage::init()
+{
+ dummy[1].setLocalData(new int(5));
+ dummy[2].setLocalData(new int(4));
+ dummy[3].setLocalData(new int(3));
+ tls1.setLocalData(new QString());
+}
+
+void tst_QThreadStorage::cleanup()
+{
+}
+
+void tst_QThreadStorage::construct()
+{
+ QBENCHMARK {
+ QThreadStorage<int *> ts;
+ }
+}
+
+
+void tst_QThreadStorage::get()
+{
+ QThreadStorage<int *> ts;
+ ts.setLocalData(new int(45));
+
+ int count = 0;
+ QBENCHMARK {
+ int *i = ts.localData();
+ count += *i;
+ }
+ ts.setLocalData(0);
+}
+
+void tst_QThreadStorage::set()
+{
+ QThreadStorage<int *> ts;
+
+ int count = 0;
+ QBENCHMARK {
+ ts.setLocalData(new int(count));
+ count++;
+ }
+ ts.setLocalData(0);
+}
+
+
+QTEST_MAIN(tst_QThreadStorage)
+#include "tst_qthreadstorage.moc"
diff --git a/tests/manual/qgraphicsitemgroup/customitem.cpp b/tests/manual/qgraphicsitemgroup/customitem.cpp
new file mode 100644
index 0000000..16da0c5
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/customitem.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "customitem.h"
+
+#include <QPainter>
+#include <QStyle>
+#include <QStyleOption>
+
+QList<CustomGroup*> CustomScene::selectedCustomGroups() const
+{
+ QList<QGraphicsItem*> all = selectedItems();
+ QList<CustomGroup*> groups;
+
+ foreach (QGraphicsItem *item, all) {
+ CustomGroup* group = dynamic_cast<CustomGroup*>(item);
+ if (group)
+ groups.append(group);
+ }
+
+ return groups;
+}
+
+QList<CustomItem*> CustomScene::selectedCustomItems() const
+{
+ QList<QGraphicsItem*> all = selectedItems();
+ QList<CustomItem*> items;
+
+ foreach (QGraphicsItem *item, all) {
+ CustomItem* citem = dynamic_cast<CustomItem*>(item);
+ if (citem)
+ items.append(citem);
+ }
+
+ return items;
+}
+
+CustomGroup::CustomGroup() :
+ QGraphicsItemGroup()
+{
+ setFlag(QGraphicsItem::ItemIsMovable);
+ setFlag(QGraphicsItem::ItemIsSelectable);
+}
+
+void CustomGroup::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ if (option->state & QStyle::State_Selected)
+ painter->setOpacity(1.);
+ else
+ painter->setOpacity(0.2);
+
+ painter->setPen(QPen(QColor(100, 100, 100), 2, Qt::DashLine));
+ painter->drawRect(boundingRect().adjusted(-2, -2, 2, 2));
+}
+
+QRectF CustomGroup::boundingRect() const
+{
+ return QGraphicsItemGroup::boundingRect().adjusted(-4, -4, 4 ,4);
+}
+
+CustomItem::CustomItem(qreal x, qreal y, qreal width, qreal height, const QBrush &brush) :
+ QGraphicsRectItem(x, y, width, height)
+{
+ setFlag(QGraphicsItem::ItemIsMovable);
+ setFlag(QGraphicsItem::ItemIsSelectable);
+ setBrush(brush);
+ setPen(Qt::NoPen);
+ setTransformOriginPoint(boundingRect().center());
+}
diff --git a/tests/manual/qgraphicsitemgroup/customitem.h b/tests/manual/qgraphicsitemgroup/customitem.h
new file mode 100644
index 0000000..387c8ce
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/customitem.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CUSTOMITEM_H
+#define CUSTOMITEM_H
+
+#include <QGraphicsItem>
+#include <QBrush>
+#include <QGraphicsScene>
+
+class CustomGroup : public QGraphicsItemGroup
+{
+public:
+ CustomGroup();
+ virtual ~CustomGroup() { }
+
+protected:
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ virtual QRectF boundingRect() const;
+};
+
+class CustomItem : public QGraphicsRectItem
+{
+public:
+ CustomItem(qreal x, qreal y, qreal width, qreal height, const QBrush & brush = QBrush());
+ virtual ~CustomItem() { }
+};
+
+class CustomScene : public QGraphicsScene
+{
+ Q_OBJECT
+public:
+ CustomScene() : QGraphicsScene() { }
+
+ QList<CustomItem*> selectedCustomItems() const;
+ QList<CustomGroup*> selectedCustomGroups() const;
+};
+
+#endif // CUSTOMITEM_H
diff --git a/tests/manual/qgraphicsitemgroup/main.cpp b/tests/manual/qgraphicsitemgroup/main.cpp
new file mode 100644
index 0000000..e7a6e11
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+#include "widget.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ Widget w;
+ w.show();
+ return a.exec();
+}
diff --git a/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro b/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro
new file mode 100644
index 0000000..6676a2e
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro
@@ -0,0 +1,8 @@
+TARGET = qgraphicsitemgroup
+TEMPLATE = app
+SOURCES += main.cpp \
+ widget.cpp \
+ customitem.cpp
+HEADERS += widget.h \
+ customitem.h
+FORMS += widget.ui
diff --git a/tests/manual/qgraphicsitemgroup/widget.cpp b/tests/manual/qgraphicsitemgroup/widget.cpp
new file mode 100644
index 0000000..23bee3f
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/widget.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "widget.h"
+#include "ui_widget.h"
+#include <QGraphicsOpacityEffect>
+#include <QPropertyAnimation>
+
+Widget::Widget(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::Widget),
+ previousSelectionCount(0)
+{
+ ui->setupUi(this);
+
+ effect = new QGraphicsOpacityEffect;
+ effect->setOpacity(0.3);
+ ui->groupBox->setGraphicsEffect(effect);
+
+ fadeIn = new QPropertyAnimation(effect, "opacity");
+ fadeIn->setDuration(200);
+ fadeIn->setStartValue(0.3);
+ fadeIn->setEndValue(1.);
+
+ fadeOut = new QPropertyAnimation(effect, "opacity");
+ fadeOut->setDuration(200);
+ fadeOut->setStartValue(1.);
+ fadeOut->setEndValue(0.3);
+
+ scene = new CustomScene;
+ scene->setSceneRect(-250,-250,500,500);
+ ui->view->setScene(scene);
+ scene->setBackgroundBrush(Qt::white);
+ ui->view->setInteractive(true);
+ ui->view->setDragMode(QGraphicsView::RubberBandDrag);
+ ui->view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+ ui->view->setRenderHints( QPainter::SmoothPixmapTransform |
+ QPainter::TextAntialiasing |
+ QPainter::Antialiasing );
+
+ rectBlue = new CustomItem(-100, -100, 50, 50, QColor(80, 80, 200));
+ scene->addItem(rectBlue);
+ rectGreen = new CustomItem(100, -100, 50, 50, QColor(80, 200, 80));
+ scene->addItem(rectGreen);
+ rectRed = new CustomItem(-100, 100, 50, 50, QColor(200, 80, 80));
+ scene->addItem(rectRed);
+ rectYellow = new CustomItem(100, 100, 50, 50, QColor(200, 200, 20));
+ scene->addItem(rectYellow);
+
+ connect(scene, SIGNAL(selectionChanged()), this, SLOT(onSceneSelectionChanged()));
+}
+
+Widget::~Widget()
+{
+ delete ui;
+ delete fadeIn;
+ delete fadeOut;
+}
+
+void Widget::on_rotate_valueChanged(int value)
+{
+ if (scene->selectedItems().count() != 1)
+ return;
+
+ QGraphicsItem *item = scene->selectedItems().at(0);
+ item->setRotation(value);
+ ui->rotateItem->setValue(checkedItem()->rotation());
+}
+
+void Widget::on_scale_valueChanged(int value)
+{
+ if (scene->selectedItems().count() != 1)
+ return;
+
+ QGraphicsItem *item = scene->selectedItems().at(0);
+ item->setScale(value / 10.);
+ ui->scaleItem->setValue(checkedItem()->scale() * 10);
+}
+
+void Widget::on_rotateItem_valueChanged(int value)
+{
+ if (!scene->selectedItems().empty() && scene->selectedItems().at(0) == checkedItem())
+ ui->rotate->setValue(value);
+ else
+ checkedItem()->setRotation(value);
+}
+
+void Widget::on_scaleItem_valueChanged(int value)
+{
+ if (!scene->selectedItems().empty() && scene->selectedItems().at(0) == checkedItem())
+ ui->scale->setValue(value);
+ else
+ checkedItem()->setScale(value / 10.);
+}
+
+void Widget::on_group_clicked()
+{
+ QList<QGraphicsItem*> all = scene->selectedItems();
+ if (all.size() < 2)
+ return;
+
+ QList<CustomItem*> items = scene->selectedCustomItems();
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+
+ if (groups.size() == 1) {
+ foreach (CustomItem *item, items) {
+ item->setSelected(false);
+ groups[0]->addToGroup(item);
+ }
+
+ return;
+ }
+
+ CustomGroup* group = new CustomGroup;
+ scene->addItem(group);
+ foreach (QGraphicsItem *item, all) {
+ item->setSelected(false);
+ group->addToGroup(item);
+ }
+ group->setSelected(true);
+
+ updateUngroupButton();
+}
+
+void Widget::on_dismantle_clicked()
+{
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+
+ foreach (CustomGroup *group, groups) {
+ foreach (QGraphicsItem *item, group->childItems())
+ group->removeFromGroup(item);
+
+ delete group;
+ }
+
+ updateUngroupButton();
+}
+
+void Widget::on_merge_clicked()
+{
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+ if (groups.size() < 2)
+ return;
+
+ CustomGroup *newBigGroup = groups.takeFirst();
+ foreach (CustomGroup *group, groups) {
+ foreach (QGraphicsItem *item, group->childItems())
+ item->setGroup(newBigGroup);
+
+ delete group;
+ }
+}
+
+void Widget::onSceneSelectionChanged()
+{
+ QList<QGraphicsItem*> all = scene->selectedItems();
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+
+ if (all.empty() && all.count() != previousSelectionCount) {
+ fadeOut->start();
+ } else if (previousSelectionCount == 0) {
+ fadeIn->start();
+ }
+
+ if (all.count() == 1) {
+ QGraphicsItem *item = all.at(0);
+ ui->rotate->setValue(item->rotation());
+ ui->scale->setValue(item->scale() * 10);
+ } else {
+ ui->rotate->setValue(ui->rotate->minimum());
+ ui->scale->setValue(ui->scale->minimum());
+ }
+
+ ui->rotate->setEnabled(all.size() == 1);
+ ui->scale->setEnabled(all.size() == 1);
+ ui->group->setEnabled(all.size() > 1);
+ ui->dismantle->setEnabled(!groups.empty());
+ ui->merge->setEnabled(groups.size() > 1);
+
+ previousSelectionCount = all.size();
+
+ updateUngroupButton();
+}
+
+void Widget::on_ungroup_clicked()
+{
+ QGraphicsItemGroup *oldGroup = checkedItem()->group();
+ checkedItem()->setGroup(0);
+ if (oldGroup && oldGroup->childItems().empty())
+ delete oldGroup;
+
+ updateUngroupButton();
+}
+
+void Widget::updateUngroupButton()
+{
+ ui->ungroup->setEnabled(checkedItem()->group() != 0);
+}
+
+CustomItem * Widget::checkedItem() const
+{
+ CustomItem *item;
+
+ if (ui->blue->isChecked())
+ item = rectBlue;
+ else if (ui->red->isChecked())
+ item = rectRed;
+ else if (ui->green->isChecked())
+ item = rectGreen;
+ else if (ui->yellow->isChecked())
+ item = rectYellow;
+
+ return item;
+}
+
+void Widget::on_buttonGroup_buttonClicked()
+{
+ ui->rotateItem->setValue(checkedItem()->rotation());
+ ui->scaleItem->setValue(checkedItem()->scale() * 10);
+
+ updateUngroupButton();
+}
diff --git a/tests/manual/qgraphicsitemgroup/widget.h b/tests/manual/qgraphicsitemgroup/widget.h
new file mode 100644
index 0000000..affc436
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/widget.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include "customitem.h"
+
+#include <QWidget>
+#include <QGraphicsItemGroup>
+#include <QPainter>
+
+namespace Ui {
+ class Widget;
+}
+
+class QGraphicsOpacityEffect;
+class QPropertyAnimation;
+
+class Widget : public QWidget
+{
+ Q_OBJECT
+public:
+ Widget(QWidget *parent = 0);
+ ~Widget();
+
+protected Q_SLOTS:
+ void on_rotate_valueChanged(int value);
+ void on_scale_valueChanged(int value);
+ void on_rotateItem_valueChanged(int value);
+ void on_scaleItem_valueChanged(int value);
+ void on_group_clicked();
+ void on_dismantle_clicked();
+ void on_merge_clicked();
+ void onSceneSelectionChanged();
+ void on_ungroup_clicked();
+ void on_buttonGroup_buttonClicked();
+
+private:
+ void updateUngroupButton();
+ CustomItem * checkedItem() const;
+
+ Ui::Widget *ui;
+ CustomScene *scene;
+ CustomItem *rectBlue;
+ CustomItem *rectRed;
+ CustomItem *rectGreen;
+ CustomItem *rectYellow;
+ QGraphicsOpacityEffect* effect;
+ QPropertyAnimation *fadeIn;
+ QPropertyAnimation *fadeOut;
+ int previousSelectionCount;
+};
+
+#endif // WIDGET_H
diff --git a/tests/manual/qgraphicsitemgroup/widget.ui b/tests/manual/qgraphicsitemgroup/widget.ui
new file mode 100644
index 0000000..7e3a4df
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/widget.ui
@@ -0,0 +1,319 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Widget</class>
+ <widget class="QWidget" name="Widget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>782</width>
+ <height>695</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Widget</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Items</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QRadioButton" name="blue">
+ <property name="text">
+ <string>Blue</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="red">
+ <property name="text">
+ <string>Red</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="green">
+ <property name="text">
+ <string>Green</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="yellow">
+ <property name="text">
+ <string>Yellow</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Rotate</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="rotateItem">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>360</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Scale</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="scaleItem">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <number>30</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QPushButton" name="ungroup">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Ungroup</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>50</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>164</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>300</width>
+ <height>164</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Selection</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Rotate</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="rotate">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>360</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Scale</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="scale">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <number>30</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QPushButton" name="group">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Group</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="merge">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Merge Groups</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="dismantle">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Dismantle Group</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <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="QGraphicsView" name="view"/>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+ <buttongroups>
+ <buttongroup name="buttonGroup"/>
+ </buttongroups>
+</ui>