summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-06-18 15:31:28 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-06-18 15:31:28 (GMT)
commit1fa6b99c373e0dab9e0a0b7f190e3085190be668 (patch)
tree1c5181e125a7ebae7b10d8a3fbb53e1cf0e63b3a /tests/auto
parenta18e5288324aa13da014ee52daffbfc589c87be3 (diff)
parentf9f08de9d41fd55d9c7d01578191ef5d4099c9e6 (diff)
downloadQt-1fa6b99c373e0dab9e0a0b7f190e3085190be668.zip
Qt-1fa6b99c373e0dab9e0a0b7f190e3085190be668.tar.gz
Qt-1fa6b99c373e0dab9e0a0b7f190e3085190be668.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into qt-main/qgraphicssceneindex
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/mediaobject/tst_mediaobject.cpp23
-rw-r--r--tests/auto/modeltest/modeltest.cpp4
-rw-r--r--tests/auto/qaccessibility_mac/tst_qaccessibility_mac.cpp18
-rw-r--r--tests/auto/qanimationgroup/tst_qanimationgroup.cpp26
-rw-r--r--tests/auto/qfontdialog/tst_qfontdialog.cpp26
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp2
-rw-r--r--tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro1
-rw-r--r--tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro1
-rw-r--r--tests/auto/qinputdialog/tst_qinputdialog.cpp25
-rw-r--r--tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp38
-rw-r--r--tests/auto/qmenubar/tst_qmenubar.cpp36
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp19
-rw-r--r--tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp22
-rw-r--r--tests/auto/qpathclipper/tst_qpathclipper.cpp20
-rw-r--r--tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp16
-rw-r--r--tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp57
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp41
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp64
-rw-r--r--tests/auto/qtabbar/tst_qtabbar.cpp2
-rw-r--r--tests/auto/windowsmobile/test/tst_windowsmobile.cpp2
20 files changed, 337 insertions, 106 deletions
diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp
index c1a69f7..f04a4d7 100644
--- a/tests/auto/mediaobject/tst_mediaobject.cpp
+++ b/tests/auto/mediaobject/tst_mediaobject.cpp
@@ -148,6 +148,7 @@ class tst_MediaObject : public QObject
void testPlayBeforeFinish();
void testPauseOnFinish();
void testReconnectBetweenTwoMediaObjects();
+ void volumeSliderMuteVisibility();
void cleanupTestCase();
private:
void _startPlayback(Phonon::State currentState = Phonon::StoppedState);
@@ -937,6 +938,28 @@ void tst_MediaObject::_testOneSeek(qint64 seekTo)
m_success = true;
}
+void tst_MediaObject::volumeSliderMuteVisibility()
+{
+ //this test doesn't really belong to mediaobject
+ // ### see if we should create a realy Phonon::VolumeSlider autotest
+ Phonon::VolumeSlider slider;
+ QVERIFY(slider.isMuteVisible()); // that is the default value
+ slider.setMuteVisible(true);
+ QVERIFY(slider.isMuteVisible());
+
+ //let's check that changing the visibility of the slider itself
+ //doesn't change what the slider reports
+ slider.setVisible(false);
+ QVERIFY(slider.isMuteVisible());
+ slider.setVisible(true);
+
+ slider.setMuteVisible(false);
+ QVERIFY(!slider.isMuteVisible());
+ slider.setMuteVisible(true);
+ QVERIFY(slider.isMuteVisible());
+}
+
+
#endif //QT_NO_PHONON
diff --git a/tests/auto/modeltest/modeltest.cpp b/tests/auto/modeltest/modeltest.cpp
index 68b723f..c4cc820 100644
--- a/tests/auto/modeltest/modeltest.cpp
+++ b/tests/auto/modeltest/modeltest.cpp
@@ -475,7 +475,7 @@ 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 ).value<QString>()
+ 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;
@@ -496,7 +496,7 @@ 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 ).value<QString>() << "current rowcount of parent=" << model->rowCount ( parent );
+ << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
for (int ii=start; ii <= end; ii++)
{
diff --git a/tests/auto/qaccessibility_mac/tst_qaccessibility_mac.cpp b/tests/auto/qaccessibility_mac/tst_qaccessibility_mac.cpp
index b81fa12..deb6c8d 100644
--- a/tests/auto/qaccessibility_mac/tst_qaccessibility_mac.cpp
+++ b/tests/auto/qaccessibility_mac/tst_qaccessibility_mac.cpp
@@ -833,9 +833,14 @@ void tst_accessibility_mac::testTabWidget()
// Window is not reported properly on 10.5
if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5) {
QVERIFY(equal(window(tabGroup), form));
- QVERIFY(equal(window(tabButton1), form));
+
+ // ### hangs on 10.4
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
+ QVERIFY(equal(window(tabButton1), form));
+#endif
}
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+// ### hangs on 10.4
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
QVERIFY(equal(topLevelUIElement(tabGroup), form));
QVERIFY(equal(topLevelUIElement(tabButton1), form));
#endif
@@ -1423,7 +1428,6 @@ void tst_accessibility_mac::testListView()
const AXUIElementRef listElement = childByRole(scrollAreaElement, "AXList");
QVERIFY(listElement);
QVERIFY(equal(::parent(listElement), scrollAreaElement));
-
// Window is not reported properly on 10.5
if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5)
QVERIFY(equal(::window(listElement), windowElement));
@@ -1438,9 +1442,11 @@ void tst_accessibility_mac::testListView()
QVERIFY(value(A) == "A");
QVERIFY(equal(::parent(A), listElement));
QVERIFY(enabled(A));
- // Window is not reported properly on 10.5
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5)
- QVERIFY(equal(::window(A), windowElement));
+
+ // Window is not reported properly on 10.5, this test
+ // hangs on 10.4. Disable it for now.
+ // if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5)
+ // QVERIFY(equal(::window(A), windowElement));
QVERIFY(above(A, B));
QVERIFY(!above(B, A));
diff --git a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp
index 0457f8f..0e98797 100644
--- a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp
+++ b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp
@@ -206,9 +206,9 @@ void tst_QAnimationGroup::setCurrentTime()
// sequence operating on same object/property
QSequentialAnimationGroup *sequence = new QSequentialAnimationGroup();
- QVariantAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value");
- QVariantAnimation *a2_s_o1 = new QPropertyAnimation(&s_o1, "value");
- QVariantAnimation *a3_s_o1 = new QPropertyAnimation(&s_o1, "value");
+ QAbstractAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value");
+ QAbstractAnimation *a2_s_o1 = new QPropertyAnimation(&s_o1, "value");
+ QAbstractAnimation *a3_s_o1 = new QPropertyAnimation(&s_o1, "value");
a2_s_o1->setLoopCount(3);
sequence->addAnimation(a1_s_o1);
sequence->addAnimation(a2_s_o1);
@@ -216,25 +216,25 @@ void tst_QAnimationGroup::setCurrentTime()
// sequence operating on different object/properties
QAnimationGroup *sequence2 = new QSequentialAnimationGroup();
- QVariantAnimation *a1_s_o2 = new QPropertyAnimation(&s_o2, "value");
- QVariantAnimation *a1_s_o3 = new QPropertyAnimation(&s_o3, "value");
+ QAbstractAnimation *a1_s_o2 = new QPropertyAnimation(&s_o2, "value");
+ QAbstractAnimation *a1_s_o3 = new QPropertyAnimation(&s_o3, "value");
sequence2->addAnimation(a1_s_o2);
sequence2->addAnimation(a1_s_o3);
// parallel operating on different object/properties
QAnimationGroup *parallel = new QParallelAnimationGroup();
- QVariantAnimation *a1_p_o1 = new QPropertyAnimation(&p_o1, "value");
- QVariantAnimation *a1_p_o2 = new QPropertyAnimation(&p_o2, "value");
- QVariantAnimation *a1_p_o3 = new QPropertyAnimation(&p_o3, "value");
+ QAbstractAnimation *a1_p_o1 = new QPropertyAnimation(&p_o1, "value");
+ QAbstractAnimation *a1_p_o2 = new QPropertyAnimation(&p_o2, "value");
+ QAbstractAnimation *a1_p_o3 = new QPropertyAnimation(&p_o3, "value");
a1_p_o2->setLoopCount(3);
parallel->addAnimation(a1_p_o1);
parallel->addAnimation(a1_p_o2);
parallel->addAnimation(a1_p_o3);
- UncontrolledAnimation *notTimeDriven = new UncontrolledAnimation(&t_o1, "value");
+ QAbstractAnimation *notTimeDriven = new UncontrolledAnimation(&t_o1, "value");
QCOMPARE(notTimeDriven->totalDuration(), -1);
- QVariantAnimation *loopsForever = new QPropertyAnimation(&t_o2, "value");
+ QAbstractAnimation *loopsForever = new QPropertyAnimation(&t_o2, "value");
loopsForever->setLoopCount(-1);
QCOMPARE(loopsForever->totalDuration(), -1);
@@ -318,7 +318,7 @@ void tst_QAnimationGroup::setParentAutoAdd()
{
QParallelAnimationGroup group;
QVariantAnimation *animation = new QPropertyAnimation(&group);
- QCOMPARE(animation->group(), &group);
+ QCOMPARE(animation->group(), static_cast<QAnimationGroup*>(&group));
}
void tst_QAnimationGroup::beginNestedGroup()
@@ -347,8 +347,8 @@ void tst_QAnimationGroup::beginNestedGroup()
void tst_QAnimationGroup::addChildTwice()
{
- QPropertyAnimation *subGroup;
- QPropertyAnimation *subGroup2;
+ QAbstractAnimation *subGroup;
+ QAbstractAnimation *subGroup2;
QAnimationGroup *parent = new QSequentialAnimationGroup();
subGroup = new QPropertyAnimation();
diff --git a/tests/auto/qfontdialog/tst_qfontdialog.cpp b/tests/auto/qfontdialog/tst_qfontdialog.cpp
index c12c229..1444ee0 100644
--- a/tests/auto/qfontdialog/tst_qfontdialog.cpp
+++ b/tests/auto/qfontdialog/tst_qfontdialog.cpp
@@ -47,7 +47,9 @@
#include <qfontinfo.h>
#include <qtimer.h>
#include <qmainwindow.h>
+#include <qlistview.h>
#include "qfontdialog.h"
+#include <private/qfontdialog_p.h>
//TESTED_CLASS=
//TESTED_FILES=
@@ -74,6 +76,7 @@ public slots:
private slots:
void defaultOkButton();
void setFont();
+ void task256466_wrongStyle();
};
tst_QFontDialog::tst_QFontDialog()
@@ -151,6 +154,29 @@ void tst_QFontDialog::setFont()
}
+class FriendlyFontDialog : public QFontDialog
+{
+ friend tst_QFontDialog;
+ Q_DECLARE_PRIVATE(QFontDialog);
+};
+
+void tst_QFontDialog::task256466_wrongStyle()
+{
+ QFontDatabase fdb;
+ FriendlyFontDialog dialog;
+ QListView *familyList = reinterpret_cast<QListView*>(dialog.d_func()->familyList);
+ QListView *styleList = reinterpret_cast<QListView*>(dialog.d_func()->styleList);
+ QListView *sizeList = reinterpret_cast<QListView*>(dialog.d_func()->sizeList);
+ for (int i = 0; i < familyList->model()->rowCount(); ++i) {
+ QModelIndex currentFamily = familyList->model()->index(i, 0);
+ familyList->setCurrentIndex(currentFamily);
+ QCOMPARE(dialog.currentFont(), fdb.font(currentFamily.data().toString(),
+ styleList->currentIndex().data().toString(), sizeList->currentIndex().data().toInt()));
+ }
+}
+
+
+
QTEST_MAIN(tst_QFontDialog)
#include "tst_qfontdialog.moc"
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 2b936d6..1ca6c98 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -3952,7 +3952,7 @@ void tst_QGraphicsItem::itemChange()
QCOMPARE(tester.changes.size(), changeCount);
QCOMPARE(tester.changes.at(tester.changes.size() - 2), QGraphicsItem::ItemFlagsChange);
QCOMPARE(tester.changes.at(tester.changes.size() - 1), QGraphicsItem::ItemFlagsHaveChanged);
- QVariant expectedFlags = qVariantFromValue<quint32>(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges);
+ QVariant expectedFlags = qVariantFromValue<quint32>(QGraphicsItem::GraphicsItemFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges));
QCOMPARE(tester.values.at(tester.values.size() - 2), expectedFlags);
QCOMPARE(tester.values.at(tester.values.size() - 1), qVariantFromValue<quint32>(QGraphicsItem::ItemIsSelectable));
}
diff --git a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
index bc750c5..3283873 100644
--- a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
+++ b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
SOURCES += tst_qhttpnetworkconnection.cpp
+INCLUDEPATH += $$(QTDIR)/src/3rdparty/zlib
QT = core network
diff --git a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro
index 9593c55..0755055 100644
--- a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro
+++ b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
SOURCES += tst_qhttpnetworkreply.cpp
+INCLUDEPATH += $$(QTDIR)/src/3rdparty/zlib
QT = core network
diff --git a/tests/auto/qinputdialog/tst_qinputdialog.cpp b/tests/auto/qinputdialog/tst_qinputdialog.cpp
index a658aeb..7e4b828 100644
--- a/tests/auto/qinputdialog/tst_qinputdialog.cpp
+++ b/tests/auto/qinputdialog/tst_qinputdialog.cpp
@@ -56,6 +56,7 @@ class tst_QInputDialog : public QObject
{
Q_OBJECT
QWidget *parent;
+ QDialog::DialogCode doneCode;
void (*testFunc)(QInputDialog *);
static void testFuncGetInteger(QInputDialog *dialog);
static void testFuncGetDouble(QInputDialog *dialog);
@@ -72,6 +73,7 @@ private slots:
void getText();
void getItem_data();
void getItem();
+ void task256299_getTextReturnNullStringOnRejected();
};
QString stripFraction(const QString &s)
@@ -245,8 +247,9 @@ void tst_QInputDialog::timerEvent(QTimerEvent *event)
killTimer(event->timerId());
QInputDialog *dialog = qFindChild<QInputDialog *>(parent);
Q_ASSERT(dialog);
- testFunc(dialog);
- dialog->done(QDialog::Accepted); // cause static function call to return
+ if (testFunc)
+ testFunc(dialog);
+ dialog->done(doneCode); // cause static function call to return
}
void tst_QInputDialog::getInteger_data()
@@ -266,6 +269,7 @@ void tst_QInputDialog::getInteger()
QFETCH(int, max);
Q_ASSERT(min < max);
parent = new QWidget;
+ doneCode = QDialog::Accepted;
testFunc = &tst_QInputDialog::testFuncGetInteger;
startTimer(0);
bool ok = false;
@@ -305,6 +309,7 @@ void tst_QInputDialog::getDouble()
QFETCH(int, decimals);
Q_ASSERT(min < max && decimals >= 0 && decimals <= 13);
parent = new QWidget;
+ doneCode = QDialog::Accepted;
testFunc = &tst_QInputDialog::testFuncGetDouble;
startTimer(0);
bool ok = false;
@@ -322,6 +327,7 @@ void tst_QInputDialog::getDouble()
void tst_QInputDialog::task255502getDouble()
{
parent = new QWidget;
+ doneCode = QDialog::Accepted;
testFunc = &tst_QInputDialog::testFuncGetDouble;
startTimer(0);
bool ok = false;
@@ -347,6 +353,7 @@ void tst_QInputDialog::getText()
{
QFETCH(QString, text);
parent = new QWidget;
+ doneCode = QDialog::Accepted;
testFunc = &tst_QInputDialog::testFuncGetText;
startTimer(0);
bool ok = false;
@@ -356,6 +363,19 @@ void tst_QInputDialog::getText()
delete parent;
}
+void tst_QInputDialog::task256299_getTextReturnNullStringOnRejected()
+{
+ parent = new QWidget;
+ doneCode = QDialog::Rejected;
+ testFunc = 0;
+ startTimer(0);
+ bool ok = true;
+ const QString result = QInputDialog::getText(parent, "", "", QLineEdit::Normal, "foobar", &ok);
+ QVERIFY(!ok);
+ QVERIFY(result.isNull());
+ delete parent;
+}
+
void tst_QInputDialog::getItem_data()
{
QTest::addColumn<QStringList>("items");
@@ -373,6 +393,7 @@ void tst_QInputDialog::getItem()
QFETCH(QStringList, items);
QFETCH(bool, editable);
parent = new QWidget;
+ doneCode = QDialog::Accepted;
testFunc = &tst_QInputDialog::testFuncGetItem;
startTimer(0);
bool ok = false;
diff --git a/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp b/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp
index 5540b38..d9a7d56 100644
--- a/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp
+++ b/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp
@@ -61,16 +61,40 @@ void tst_QItemEditorFactory::createEditor()
void tst_QItemEditorFactory::createCustomEditor()
{
- QItemEditorFactory editorFactory;
+ //we make it inherit from QObject so that we can use QPointer
+ class MyEditor : public QObject, public QStandardItemEditorCreator<QDoubleSpinBox>
+ {
+ };
- QItemEditorCreatorBase *creator = new QStandardItemEditorCreator<QDoubleSpinBox>();
- editorFactory.registerEditor(QVariant::Rect, creator);
+ QPointer<MyEditor> creator = new MyEditor;
+ QPointer<MyEditor> creator2 = new MyEditor;
- QWidget parent;
+ {
+ QItemEditorFactory editorFactory;
+
+ editorFactory.registerEditor(QVariant::Rect, creator);
+ editorFactory.registerEditor(QVariant::RectF, creator);
+
+ //creator should not be deleted as a result of calling the next line
+ editorFactory.registerEditor(QVariant::Rect, creator2);
+ QVERIFY(creator);
+
+ //this should erase creator2
+ editorFactory.registerEditor(QVariant::Rect, creator);
+ QVERIFY(creator2.isNull());
+
+
+ QWidget parent;
+
+ QWidget *w = editorFactory.createEditor(QVariant::Rect, &parent);
+ QCOMPARE(w->metaObject()->className(), "QDoubleSpinBox");
+ QCOMPARE(w->metaObject()->userProperty().type(), QVariant::Double);
+ }
- QWidget *w = editorFactory.createEditor(QVariant::Rect, &parent);
- QCOMPARE(w->metaObject()->className(), "QDoubleSpinBox");
- QCOMPARE(w->metaObject()->userProperty().type(), QVariant::Double);
+ //editorFactory has been deleted, so should be creator
+ //because editorFActory has the ownership
+ QVERIFY(creator.isNull());
+ QVERIFY(creator2.isNull());
delete creator;
}
diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp
index 5404d46..8a38782 100644
--- a/tests/auto/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/qmenubar/tst_qmenubar.cpp
@@ -149,6 +149,7 @@ private slots:
void check_shortcutPress();
void check_menuPosition();
void task223138_triggered();
+ void task256322_highlight();
#if defined(QT3_SUPPORT)
void indexBasedInsertion_data();
@@ -1520,6 +1521,41 @@ void tst_QMenuBar::task223138_triggered()
QCOMPARE(submenuSpy.count(), 1);
}
+void tst_QMenuBar::task256322_highlight()
+{
+ QMainWindow win;
+ QMenu menu;
+ QAction *file = win.menuBar()->addMenu(&menu);
+ file->setText("file");
+ QMenu menu2;
+ QAction *file2 = win.menuBar()->addMenu(&menu2);
+ file2->setText("file2");
+ QAction *nothing = win.menuBar()->addAction("nothing");
+
+ win.show();
+
+ QTest::mouseClick(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file).center());
+ QVERIFY(menu.isVisible());
+ QVERIFY(!menu2.isVisible());
+ QCOMPARE(win.menuBar()->activeAction(), file);
+
+ QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(file2).center());
+ QVERIFY(!menu.isVisible());
+ QVERIFY(menu2.isVisible());
+ QCOMPARE(win.menuBar()->activeAction(), file2);
+
+ QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(nothing).center());
+ QVERIFY(!menu.isVisible());
+ QVERIFY(!menu2.isVisible());
+ QCOMPARE(win.menuBar()->activeAction(), nothing);
+
+ QTest::mouseMove(&win, win.menuBar()->geometry().bottomLeft() + QPoint(1,1));
+
+ QVERIFY(!menu.isVisible());
+ QVERIFY(!menu2.isVisible());
+ QVERIFY(!win.menuBar()->activeAction());
+}
+
#if defined(QT3_SUPPORT)
void tst_QMenuBar::indexBasedInsertion_data()
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 3f36729..7e42da8 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -228,6 +228,7 @@ private slots:
void zeroOpacity();
void clippingBug();
+ void emptyClip();
private:
void fillData();
@@ -4218,5 +4219,23 @@ void tst_QPainter::clippingBug()
QCOMPARE(img, expected);
}
+void tst_QPainter::emptyClip()
+{
+ QImage img(64, 64, QImage::Format_ARGB32_Premultiplied);
+ QPainter p(&img);
+ p.setRenderHints(QPainter::Antialiasing);
+ p.setClipRect(0, 32, 64, 0);
+ p.fillRect(0, 0, 64, 64, Qt::white);
+
+ QPainterPath path;
+ path.lineTo(64, 0);
+ path.lineTo(64, 64);
+ path.lineTo(40, 64);
+ path.lineTo(40, 80);
+ path.lineTo(0, 80);
+
+ p.fillPath(path, Qt::green);
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"
diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
index 9f66fe0..d7d6b88 100644
--- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
+++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
@@ -253,16 +253,16 @@ void tst_QParallelAnimationGroup::setCurrentTime()
void tst_QParallelAnimationGroup::clearGroup()
{
QParallelAnimationGroup group;
+ static const int animationCount = 10;
- for (int i = 0; i < 10; ++i) {
+ for (int i = 0; i < animationCount; ++i) {
new QParallelAnimationGroup(&group);
}
- QCOMPARE(group.animationCount(), 10);
+ QCOMPARE(group.animationCount(), animationCount);
- int count = group.animationCount();
- QPointer<QAbstractAnimation> *children = new QPointer<QAbstractAnimation>[count];
- for (int i = 0; i < count; ++i) {
+ QPointer<QAbstractAnimation> children[animationCount];
+ for (int i = 0; i < animationCount; ++i) {
QVERIFY(group.animationAt(i) != 0);
children[i] = group.animationAt(i);
}
@@ -270,10 +270,8 @@ void tst_QParallelAnimationGroup::clearGroup()
group.clearAnimations();
QCOMPARE(group.animationCount(), 0);
QCOMPARE(group.currentTime(), 0);
- for (int i = 0; i < count; ++i)
- QCOMPARE(children[i], QPointer<QAbstractAnimation>());
-
- delete[] children;
+ for (int i = 0; i < animationCount; ++i)
+ QVERIFY(children[i].isNull());
}
void tst_QParallelAnimationGroup::propagateGroupUpdateToChildren()
@@ -807,15 +805,15 @@ void tst_QParallelAnimationGroup::autoAdd()
QParallelAnimationGroup group;
QCOMPARE(group.duration(), 0);
TestAnimation2 *test = new TestAnimation2(250, &group); // 0, duration = 250;
- QCOMPARE(test->group(), &group);
+ QCOMPARE(test->group(), static_cast<QAnimationGroup*>(&group));
QCOMPARE(test->duration(), 250);
QCOMPARE(group.duration(), 250);
test = new TestAnimation2(750, &group); // 1
- QCOMPARE(test->group(), &group);
+ QCOMPARE(test->group(), static_cast<QAnimationGroup*>(&group));
QCOMPARE(group.duration(), 750);
test = new TestAnimation2(500, &group); // 2
- QCOMPARE(test->group(), &group);
+ QCOMPARE(test->group(), static_cast<QAnimationGroup*>(&group));
QCOMPARE(group.duration(), 750);
delete group.animationAt(1); // remove the one with duration = 750
diff --git a/tests/auto/qpathclipper/tst_qpathclipper.cpp b/tests/auto/qpathclipper/tst_qpathclipper.cpp
index f3077ee..6e6b632 100644
--- a/tests/auto/qpathclipper/tst_qpathclipper.cpp
+++ b/tests/auto/qpathclipper/tst_qpathclipper.cpp
@@ -93,6 +93,7 @@ private slots:
void task204301();
void task209056();
+ void task251909();
};
Q_DECLARE_METATYPE(QPainterPath)
@@ -1397,6 +1398,25 @@ void tst_QPathClipper::task209056()
QVERIFY(p3 != QPainterPath());
}
+void tst_QPathClipper::task251909()
+{
+ QPainterPath p1;
+ p1.moveTo(0, -10);
+ p1.lineTo(10, -10);
+ p1.lineTo(10, 0);
+ p1.lineTo(0, 0);
+
+ QPainterPath p2;
+ p2.moveTo(0, 8e-14);
+ p2.lineTo(10, -8e-14);
+ p2.lineTo(10, 10);
+ p2.lineTo(0, 10);
+
+ QPainterPath result = p1.united(p2);
+
+ QVERIFY(result.elementCount() <= 5);
+}
+
QTEST_APPLESS_MAIN(tst_QPathClipper)
diff --git a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp
index 5d9f56f..cbdaf1e 100644
--- a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp
+++ b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp
@@ -111,9 +111,11 @@ void tst_QScriptEngineDebugger::attachAndDetach()
{
{
QScriptEngineDebugger debugger;
+ QCOMPARE(debugger.state(), QScriptEngineDebugger::SuspendedState);
debugger.attachTo(0);
QScriptEngine engine;
debugger.attachTo(&engine);
+ QCOMPARE(debugger.state(), QScriptEngineDebugger::SuspendedState);
}
{
QScriptEngineDebugger debugger;
@@ -129,11 +131,9 @@ void tst_QScriptEngineDebugger::attachAndDetach()
QVERIFY(!engine.globalObject().property("print").strictlyEquals(oldPrint));
debugger.detach();
- QEXPECT_FAIL("", "Task 256184", Continue);
- QVERIFY(!engine.globalObject().property("print").isValid());
- QEXPECT_FAIL("", "Task 256184", Continue);
+ QVERIFY(engine.globalObject().property("print").strictlyEquals(oldPrint));
QVERIFY(!engine.globalObject().property("__FILE__").isValid());
-// QVERIFY(!engine.globalObject().property("__LINE__").isValid());
+ QVERIFY(!engine.globalObject().property("__LINE__").isValid());
}
{
QScriptEngineDebugger debugger;
@@ -161,6 +161,14 @@ void tst_QScriptEngineDebugger::attachAndDetach()
debugger2.attachTo(&engine);
}
#endif
+ {
+ QScriptEngine *engine = new QScriptEngine;
+ QScriptEngineDebugger debugger;
+ debugger.attachTo(engine);
+ delete engine;
+ QScriptEngine engine2;
+ debugger.attachTo(&engine2);
+ }
}
void tst_QScriptEngineDebugger::action()
diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
index 522a900..97ff04b 100644
--- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
+++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
@@ -321,15 +321,15 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation()
// sequence operating on different object/properties
QAnimationGroup *sequence = new QSequentialAnimationGroup();
- QVariantAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value");
- QVariantAnimation *a1_s_o2 = new QPropertyAnimation(&s_o2, "value");
+ QAbstractAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value");
+ QAbstractAnimation *a1_s_o2 = new QPropertyAnimation(&s_o2, "value");
sequence->addAnimation(a1_s_o1);
sequence->addAnimation(a1_s_o2);
- UncontrolledAnimation *notTimeDriven = new UncontrolledAnimation(&t_o1, "value");
+ QAbstractAnimation *notTimeDriven = new UncontrolledAnimation(&t_o1, "value");
QCOMPARE(notTimeDriven->totalDuration(), -1);
- QVariantAnimation *loopsForever = new QPropertyAnimation(&t_o2, "value");
+ QAbstractAnimation *loopsForever = new QPropertyAnimation(&t_o2, "value");
loopsForever->setLoopCount(-1);
QCOMPARE(loopsForever->totalDuration(), -1);
@@ -818,7 +818,7 @@ void tst_QSequentialAnimationGroup::restart()
QCOMPARE(seqCurrentAnimChangedSpy.count(), 6);
for(int i=0; i<seqCurrentAnimChangedSpy.count(); i++)
- QCOMPARE(anims[i%3], qVariantValue<QAbstractAnimation*>(seqCurrentAnimChangedSpy.at(i).at(0)));
+ QCOMPARE(static_cast<QAbstractAnimation*>(anims[i%3]), qVariantValue<QAbstractAnimation*>(seqCurrentAnimChangedSpy.at(i).at(0)));
group.start();
@@ -836,9 +836,9 @@ void tst_QSequentialAnimationGroup::looping()
// sequence operating on same object/property
QSequentialAnimationGroup *sequence = new QSequentialAnimationGroup();
- QVariantAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value");
- QVariantAnimation *a2_s_o1 = new QPropertyAnimation(&s_o1, "value");
- QVariantAnimation *a3_s_o1 = new QPropertyAnimation(&s_o1, "value");
+ QAbstractAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value");
+ QAbstractAnimation *a2_s_o1 = new QPropertyAnimation(&s_o1, "value");
+ QAbstractAnimation *a3_s_o1 = new QPropertyAnimation(&s_o1, "value");
QSignalSpy a1Spy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy a2Spy(a2_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
@@ -951,18 +951,19 @@ void tst_QSequentialAnimationGroup::startDelay()
void tst_QSequentialAnimationGroup::clearGroup()
{
QSequentialAnimationGroup group;
+
+ static const int animationCount = 20;
- for (int i = 0; i < 10; ++i) {
+ for (int i = 0; i < animationCount/2; ++i) {
QSequentialAnimationGroup *subGroup = new QSequentialAnimationGroup(&group);
group.addPause(100);
subGroup->addPause(10);
}
- QCOMPARE(group.animationCount(), 20);
+ QCOMPARE(group.animationCount(), animationCount);
- int count = group.animationCount();
- QPointer<QAbstractAnimation> *children = new QPointer<QAbstractAnimation>[count];
- for (int i = 0; i < count; ++i) {
+ QPointer<QAbstractAnimation> children[animationCount];
+ for (int i = 0; i < animationCount; ++i) {
QVERIFY(group.animationAt(i) != 0);
children[i] = group.animationAt(i);
}
@@ -970,10 +971,8 @@ void tst_QSequentialAnimationGroup::clearGroup()
group.clearAnimations();
QCOMPARE(group.animationCount(), 0);
QCOMPARE(group.currentTime(), 0);
- for (int i = 0; i < count; ++i)
- QCOMPARE(children[i], QPointer<QAbstractAnimation>());
-
- delete[] children;
+ for (int i = 0; i < animationCount; ++i)
+ QVERIFY(children[i].isNull());
}
void tst_QSequentialAnimationGroup::groupWithZeroDurationAnimations()
@@ -995,7 +994,7 @@ void tst_QSequentialAnimationGroup::groupWithZeroDurationAnimations()
//this should just run fine and change nothing
group.setCurrentTime(0);
- QCOMPARE(group.currentAnimation(), a1);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(a1));
QVariantAnimation *a2 = new QPropertyAnimation(&o2, "myOtherProperty");
a2->setDuration(500);
@@ -1457,7 +1456,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
group.setCurrentTime(300);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
QCOMPARE(notTimeDriven.currentTime(), actualDuration);
- QCOMPARE(group.currentAnimation(), &anim);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(&anim));
//3rd case:
//now let's add a perfectly defined animation at the end
@@ -1474,7 +1473,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
QCOMPARE(notTimeDriven.state(), QAnimationGroup::Stopped);
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(anim.state(), QAnimationGroup::Running);
- QCOMPARE(group.currentAnimation(), &anim);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(&anim));
QCOMPARE(animStateChangedSpy.count(), 1);
QTest::qWait(300); //wait for the end of anim
@@ -1494,21 +1493,21 @@ void tst_QSequentialAnimationGroup::addRemoveAnimation()
QCOMPARE(group.duration(), 0);
QCOMPARE(group.currentTime(), 0);
- QVariantAnimation *anim1 = new QPropertyAnimation;
+ QAbstractAnimation *anim1 = new QPropertyAnimation;
group.addAnimation(anim1);
QCOMPARE(group.duration(), 250);
QCOMPARE(group.currentTime(), 0);
QCOMPARE(group.currentAnimation(), anim1);
//let's append an animation
- QVariantAnimation *anim2 = new QPropertyAnimation;
+ QAbstractAnimation *anim2 = new QPropertyAnimation;
group.addAnimation(anim2);
QCOMPARE(group.duration(), 500);
QCOMPARE(group.currentTime(), 0);
QCOMPARE(group.currentAnimation(), anim1);
//let's prepend an animation
- QVariantAnimation *anim0 = new QPropertyAnimation;
+ QAbstractAnimation *anim0 = new QPropertyAnimation;
group.insertAnimationAt(0, anim0);
QCOMPARE(group.duration(), 750);
QCOMPARE(group.currentTime(), 0);
@@ -1545,7 +1544,7 @@ void tst_QSequentialAnimationGroup::currentAnimation()
QPropertyAnimation anim;
anim.setDuration(0);
group.addAnimation(&anim);
- QCOMPARE(group.currentAnimation(), &anim);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(&anim));
}
void tst_QSequentialAnimationGroup::currentAnimationWithZeroDuration()
@@ -1572,21 +1571,21 @@ void tst_QSequentialAnimationGroup::currentAnimationWithZeroDuration()
group.addAnimation(&zero3);
group.addAnimation(&zero4);
- QCOMPARE(group.currentAnimation(), &zero1);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(&zero1));
group.setCurrentTime(0);
- QCOMPARE(group.currentAnimation(), &anim);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(&anim));
group.setCurrentTime(group.duration());
- QCOMPARE(group.currentAnimation(), &zero4);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(&zero4));
group.setDirection(QAbstractAnimation::Backward);
group.setCurrentTime(0);
- QCOMPARE(group.currentAnimation(), &zero1);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(&zero1));
group.setCurrentTime(group.duration());
- QCOMPARE(group.currentAnimation(), &anim);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(&anim));
}
void tst_QSequentialAnimationGroup::insertAnimation()
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index d17706b..825db6c 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -177,9 +177,10 @@ private slots:
#ifdef NOT_READY_YET
void task_217003_data() { generic_data(); }
void task_217003();
-
void task_229811();
void task_229811_data() { generic_data(); }
+ void task_234422_data() { generic_data(); }
+ void task_234422();
#endif
void task_250026_data() { generic_data("QODBC"); }
void task_250026();
@@ -2775,6 +2776,44 @@ void tst_QSqlQuery::task_229811()
q.exec("DROP TABLE " + tableName );
}
+
+void tst_QSqlQuery::task_234422()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+
+ QSqlQuery query(db);
+ QStringList m_airlines;
+ QStringList m_countries;
+
+ m_airlines << "Lufthansa" << "SAS" << "United" << "KLM" << "Aeroflot";
+ m_countries << "DE" << "SE" << "US" << "NL" << "RU";
+
+ QString tableName = qTableName( "task_234422" );
+
+ query.exec("DROP TABLE " + tableName);
+ QVERIFY_SQL(query,exec("CREATE TABLE " + tableName + " (id int primary key, "
+ "name varchar(20), homecountry varchar(2))"));
+ for (int i = 0; i < m_airlines.count(); ++i) {
+ QVERIFY(query.exec(QString("INSERT INTO " + tableName + " values(%1, '%2', '%3')")
+ .arg(i).arg(m_airlines[i], m_countries[i])));
+ }
+
+ QVERIFY_SQL(query, exec("SELECT name FROM " + tableName));
+ QVERIFY(query.isSelect());
+ QVERIFY(query.first());
+ QVERIFY(query.next());
+ QCOMPARE(query.at(), 1);
+
+ QSqlQuery query2(query);
+
+ QVERIFY_SQL(query2,exec());
+ QVERIFY(query2.first());
+ QCOMPARE(query2.at(), 0);
+ QCOMPARE(query.at(), 1);
+}
+
#endif
QTEST_MAIN( tst_QSqlQuery )
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 9bccb97..b39f0a1 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -413,7 +413,7 @@ void tst_QStateMachine::customGlobalErrorState()
machine.start();
QCoreApplication::processEvents();
- QCOMPARE(machine.errorState(), customErrorState);
+ QCOMPARE(machine.errorState(), static_cast<QAbstractState*>(customErrorState));
QCOMPARE(machine.configuration().count(), 1);
QVERIFY(machine.configuration().contains(initialState));
@@ -778,7 +778,7 @@ void tst_QStateMachine::customErrorStateIsNull()
QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: Missing initial state in compound state ''");
QCoreApplication::processEvents();
- QCOMPARE(machine.errorState(), reinterpret_cast<void *>(0));
+ QCOMPARE(machine.errorState(), reinterpret_cast<QAbstractState *>(0));
QCOMPARE(machine.configuration().count(), 1);
QVERIFY(machine.configuration().contains(oldErrorState));
}
@@ -1103,29 +1103,29 @@ void tst_QStateMachine::stateEntryAndExit()
TestTransition *t = new TestTransition(s2);
QCOMPARE(t->machine(), (QStateMachine*)0);
QCOMPARE(t->sourceState(), (QState*)0);
- QCOMPARE(t->targetState(), s2);
+ QCOMPARE(t->targetState(), (QAbstractState*)s2);
QCOMPARE(t->targetStates().size(), 1);
- QCOMPARE(t->targetStates().at(0), s2);
+ QCOMPARE(t->targetStates().at(0), (QAbstractState*)s2);
t->setTargetState(0);
- QCOMPARE(t->targetState(), (QState*)0);
+ QCOMPARE(t->targetState(), (QAbstractState*)0);
QVERIFY(t->targetStates().isEmpty());
t->setTargetState(s2);
- QCOMPARE(t->targetState(), s2);
+ QCOMPARE(t->targetState(), (QAbstractState*)s2);
QTest::ignoreMessage(QtWarningMsg, "QAbstractTransition::setTargetStates: target state(s) cannot be null");
t->setTargetStates(QList<QAbstractState*>() << 0);
- QCOMPARE(t->targetState(), s2);
+ QCOMPARE(t->targetState(), (QAbstractState*)s2);
t->setTargetStates(QList<QAbstractState*>() << s2);
- QCOMPARE(t->targetState(), s2);
+ QCOMPARE(t->targetState(), (QAbstractState*)s2);
QCOMPARE(t->targetStates().size(), 1);
- QCOMPARE(t->targetStates().at(0), s2);
+ QCOMPARE(t->targetStates().at(0), (QAbstractState*)s2);
QCOMPARE(s1->addTransition(t), (QAbstractTransition*)t);
- QCOMPARE(t->sourceState(), s1);
+ QCOMPARE(t->sourceState(), (QState*)s1);
QCOMPARE(t->machine(), &machine);
{
QAbstractTransition *trans = s2->addTransition(s3);
QVERIFY(trans != 0);
- QCOMPARE(trans->sourceState(), (QAbstractState*)s2);
+ QCOMPARE(trans->sourceState(), (QState*)s2);
QCOMPARE(trans->targetState(), (QAbstractState*)s3);
{
char warning[256];
@@ -1134,10 +1134,10 @@ void tst_QStateMachine::stateEntryAndExit()
s1->removeTransition(trans);
}
s2->removeTransition(trans);
- QCOMPARE(trans->sourceState(), (QAbstractState*)0);
+ QCOMPARE(trans->sourceState(), (QState*)0);
QCOMPARE(trans->targetState(), (QAbstractState*)s3);
QCOMPARE(s2->addTransition(trans), trans);
- QCOMPARE(trans->sourceState(), (QAbstractState*)s2);
+ QCOMPARE(trans->sourceState(), (QState*)s2);
}
QSignalSpy startedSpy(&machine, SIGNAL(started()));
@@ -1269,25 +1269,33 @@ void tst_QStateMachine::assignProperty()
s1->addTransition(s2);
machine.setInitialState(s1);
machine.start();
- QCoreApplication::processEvents();
- QCOMPARE(s1->objectName(), QString::fromLatin1("s1"));
+ QTRY_COMPARE(s1->objectName(), QString::fromLatin1("s1"));
s1->assignProperty(s1, "objectName", "foo");
machine.start();
- QCoreApplication::processEvents();
- QCOMPARE(s1->objectName(), QString::fromLatin1("foo"));
+ QTRY_COMPARE(s1->objectName(), QString::fromLatin1("foo"));
s1->assignProperty(s1, "noSuchProperty", 123);
machine.start();
- QCoreApplication::processEvents();
- QCOMPARE(s1->objectName(), QString::fromLatin1("foo"));
- QCOMPARE(s1->dynamicPropertyNames().size(), 1);
+ QTRY_COMPARE(s1->dynamicPropertyNames().size(), 1);
QCOMPARE(s1->dynamicPropertyNames().at(0), QByteArray("noSuchProperty"));
+ QCOMPARE(s1->objectName(), QString::fromLatin1("foo"));
- QSignalSpy polishedSpy(s1, SIGNAL(polished()));
- machine.start();
- QCoreApplication::processEvents();
- QCOMPARE(polishedSpy.count(), 1);
+ {
+ QSignalSpy polishedSpy(s1, SIGNAL(polished()));
+ machine.start();
+ QTRY_COMPARE(polishedSpy.count(), 1);
+ }
+
+ // nested states
+ {
+ QState *s11 = new QState(s1);
+ QString str = QString::fromLatin1("set by nested state");
+ s11->assignProperty(s11, "objectName", str);
+ s1->setInitialState(s11);
+ machine.start();
+ QTRY_COMPARE(s11->objectName(), str);
+ }
}
void tst_QStateMachine::assignPropertyWithAnimation()
@@ -1716,18 +1724,18 @@ void tst_QStateMachine::signalTransitions()
QStateMachine machine;
QState *s0 = new QState(machine.rootState());
QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: sender cannot be null");
- QCOMPARE(s0->addTransition(0, SIGNAL(noSuchSignal()), 0), (QObject*)0);
+ QCOMPARE(s0->addTransition(0, SIGNAL(noSuchSignal()), 0), (QSignalTransition*)0);
SignalEmitter emitter;
QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: signal cannot be null");
- QCOMPARE(s0->addTransition(&emitter, 0, 0), (QObject*)0);
+ QCOMPARE(s0->addTransition(&emitter, 0, 0), (QSignalTransition*)0);
QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: cannot add transition to null state");
- QCOMPARE(s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), 0), (QObject*)0);
+ QCOMPARE(s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), 0), (QSignalTransition*)0);
QFinalState *s1 = new QFinalState(machine.rootState());
QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: no such signal SignalEmitter::noSuchSignal()");
- QCOMPARE(s0->addTransition(&emitter, SIGNAL(noSuchSignal()), s1), (QObject*)0);
+ QCOMPARE(s0->addTransition(&emitter, SIGNAL(noSuchSignal()), s1), (QSignalTransition*)0);
QSignalTransition *trans = s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1);
QVERIFY(trans != 0);
diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp
index 29f42df..f908d3f 100644
--- a/tests/auto/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/qtabbar/tst_qtabbar.cpp
@@ -370,7 +370,7 @@ void tst_QTabBar::tabButton()
tabbar.setTabButton(0, position, button);
- QCOMPARE(tabbar.tabButton(0, position), static_cast<const QWidget *>(button));
+ QCOMPARE(tabbar.tabButton(0, position), static_cast<QWidget *>(button));
QTRY_VERIFY(!button->isHidden());
QVERIFY(tabbar.tabButton(0, otherSide) == 0);
QCOMPARE(button->parent(), static_cast<QObject *>(&tabbar));
diff --git a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
index 843974d..8c7c021 100644
--- a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
+++ b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
@@ -44,8 +44,10 @@
#include <QtCore/QDebug>
#include <QtCore/QObject>
#include <QtGui>
+#ifdef Q_OS_WINCE_WM
#include <windows.h>
#include <ddhelper.h>
+#endif