tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b).

- Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer).
- Replace Q[TRY]_VERIFY(smartPointer == 0)  by
          Q[TRY]_VERIFY(smartPointer.isNull()).
- Replace Q[TRY]_VERIFY(a == b) by  Q[TRY]_COMPARE(a, b) and
  add casts where necessary. The values will then be logged
  should a test fail.

Change-Id: Ie29640451dddeb58342038a8cd5fac152cce39e5
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-07-30 15:16:36 +02:00
parent 3859b304e8
commit 7b72cc205c
62 changed files with 671 additions and 639 deletions

View File

@ -98,7 +98,7 @@ void tst_QColorDialog::testNativeActiveModalWidget()
TestNativeDialog d;
QTimer::singleShot(1000, &d, SLOT(hide()));
d.exec();
QVERIFY(&d == d.m_activeModalWidget);
QCOMPARE(&d, d.m_activeModalWidget);
}
void tst_QColorDialog::native_activeModalWidget()

View File

@ -677,7 +677,7 @@ void tst_QFiledialog::filters()
// effects
QList<QComboBox*> views = fd.findChildren<QComboBox*>("fileTypeCombo");
QVERIFY(views.count() == 1);
QCOMPARE(views.count(), 1);
QCOMPARE(views.at(0)->isVisible(), false);
QStringList filters;
@ -1296,7 +1296,7 @@ void tst_QFiledialog::clearLineEdit()
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
QVERIFY(lineEdit);
QVERIFY(lineEdit->text() == "foo");
QCOMPARE(lineEdit->text(), QLatin1String("foo"));
fd.setDirectory(QDir::home());
QListView* list = fd.findChild<QListView*>("listView");
@ -1393,12 +1393,12 @@ void tst_QFiledialog::trailingDotsAndSpaces()
QTest::keyClick(lineEdit, Qt::Key_Space);
QTest::keyClick(lineEdit, Qt::Key_Period);
QTest::qWait(1000);
QVERIFY(currentChildrenCount == list->model()->rowCount(list->rootIndex()));
QCOMPARE(currentChildrenCount, list->model()->rowCount(list->rootIndex()));
lineEdit->clear();
QTest::keyClick(lineEdit, Qt::Key_Period);
QTest::keyClick(lineEdit, Qt::Key_Space);
QTest::qWait(1000);
QVERIFY(currentChildrenCount == list->model()->rowCount(list->rootIndex()));
QCOMPARE(currentChildrenCount, list->model()->rowCount(list->rootIndex()));
}
#ifdef Q_OS_UNIX

View File

@ -167,7 +167,7 @@ void tst_QFileSystemModel::cleanup()
QVERIFY(dir.rmdir(list.at(i)));
}
list = dir.entryList(QDir::AllEntries | QDir::System | QDir::Hidden | QDir::NoDotAndDotDot);
QVERIFY(list.count() == 0);
QCOMPARE(list.count(), 0);
}
}
@ -523,8 +523,14 @@ void tst_QFileSystemModel::rowsInserted()
QVERIFY(createFiles(tmp, QStringList(".hidden_file"), 5 + count));
if (count != 0) QTRY_VERIFY(spy0.count() >= 1); else QTRY_VERIFY(spy0.count() == 0);
if (count != 0) QTRY_VERIFY(spy1.count() >= 1); else QTRY_VERIFY(spy1.count() == 0);
if (count != 0)
QTRY_VERIFY(spy0.count() >= 1);
else
QTRY_COMPARE(spy0.count(), 0);
if (count != 0)
QTRY_VERIFY(spy1.count() >= 1);
else
QTRY_COMPARE(spy1.count(), 0);
}
void tst_QFileSystemModel::rowsRemoved_data()
@ -563,8 +569,8 @@ void tst_QFileSystemModel::rowsRemoved()
}
} else {
if (i == 10 || spy0.count() == 0) {
QVERIFY(spy0.count() == 0);
QVERIFY(spy1.count() == 0);
QCOMPARE(spy0.count(), 0);
QCOMPARE(spy1.count(), 0);
}
}
QStringList lst;
@ -583,8 +589,8 @@ void tst_QFileSystemModel::rowsRemoved()
QVERIFY(QFile::remove(tmp + '/' + QString(".c")));
QTest::qWait(WAITTIME);
if (count != 0) QVERIFY(spy0.count() >= 1); else QVERIFY(spy0.count() == 0);
if (count != 0) QVERIFY(spy1.count() >= 1); else QVERIFY(spy1.count() == 0);
if (count != 0) QVERIFY(spy0.count() >= 1); else QCOMPARE(spy0.count(), 0);
if (count != 0) QVERIFY(spy1.count() >= 1); else QCOMPARE(spy1.count(), 0);
}
void tst_QFileSystemModel::dataChanged_data()
@ -614,7 +620,7 @@ void tst_QFileSystemModel::dataChanged()
QTest::qWait(WAITTIME);
if (count != 0) QVERIFY(spy.count() >= 1); else QVERIFY(spy.count() == 0);
if (count != 0) QVERIFY(spy.count() >= 1); else QCOMPARE(spy.count(), 0);
*/
}

View File

@ -216,7 +216,7 @@ void tst_QMessageBox::button()
// remove the cancel, should not exist anymore
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
QVERIFY(msgBox.button(QMessageBox::Cancel) == 0);
QVERIFY(!msgBox.button(QMessageBox::Cancel));
QVERIFY(msgBox.button(QMessageBox::Yes) != 0);
// should not crash
@ -228,10 +228,10 @@ void tst_QMessageBox::button()
void tst_QMessageBox::defaultButton()
{
QMessageBox msgBox;
QVERIFY(msgBox.defaultButton() == 0);
QVERIFY(!msgBox.defaultButton());
msgBox.addButton(QMessageBox::Ok);
msgBox.addButton(QMessageBox::Cancel);
QVERIFY(msgBox.defaultButton() == 0);
QVERIFY(!msgBox.defaultButton());
QPushButton pushButton;
msgBox.setDefaultButton(&pushButton);
QVERIFY(msgBox.defaultButton() == 0); // we have not added it yet
@ -250,27 +250,27 @@ void tst_QMessageBox::defaultButton()
exec(&msgBox, Qt::Key_Enter);
QCOMPARE(msgBox.clickedButton(), okButton);
msgBox.setDefaultButton(QMessageBox::Yes); // its not in there!
QVERIFY(msgBox.defaultButton() == okButton);
QCOMPARE(msgBox.defaultButton(), okButton);
msgBox.removeButton(okButton);
delete okButton;
okButton = 0;
QVERIFY(msgBox.defaultButton() == 0);
QVERIFY(!msgBox.defaultButton());
msgBox.setDefaultButton(QMessageBox::Ok);
QVERIFY(msgBox.defaultButton() == 0);
QVERIFY(!msgBox.defaultButton());
}
void tst_QMessageBox::escapeButton()
{
QMessageBox msgBox;
QVERIFY(msgBox.escapeButton() == 0);
QVERIFY(!msgBox.escapeButton());
msgBox.addButton(QMessageBox::Ok);
exec(&msgBox);
QVERIFY(msgBox.clickedButton() == msgBox.button(QMessageBox::Ok)); // auto detected (one button only)
msgBox.addButton(QMessageBox::Cancel);
QVERIFY(msgBox.escapeButton() == 0);
QVERIFY(!msgBox.escapeButton());
QPushButton invalidButton;
msgBox.setEscapeButton(&invalidButton);
QVERIFY(msgBox.escapeButton() == 0);
QVERIFY(!msgBox.escapeButton());
QAbstractButton *retryButton = msgBox.addButton(QMessageBox::Retry);
exec(&msgBox);
@ -293,13 +293,13 @@ void tst_QMessageBox::escapeButton()
exec(&msgBox, Qt::Key_Escape);
QCOMPARE(msgBox.clickedButton(), okButton);
msgBox.setEscapeButton(QMessageBox::Yes); // its not in there!
QVERIFY(msgBox.escapeButton() == okButton);
QCOMPARE(msgBox.escapeButton(), okButton);
msgBox.removeButton(okButton);
delete okButton;
okButton = 0;
QVERIFY(msgBox.escapeButton() == 0);
QVERIFY(!msgBox.escapeButton());
msgBox.setEscapeButton(QMessageBox::Ok);
QVERIFY(msgBox.escapeButton() == 0);
QVERIFY(!msgBox.escapeButton());
QMessageBox msgBox2;
msgBox2.addButton(QMessageBox::Yes);
@ -527,13 +527,13 @@ void tst_QMessageBox::testSymbols()
QCOMPARE(mb1.text(), text);
icon = mb1.icon();
QVERIFY(icon == QMessageBox::NoIcon);
QCOMPARE(icon, QMessageBox::NoIcon);
mb1.setIcon(QMessageBox::Question);
QVERIFY(mb1.icon() == QMessageBox::Question);
QCOMPARE(mb1.icon(), QMessageBox::Question);
QPixmap iconPixmap = mb1.iconPixmap();
mb1.setIconPixmap(iconPixmap);
QVERIFY(mb1.icon() == QMessageBox::NoIcon);
QCOMPARE(mb1.icon(), QMessageBox::NoIcon);
QCOMPARE(mb1.buttonText(QMessageBox::Ok), QLatin1String("OK"));
QCOMPARE(mb1.buttonText(QMessageBox::Cancel), QString());

View File

@ -400,7 +400,7 @@ void tst_QWizard::setButton()
// revert to default button
wizard.setButton(QWizard::NextButton, 0);
QVERIFY(toolButton == 0);
QVERIFY(toolButton.isNull());
QVERIFY(qobject_cast<QPushButton *>(wizard.button(QWizard::NextButton)));
QVERIFY(wizard.button(QWizard::NextButton)->text().contains("Next"));
}
@ -408,16 +408,16 @@ void tst_QWizard::setButton()
void tst_QWizard::setTitleFormatEtc()
{
QWizard wizard;
QVERIFY(wizard.titleFormat() == Qt::AutoText);
QVERIFY(wizard.subTitleFormat() == Qt::AutoText);
QCOMPARE(wizard.titleFormat(), Qt::AutoText);
QCOMPARE(wizard.subTitleFormat(), Qt::AutoText);
wizard.setTitleFormat(Qt::RichText);
QVERIFY(wizard.titleFormat() == Qt::RichText);
QVERIFY(wizard.subTitleFormat() == Qt::AutoText);
QCOMPARE(wizard.titleFormat(), Qt::RichText);
QCOMPARE(wizard.subTitleFormat(), Qt::AutoText);
wizard.setSubTitleFormat(Qt::PlainText);
QVERIFY(wizard.titleFormat() == Qt::RichText);
QVERIFY(wizard.subTitleFormat() == Qt::PlainText);
QCOMPARE(wizard.titleFormat(), Qt::RichText);
QCOMPARE(wizard.subTitleFormat(), Qt::PlainText);
}
void tst_QWizard::setPixmap()
@ -459,20 +459,20 @@ void tst_QWizard::setPixmap()
page->setPixmap(QWizard::LogoPixmap, p5);
QVERIFY(wizard.pixmap(QWizard::BannerPixmap).size() == p1.size());
QVERIFY(wizard.pixmap(QWizard::LogoPixmap).size() == p2.size());
QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).size() == p3.size());
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).size() == p4.size());
QCOMPARE(wizard.pixmap(QWizard::BannerPixmap).size(), p1.size());
QCOMPARE(wizard.pixmap(QWizard::LogoPixmap).size(), p2.size());
QCOMPARE(wizard.pixmap(QWizard::WatermarkPixmap).size(), p3.size());
QCOMPARE(wizard.pixmap(QWizard::BackgroundPixmap).size(), p4.size());
QVERIFY(page->pixmap(QWizard::BannerPixmap).size() == p1.size());
QVERIFY(page->pixmap(QWizard::LogoPixmap).size() == p5.size());
QVERIFY(page->pixmap(QWizard::WatermarkPixmap).size() == p3.size());
QVERIFY(page->pixmap(QWizard::BackgroundPixmap).size() == p4.size());
QCOMPARE(page->pixmap(QWizard::BannerPixmap).size(), p1.size());
QCOMPARE(page->pixmap(QWizard::LogoPixmap).size(), p5.size());
QCOMPARE(page->pixmap(QWizard::WatermarkPixmap).size(), p3.size());
QCOMPARE(page->pixmap(QWizard::BackgroundPixmap).size(), p4.size());
QVERIFY(page2->pixmap(QWizard::BannerPixmap).size() == p1.size());
QVERIFY(page2->pixmap(QWizard::LogoPixmap).size() == p2.size());
QVERIFY(page2->pixmap(QWizard::WatermarkPixmap).size() == p3.size());
QVERIFY(page2->pixmap(QWizard::BackgroundPixmap).size() == p4.size());
QCOMPARE(page2->pixmap(QWizard::BannerPixmap).size(), p1.size());
QCOMPARE(page2->pixmap(QWizard::LogoPixmap).size(), p2.size());
QCOMPARE(page2->pixmap(QWizard::WatermarkPixmap).size(), p3.size());
QCOMPARE(page2->pixmap(QWizard::BackgroundPixmap).size(), p4.size());
}
class MyPage1 : public QWizardPage
@ -571,7 +571,7 @@ void tst_QWizard::addPage()
}
for (int i = 0; i < N; ++i) {
QVERIFY(pages[i] == wizard.page(i));
QCOMPARE(pages[i], wizard.page(i));
}
QVERIFY(!wizard.page(-1));
QVERIFY(!wizard.page(N));
@ -667,7 +667,7 @@ void tst_QWizard::setPage()
QCOMPARE(wizard.page(-2), page);
QCOMPARE(wizard.startId(), -2);
QCOMPARE(wizard.currentId(), -2);
QVERIFY(wizard.currentPage() == page);
QCOMPARE(wizard.currentPage(), page);
QCOMPARE(wizard.nextId(), 0);
CHECK_VISITED(wizard, QList<int>() << -2);
@ -679,14 +679,14 @@ void tst_QWizard::setPage()
QCOMPARE(wizard.page(2), page);
QCOMPARE(wizard.startId(), -2);
QCOMPARE(wizard.currentId(), -2);
QVERIFY(wizard.currentPage() == wizard.page(-2));
QCOMPARE(wizard.currentPage(), wizard.page(-2));
QCOMPARE(wizard.nextId(), 0);
CHECK_VISITED(wizard, QList<int>() << -2);
wizard.restart();
QCOMPARE(wizard.startId(), -2);
QCOMPARE(wizard.currentId(), -2);
QVERIFY(wizard.currentPage() == wizard.page(-2));
QCOMPARE(wizard.currentPage(), wizard.page(-2));
QCOMPARE(wizard.nextId(), 0);
CHECK_VISITED(wizard, QList<int>() << -2);
@ -698,28 +698,28 @@ void tst_QWizard::setPage()
QCOMPARE(wizard.page(-3), page);
QCOMPARE(wizard.startId(), -3);
QCOMPARE(wizard.currentId(), -2);
QVERIFY(wizard.currentPage() == wizard.page(-2));
QCOMPARE(wizard.currentPage(), wizard.page(-2));
QCOMPARE(wizard.nextId(), 0);
CHECK_VISITED(wizard, QList<int>() << -2);
wizard.restart();
QCOMPARE(wizard.startId(), -3);
QCOMPARE(wizard.currentId(), -3);
QVERIFY(wizard.currentPage() == wizard.page(-3));
QCOMPARE(wizard.currentPage(), wizard.page(-3));
QCOMPARE(wizard.nextId(), -2);
CHECK_VISITED(wizard, QList<int>() << -3);
wizard.next();
QCOMPARE(wizard.startId(), -3);
QCOMPARE(wizard.currentId(), -2);
QVERIFY(wizard.currentPage() == wizard.page(-2));
QCOMPARE(wizard.currentPage(), wizard.page(-2));
QCOMPARE(wizard.nextId(), 0);
CHECK_VISITED(wizard, QList<int>() << -3 << -2);
wizard.next();
QCOMPARE(wizard.startId(), -3);
QCOMPARE(wizard.currentId(), 0);
QVERIFY(wizard.currentPage() == wizard.page(0));
QCOMPARE(wizard.currentPage(), wizard.page(0));
QCOMPARE(wizard.nextId(), 2);
CHECK_VISITED(wizard, QList<int>() << -3 << -2 << 0);
@ -727,7 +727,7 @@ void tst_QWizard::setPage()
wizard.next();
QCOMPARE(wizard.startId(), -3);
QCOMPARE(wizard.currentId(), 2);
QVERIFY(wizard.currentPage() == wizard.page(2));
QCOMPARE(wizard.currentPage(), wizard.page(2));
QCOMPARE(wizard.nextId(), -1);
CHECK_VISITED(wizard, QList<int>() << -3 << -2 << 0 << 2);
}
@ -735,14 +735,14 @@ void tst_QWizard::setPage()
wizard.back();
QCOMPARE(wizard.startId(), -3);
QCOMPARE(wizard.currentId(), 0);
QVERIFY(wizard.currentPage() == wizard.page(0));
QCOMPARE(wizard.currentPage(), wizard.page(0));
QCOMPARE(wizard.nextId(), 2);
CHECK_VISITED(wizard, QList<int>() << -3 << -2 << 0);
wizard.back();
QCOMPARE(wizard.startId(), -3);
QCOMPARE(wizard.currentId(), -2);
QVERIFY(wizard.currentPage() == wizard.page(-2));
QCOMPARE(wizard.currentPage(), wizard.page(-2));
QCOMPARE(wizard.nextId(), 0);
CHECK_VISITED(wizard, QList<int>() << -3 << -2);
@ -750,7 +750,7 @@ void tst_QWizard::setPage()
wizard.back();
QCOMPARE(wizard.startId(), -3);
QCOMPARE(wizard.currentId(), -3);
QVERIFY(wizard.currentPage() == wizard.page(-3));
QCOMPARE(wizard.currentPage(), wizard.page(-3));
QCOMPARE(wizard.nextId(), -2);
CHECK_VISITED(wizard, QList<int>() << -3);
}
@ -759,7 +759,7 @@ void tst_QWizard::setPage()
wizard.restart();
QCOMPARE(wizard.startId(), -3);
QCOMPARE(wizard.currentId(), -3);
QVERIFY(wizard.currentPage() == wizard.page(-3));
QCOMPARE(wizard.currentPage(), wizard.page(-3));
QCOMPARE(wizard.nextId(), -2);
CHECK_VISITED(wizard, QList<int>() << -3);
}
@ -808,31 +808,31 @@ void tst_QWizard::setStartId()
wizard.restart();
QCOMPARE(wizard.startId(), -2);
QCOMPARE(wizard.currentId(), -2);
QVERIFY(wizard.currentPage() == wizard.page(-2));
QCOMPARE(wizard.currentPage(), wizard.page(-2));
QCOMPARE(wizard.nextId(), 0);
wizard.next();
QCOMPARE(wizard.startId(), -2);
QCOMPARE(wizard.currentId(), 0);
QVERIFY(wizard.currentPage() == wizard.page(0));
QCOMPARE(wizard.currentPage(), wizard.page(0));
QCOMPARE(wizard.nextId(), 1);
wizard.setStartId(INT_MIN);
QCOMPARE(wizard.startId(), INT_MIN);
QCOMPARE(wizard.currentId(), 0);
QVERIFY(wizard.currentPage() == wizard.page(0));
QCOMPARE(wizard.currentPage(), wizard.page(0));
QCOMPARE(wizard.nextId(), 1);
wizard.next();
QCOMPARE(wizard.startId(), INT_MIN);
QCOMPARE(wizard.currentId(), 1);
QVERIFY(wizard.currentPage() == wizard.page(1));
QCOMPARE(wizard.currentPage(), wizard.page(1));
QCOMPARE(wizard.nextId(), INT_MAX);
wizard.next();
QCOMPARE(wizard.startId(), INT_MIN);
QCOMPARE(wizard.currentId(), INT_MAX);
QVERIFY(wizard.currentPage() == wizard.page(INT_MAX));
QCOMPARE(wizard.currentPage(), wizard.page(INT_MAX));
QCOMPARE(wizard.nextId(), -1);
CHECK_VISITED(wizard, QList<int>() << -2 << 0 << 1 << INT_MAX);
}
@ -1143,12 +1143,12 @@ void tst_QWizard::setOption_ExtendedWatermarkPixmap()
}
if (wizard1.wizardStyle() == QWizard::MacStyle) {
QVERIFY(i1[0] == i1[1]);
QVERIFY(i2[0] == i2[1]);
QVERIFY(i1[0] == i2[0]);
QCOMPARE(i1[0], i1[1]);
QCOMPARE(i2[0], i2[1]);
QCOMPARE(i1[0], i2[0]);
} else {
QVERIFY(i1[0] != i1[1]);
QVERIFY(i2[0] == i2[1]);
QCOMPARE(i2[0], i2[1]);
QVERIFY(i1[0] != i2[0]);
QVERIFY(i1[1] != i2[1]);
}
@ -2425,19 +2425,19 @@ void tst_QWizard::sideWidget()
QWizard wizard;
wizard.setSideWidget(0);
QVERIFY(wizard.sideWidget() == 0);
QVERIFY(!wizard.sideWidget());
QScopedPointer<QWidget> w1(new QWidget(&wizard));
wizard.setSideWidget(w1.data());
QCOMPARE(wizard.sideWidget(), w1.data());
QWidget *w2 = new QWidget(&wizard);
wizard.setSideWidget(w2);
QVERIFY(wizard.sideWidget() == w2);
QCOMPARE(wizard.sideWidget(), w2);
QVERIFY(w1->parent() != 0);
QCOMPARE(w1->window(), static_cast<QWidget *>(&wizard));
QCOMPARE(w2->window(), static_cast<QWidget *>(&wizard));
w1->setParent(0);
wizard.setSideWidget(0);
QVERIFY(wizard.sideWidget() == 0);
QVERIFY(!wizard.sideWidget());
}
void tst_QWizard::objectNames_data()
@ -2558,7 +2558,7 @@ void tst_QWizard::task183550_stretchFactor()
page2->disableVerticalExpansion();
wizard.next();
QCOMPARE(wizard.currentPage(), static_cast<QWizardPage*>(page2));
QVERIFY(page2->treeWidgetHeight() == page2->treeWidgetSizeHintHeight());
QCOMPARE(page2->treeWidgetHeight(), page2->treeWidgetSizeHintHeight());
wizard.back();
QCOMPARE(wizard.currentPage(), static_cast<QWizardPage*>(page1));
@ -2576,7 +2576,7 @@ void tst_QWizard::task183550_stretchFactor()
page2->disableVerticalExpansion();
wizard.next();
QCOMPARE(wizard.currentPage(), static_cast<QWizardPage*>(page2));
QVERIFY(page2->treeWidgetHeight() == page2->treeWidgetSizeHintHeight());
QCOMPARE(page2->treeWidgetHeight(), page2->treeWidgetSizeHintHeight());
}
void tst_QWizard::task161658_alignments()

View File

@ -520,7 +520,7 @@ public:
void draw(QPainter *painter)
{
QVERIFY(sourcePixmap(Qt::LogicalCoordinates).handle() == pixmap.handle());
QCOMPARE(sourcePixmap(Qt::LogicalCoordinates).handle(), pixmap.handle());
QVERIFY((painter->worldTransform().type() <= QTransform::TxTranslate) == (sourcePixmap(Qt::DeviceCoordinates).handle() == pixmap.handle()));
++repaints;
@ -595,7 +595,7 @@ void tst_QGraphicsEffect::deviceCoordinateTranslateCaching()
item->translate(10, 0);
QTRY_VERIFY(item->numRepaints == numRepaints);
QTRY_COMPARE(item->numRepaints, numRepaints);
}
void tst_QGraphicsEffect::inheritOpacity()

View File

@ -2040,9 +2040,9 @@ void tst_QGraphicsAnchorLayout::graphicsAnchorHandling()
QGraphicsAnchor *invalidAnchor = l->anchor(a, Qt::AnchorTop, l, Qt::AnchorBottom);
// Ensure none of these anchors are accessible.
QVERIFY(layoutAnchor == 0);
QVERIFY(itemAnchor == 0);
QVERIFY(invalidAnchor == 0);
QVERIFY(!layoutAnchor);
QVERIFY(!itemAnchor);
QVERIFY(!invalidAnchor);
// Hook the anchors to a QObject
QObject object;

View File

@ -715,7 +715,7 @@ void tst_QGraphicsAnchorLayout1::testSpecialCases()
widget1->setGeometry(QRectF(0,0,100,100));
QCOMPARE(childWidget->geometry(), QRectF(1,1,98,98));
QVERIFY(childWidget->parentLayoutItem() == layout1);
QCOMPARE(childWidget->parentLayoutItem(), layout1);
QGraphicsWidget *widget2 = new QGraphicsWidget;
TheAnchorLayout *layout2 = new TheAnchorLayout();
widget2->setLayout(layout2);
@ -739,10 +739,10 @@ void tst_QGraphicsAnchorLayout1::testSpecialCases()
widget2->setGeometry(QRectF(0,0,100,100));
QCOMPARE(childWidget->geometry(), QRectF(1,1,98,98));
QVERIFY(childWidget->parentLayoutItem() == layout2);
QCOMPARE(childWidget->parentLayoutItem(), layout2);
QCOMPARE(widget4->geometry(), QRectF(1,1,98,98));
QVERIFY(widget4->parentLayoutItem() == layout2);
QVERIFY(widget4->parentItem() == widget2);
QCOMPARE(widget4->parentLayoutItem(), layout2);
QCOMPARE(widget4->parentItem(), widget2);
delete widget4;
delete widget3;

View File

@ -4274,7 +4274,7 @@ void tst_QGraphicsItem::cursor()
void tst_QGraphicsItem::textControlGetterSetter()
{
QGraphicsTextItem *item = new QGraphicsTextItem;
QVERIFY(item->textControl()->parent() == item);
QCOMPARE(item->textControl()->parent(), item);
QPointer<QWidgetTextControl> control = item->textControl();
delete item;
QVERIFY(!control);
@ -4285,7 +4285,7 @@ void tst_QGraphicsItem::textControlGetterSetter()
control = new QWidgetTextControl;
item->setTextControl(control);
QVERIFY(item->textControl() == control);
QCOMPARE(item->textControl(), control);
QVERIFY(!control->parent());
QVERIFY(!oldControl);
@ -5141,19 +5141,19 @@ void tst_QGraphicsItem::paint()
//nominal case, update call paint
tester2.update();
qApp->processEvents();
QTRY_VERIFY(tester2.painted == 2);
QTRY_COMPARE(tester2.painted, 2);
//we remove the item from the scene, number of updates is still the same
tester2.update();
scene2.removeItem(&tester2);
qApp->processEvents();
QTRY_VERIFY(tester2.painted == 2);
QTRY_COMPARE(tester2.painted, 2);
//We re-add the item, the number of paint should increase
scene2.addItem(&tester2);
tester2.update();
qApp->processEvents();
QTRY_VERIFY(tester2.painted == 3);
QTRY_COMPARE(tester2.painted, 3);
}
class HarakiriItem : public QGraphicsRectItem
@ -5878,7 +5878,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
scene.setItemIndexMethod(QGraphicsScene::NoIndex);
scene.addItem(parent);
QVERIFY(parent->boundingRectCalls == childOutsideShape->boundingRectCalls);
QCOMPARE(parent->boundingRectCalls, childOutsideShape->boundingRectCalls);
int oldParentBoundingRectCalls = parent->boundingRectCalls;
int oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
@ -5886,10 +5886,10 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
// First test that both items are searched if no optimization flags are set
QGraphicsItem* item = scene.itemAt(25,5);
QVERIFY(item == childOutsideShape);
QCOMPARE(item, childOutsideShape);
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
QVERIFY(childOutsideShape->boundingRectCalls > oldChildBoundingRectCalls);
QVERIFY(parent->boundingRectCalls == childOutsideShape->boundingRectCalls);
QCOMPARE(parent->boundingRectCalls, childOutsideShape->boundingRectCalls);
oldParentBoundingRectCalls = parent->boundingRectCalls;
oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
@ -5897,10 +5897,10 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
// Repeat the test to make sure that no caching/indexing is in effect
item = scene.itemAt(25,5);
QVERIFY(item == childOutsideShape);
QCOMPARE(item, childOutsideShape);
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
QVERIFY(childOutsideShape->boundingRectCalls > oldChildBoundingRectCalls);
QVERIFY(parent->boundingRectCalls == childOutsideShape->boundingRectCalls);
QCOMPARE(parent->boundingRectCalls, childOutsideShape->boundingRectCalls);
oldParentBoundingRectCalls = parent->boundingRectCalls;
oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
@ -5912,7 +5912,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
QVERIFY(!(item));
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
QVERIFY(childOutsideShape->boundingRectCalls == oldChildBoundingRectCalls);
QCOMPARE(childOutsideShape->boundingRectCalls, oldChildBoundingRectCalls);
QVERIFY(parent->boundingRectCalls > childOutsideShape->boundingRectCalls);
}
@ -11205,21 +11205,21 @@ void tst_QGraphicsItem::QTBUG_6738_missingUpdateWithSetParent()
child2->setVisible(false);
child2->setParentItem(child);
QTRY_VERIFY(view.repaints == 1);
QTRY_COMPARE(view.repaints, 1);
// test case #2
view.reset();
child3->setOpacity(0.0);
child3->setParentItem(child);
QTRY_VERIFY(view.repaints == 1);
QTRY_COMPARE(view.repaints, 1);
// test case #3
view.reset();
child4->setParentItem(child);
child4->setVisible(false);
QTRY_VERIFY(view.repaints == 1);
QTRY_COMPARE(view.repaints, 1);
}
void tst_QGraphicsItem::QT_2653_fullUpdateDiscardingOpacityUpdate()
@ -11469,9 +11469,9 @@ void tst_QGraphicsItem::itemDiesDuringDraggingOperation()
QGraphicsSceneDragDropEvent event(QEvent::GraphicsSceneDragMove);
event.setScenePos(item->boundingRect().center());
QApplication::sendEvent(&scene, &event);
QVERIFY(QGraphicsScenePrivate::get(&scene)->dragDropItem == item);
QCOMPARE(QGraphicsScenePrivate::get(&scene)->dragDropItem, item);
delete item;
QVERIFY(QGraphicsScenePrivate::get(&scene)->dragDropItem == 0);
QVERIFY(!QGraphicsScenePrivate::get(&scene)->dragDropItem);
}
void tst_QGraphicsItem::QTBUG_12112_focusItem()

View File

@ -948,7 +948,7 @@ void tst_QGraphicsLayout::ownership()
destructedSet.clear();
window->setLayout(0);
QVERIFY(destructedSet.count() == 0);
QCOMPARE(destructedSet.count(), 0);
delete window;
}

View File

@ -1230,8 +1230,8 @@ void tst_QGraphicsLinearLayout::testStretch()
layout->addStretch(2);
layout->addItem(w2);
QCOMPARE(layout->count(), 2);
QVERIFY(layout->itemAt(0) == w1);
QVERIFY(layout->itemAt(1) == w2);
QCOMPARE(layout->itemAt(0), w1);
QCOMPARE(layout->itemAt(1), w2);
layout->activate();
//view->setSceneRect(-50, -50, 800, 800);

View File

@ -102,7 +102,7 @@ void tst_QGraphicsObject::pos()
QCOMPARE(xSpy.count(), 1);
QCOMPARE(ySpy.count(), 1);
QVERIFY(object.pos() == QPointF(10,10));
QCOMPARE(object.pos(), QPointF(10,10));
object.setPos(10, 10);
QCOMPARE(xSpy.count(), 1);
@ -111,12 +111,12 @@ void tst_QGraphicsObject::pos()
object.setProperty("pos", QPointF(0, 0));
QCOMPARE(xSpy.count(), 2);
QCOMPARE(ySpy.count(), 2);
QVERIFY(object.property("pos") == QPointF(0,0));
QCOMPARE(object.property("pos").toPointF(), QPointF(0,0));
object.setProperty("pos", QPointF(10, 0));
QCOMPARE(xSpy.count(), 3);
QCOMPARE(ySpy.count(), 2);
QVERIFY(object.property("pos") == QPointF(10,0));
QCOMPARE(object.property("pos").toPointF(), QPointF(10,0));
object.setProperty("pos", QPointF(10, 10));
QCOMPARE(xSpy.count(), 3);
@ -135,7 +135,7 @@ void tst_QGraphicsObject::x()
QCOMPARE(ySpy.count(), 0);
QVERIFY(object.pos() == QPointF(10, 0));
QVERIFY(object.x() == 10);
QCOMPARE(object.x(), qreal(10));
object.setX(10);
QCOMPARE(xSpy.count(), 1);
@ -144,7 +144,7 @@ void tst_QGraphicsObject::x()
object.setProperty("x", 0);
QCOMPARE(xSpy.count(), 2);
QCOMPARE(ySpy.count(), 0);
QVERIFY(object.property("x") == 0);
QCOMPARE(object.property("x").toDouble(), double(0));
}
void tst_QGraphicsObject::y()
@ -158,7 +158,7 @@ void tst_QGraphicsObject::y()
QCOMPARE(ySpy.count(), 1);
QVERIFY(object.pos() == QPointF(0, 10));
QVERIFY(object.y() == 10);
QCOMPARE(object.y(), qreal(10));
object.setY(10);
QCOMPARE(xSpy.count(), 0);
@ -167,43 +167,43 @@ void tst_QGraphicsObject::y()
object.setProperty("y", 0);
QCOMPARE(xSpy.count(), 0);
QCOMPARE(ySpy.count(), 2);
QVERIFY(object.property("y") == 0);
QCOMPARE(object.property("y").toDouble(), qreal(0));
}
void tst_QGraphicsObject::z()
{
MyGraphicsObject object;
QSignalSpy zSpy(&object, SIGNAL(zChanged()));
QVERIFY(object.zValue() == 0);
QCOMPARE(object.zValue(), qreal(0));
object.setZValue(10);
QCOMPARE(zSpy.count(), 1);
QVERIFY(object.zValue() == 10);
QCOMPARE(object.zValue(), qreal(10));
object.setZValue(10);
QCOMPARE(zSpy.count(), 1);
object.setProperty("z", 0);
QCOMPARE(zSpy.count(), 2);
QVERIFY(object.property("z") == 0);
QCOMPARE(object.property("z").toDouble(), double(0));
}
void tst_QGraphicsObject::opacity()
{
MyGraphicsObject object;
QSignalSpy spy(&object, SIGNAL(opacityChanged()));
QVERIFY(object.opacity() == 1.);
QCOMPARE(object.opacity(), 1.);
object.setOpacity(0);
QCOMPARE(spy.count(), 1);
QVERIFY(object.opacity() == 0.);
QCOMPARE(object.opacity(), 0.);
object.setOpacity(0);
QCOMPARE(spy.count(), 1);
object.setProperty("opacity", .5);
QCOMPARE(spy.count(), 2);
QVERIFY(object.property("opacity") == .5);
QCOMPARE(object.property("opacity").toDouble(), .5);
}
void tst_QGraphicsObject::enabled()

View File

@ -314,7 +314,7 @@ void tst_QGraphicsProxyWidget::qgraphicsproxywidget()
SubQGraphicsProxyWidget proxy;
proxy.paint(0, 0, 0);
proxy.setWidget(0);
QVERIFY(proxy.type() == QGraphicsProxyWidget::Type);
QCOMPARE(proxy.type(), int(QGraphicsProxyWidget::Type));
QVERIFY(!proxy.widget());
QEvent event(QEvent::None);
proxy.call_eventFilter(0, &event);
@ -3017,36 +3017,36 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget()
layout->addWidget(rightDial);
window.setLayout(layout);
QVERIFY(window.graphicsProxyWidget() == 0);
QVERIFY(checkbox->graphicsProxyWidget() == 0);
QVERIFY(!window.graphicsProxyWidget());
QVERIFY(!checkbox->graphicsProxyWidget());
QGraphicsProxyWidget *windowProxy = scene.addWidget(&window);
QGraphicsView view(&scene);
view.show();
view.resize(500,500);
QVERIFY(window.graphicsProxyWidget() == windowProxy);
QVERIFY(box->graphicsProxyWidget() == 0);
QVERIFY(checkbox->graphicsProxyWidget() == 0);
QCOMPARE(window.graphicsProxyWidget(), windowProxy);
QVERIFY(!box->graphicsProxyWidget());
QVERIFY(!checkbox->graphicsProxyWidget());
QPointer<QGraphicsProxyWidget> checkboxProxy = windowProxy->createProxyForChildWidget(checkbox);
QGraphicsProxyWidget *boxProxy = box->graphicsProxyWidget();
QVERIFY(boxProxy);
QVERIFY(checkbox->graphicsProxyWidget() == checkboxProxy);
QVERIFY(checkboxProxy->parentItem() == boxProxy);
QVERIFY(boxProxy->parentItem() == windowProxy);
QCOMPARE(checkbox->graphicsProxyWidget(), checkboxProxy.data());
QCOMPARE(checkboxProxy->parentItem(), boxProxy);
QCOMPARE(boxProxy->parentItem(), windowProxy);
QVERIFY(checkboxProxy->mapToScene(QPointF()) == checkbox->mapTo(&window, QPoint()));
QVERIFY(checkboxProxy->size() == checkbox->size());
QVERIFY(boxProxy->size() == box->size());
QCOMPARE(checkboxProxy->size().toSize(), checkbox->size());
QCOMPARE(boxProxy->size().toSize(), box->size());
window.resize(500,500);
QVERIFY(windowProxy->size() == QSize(500,500));
QCOMPARE(windowProxy->size().toSize(), QSize(500,500));
QVERIFY(checkboxProxy->mapToScene(QPointF()) == checkbox->mapTo(&window, QPoint()));
QVERIFY(checkboxProxy->size() == checkbox->size());
QVERIFY(boxProxy->size() == box->size());
QCOMPARE(checkboxProxy->size().toSize(), checkbox->size());
QCOMPARE(boxProxy->size().toSize(), box->size());
QTest::qWait(10);
@ -3064,9 +3064,9 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget()
boxProxy->setWidget(0);
QVERIFY(checkbox->graphicsProxyWidget() == 0);
QVERIFY(box->graphicsProxyWidget() == 0);
QVERIFY(checkboxProxy == 0);
QVERIFY(!checkbox->graphicsProxyWidget());
QVERIFY(!box->graphicsProxyWidget());
QVERIFY(checkboxProxy.isNull());
delete boxProxy;
}

View File

@ -4727,9 +4727,9 @@ void tst_QGraphicsScene::minimumRenderSize()
QTRY_VERIFY(view.repaints > viewRepaints);
viewRepaints = view.repaints;
QVERIFY(viewRepaints == bigParent->repaints);
QVERIFY(viewRepaints == smallChild->repaints);
QVERIFY(viewRepaints == smallerGrandChild->repaints);
QCOMPARE(viewRepaints, bigParent->repaints);
QCOMPARE(viewRepaints, smallChild->repaints);
QCOMPARE(viewRepaints, smallerGrandChild->repaints);
// Setting a minimum render size should cause a repaint
scene.setMinimumRenderSize(0.5);
@ -4738,9 +4738,9 @@ void tst_QGraphicsScene::minimumRenderSize()
QTRY_VERIFY(view.repaints > viewRepaints);
viewRepaints = view.repaints;
QVERIFY(viewRepaints == bigParent->repaints);
QVERIFY(viewRepaints == smallChild->repaints);
QVERIFY(viewRepaints == smallerGrandChild->repaints);
QCOMPARE(viewRepaints, bigParent->repaints);
QCOMPARE(viewRepaints, smallChild->repaints);
QCOMPARE(viewRepaints, smallerGrandChild->repaints);
// Scaling should cause a repaint of big items only.
view.scale(0.1, 0.1);
@ -4749,8 +4749,8 @@ void tst_QGraphicsScene::minimumRenderSize()
QTRY_VERIFY(view.repaints > viewRepaints);
viewRepaints = view.repaints;
QVERIFY(viewRepaints == bigParent->repaints);
QVERIFY(viewRepaints == smallChild->repaints);
QCOMPARE(viewRepaints, bigParent->repaints);
QCOMPARE(viewRepaints, smallChild->repaints);
QVERIFY(smallChild->repaints > smallerGrandChild->repaints);
// Scaling further should cause even fewer items to be repainted
@ -4760,7 +4760,7 @@ void tst_QGraphicsScene::minimumRenderSize()
QTRY_VERIFY(view.repaints > viewRepaints);
viewRepaints = view.repaints;
QVERIFY(viewRepaints == bigParent->repaints);
QCOMPARE(viewRepaints, bigParent->repaints);
QVERIFY(bigParent->repaints > smallChild->repaints);
QVERIFY(smallChild->repaints > smallerGrandChild->repaints);
}

View File

@ -3525,7 +3525,7 @@ void tst_QGraphicsView::embeddedViews()
v2->QWidget::render(&actual);
QTransform b = item->transform;
QVERIFY(a == b);
QCOMPARE(a, b);
delete v1;
}

View File

@ -1036,7 +1036,7 @@ void tst_QAbstractItemView::dragAndDropOnChild()
++successes;
}
QVERIFY(successes == 0);
QCOMPARE(successes, 0);
}
#endif // 0
@ -1214,7 +1214,7 @@ void tst_QAbstractItemView::setCurrentIndex()
view->setModel(model);
view->setCurrentIndex(model->index(0,0));
QVERIFY(view->currentIndex() == model->index(0,0));
QCOMPARE(view->currentIndex(), model->index(0,0));
view->setCurrentIndex(model->index(1,0));
QVERIFY(view->currentIndex() == model->index(result ? 1 : 0,0));
}

View File

@ -292,7 +292,7 @@ void tst_QColumnView::grips()
for (int i = 0 ; i < list.count(); ++i) {
if (QAbstractItemView *view = qobject_cast<QAbstractItemView*>(list.at(i))) {
if (view->isVisible())
QVERIFY(view->cornerWidget() == 0);
QVERIFY(!view->cornerWidget());
}
}
}
@ -587,7 +587,7 @@ void tst_QColumnView::selectAll()
QVERIFY(view.selectionModel()->selectedIndexes().count() > 0);
view.setCurrentIndex(QModelIndex());
QVERIFY(view.selectionModel()->selectedIndexes().count() == 0);
QCOMPARE(view.selectionModel()->selectedIndexes().count(), 0);
}
void tst_QColumnView::clicked()

View File

@ -403,7 +403,7 @@ void tst_QHeaderView::init()
view = new QHeaderView(Qt::Vertical,topLevel);
// Some initial value tests before a model is added
QCOMPARE(view->length(), 0);
QVERIFY(view->sizeHint() == QSize(0,0));
QCOMPARE(view->sizeHint(), QSize(0,0));
QCOMPARE(view->sectionSizeHint(0), -1);
/*
@ -925,9 +925,9 @@ void tst_QHeaderView::moveSection()
QFETCH(QList<int>, logical);
QFETCH(int, count);
QVERIFY(from.count() == to.count());
QVERIFY(from.count() == moved.count());
QVERIFY(view->count() == logical.count());
QCOMPARE(from.count(), to.count());
QCOMPARE(from.count(), moved.count());
QCOMPARE(view->count(), logical.count());
QSignalSpy spy1(view, SIGNAL(sectionMoved(int,int,int)));
QCOMPARE(view->sectionsMoved(), false);
@ -1370,15 +1370,15 @@ void tst_QHeaderView::unhideSection()
QCOMPARE(view->sectionsHidden(), false);
view->setSectionHidden(0, true);
QCOMPARE(view->sectionsHidden(), true);
QVERIFY(view->sectionSize(0) == 0);
QCOMPARE(view->sectionSize(0), 0);
view->setSectionResizeMode(QHeaderView::Interactive);
view->setSectionHidden(0, false);
QVERIFY(view->sectionSize(0) > 0);
view->setSectionHidden(0, true);
QVERIFY(view->sectionSize(0) == 0);
QCOMPARE(view->sectionSize(0), 0);
view->setSectionHidden(0, true);
QVERIFY(view->sectionSize(0) == 0);
QCOMPARE(view->sectionSize(0), 0);
view->setSectionResizeMode(QHeaderView::Stretch);
view->setSectionHidden(0, false);
QVERIFY(view->sectionSize(0) > 0);
@ -1645,7 +1645,7 @@ void tst_QHeaderView::saveRestore()
QByteArray s2 = h2.saveState();
QVERIFY(s1 == s2);
QCOMPARE(s1, s2);
QVERIFY(!h2.restoreState(QByteArrayLiteral("Garbage")));
// QTBUG-40462
@ -1659,7 +1659,7 @@ void tst_QHeaderView::saveRestore()
int sectionItemsLengthTotal = 0;
for (int i = 0; i < h2.count(); ++i)
sectionItemsLengthTotal += h2.sectionSize(i);
QVERIFY(sectionItemsLengthTotal == h2.length());
QCOMPARE(sectionItemsLengthTotal, h2.length());
// Buggy setting where sum(sectionItems) != length. Check false is returned and this corrupted
// state isn't restored
@ -1676,8 +1676,8 @@ void tst_QHeaderView::saveRestore()
// Check setting is correctly recognized as corrupted
QVERIFY(!h2.restoreState(settings_buggy_length));
// Check nothing has been actually restored
QVERIFY(h2.length() == old_length);
QVERIFY(h2.saveState() == old_state);
QCOMPARE(h2.length(), old_length);
QCOMPARE(h2.saveState(), old_state);
}
void tst_QHeaderView::defaultSectionSizeTest()
@ -1699,7 +1699,7 @@ void tst_QHeaderView::defaultSectionSizeTest()
// no hidden Sections
hv->resizeSection(1, 0);
hv->setDefaultSectionSize(defaultSize);
QVERIFY(hv->sectionSize(1) == defaultSize);
QCOMPARE(hv->sectionSize(1), defaultSize);
// with hidden sections
hv->resizeSection(1, 0);
@ -2277,7 +2277,7 @@ void tst_QHeaderView::QTBUG14242_hideSectionAutoSize()
for (int u = 0; u < hv->count(); ++u)
calced_length += hv->sectionSize(u);
QVERIFY(calced_length == afterlength);
QCOMPARE(calced_length, afterlength);
}
void tst_QHeaderView::ensureNoIndexAtLength()
@ -2286,9 +2286,9 @@ void tst_QHeaderView::ensureNoIndexAtLength()
QStandardItemModel amodel(4, 4);
qtv.setModel(&amodel);
QHeaderView *hv = qtv.verticalHeader();
QVERIFY(hv->visualIndexAt(hv->length()) == -1);
QCOMPARE(hv->visualIndexAt(hv->length()), -1);
hv->resizeSection(hv->count() - 1, 0);
QVERIFY(hv->visualIndexAt(hv->length()) == -1);
QCOMPARE(hv->visualIndexAt(hv->length()), -1);
}
void tst_QHeaderView::offsetConsistent()
@ -2307,7 +2307,7 @@ void tst_QHeaderView::offsetConsistent()
hv->hideSection(sectionToHide);
hv->setOffsetToSectionPosition(150);
int offset2 = hv->offset();
QVERIFY(offset1 == offset2);
QCOMPARE(offset1, offset2);
// Ensure that hidden indexes (still) is considered.
hv->resizeSection(sectionToHide, hv->sectionSize(200) * 2);
hv->setOffsetToSectionPosition(800);
@ -2600,8 +2600,8 @@ void tst_QHeaderView::logicalIndexAtTest()
//qDebug() << "logicalIndexAtTest" << check1 << check2;
const int precalced_check1 = 106327;
const int precalced_check2 = 29856418;
QVERIFY(precalced_check1 == check1);
QVERIFY(precalced_check2 == check2);
QCOMPARE(precalced_check1, check1);
QCOMPARE(precalced_check2, check2);
const int precalced_results[] = { 1145298384, -1710423344, -650981936, 372919464, -1544372176, -426463328, 12124 };
calculateAndCheck(__LINE__, precalced_results);
@ -2628,8 +2628,8 @@ void tst_QHeaderView::visualIndexAtTest()
//qDebug() << "visualIndexAtTest" << check1 << check2;
const int precalced_check1 = 72665;
const int precalced_check2 = 14015890;
QVERIFY(precalced_check1 == check1);
QVERIFY(precalced_check2 == check2);
QCOMPARE(precalced_check1, check1);
QCOMPARE(precalced_check2, check2);
const int precalced_results[] = { 1145298384, -1710423344, -1457520212, 169223959, 557466160, -324939600, 5453 };
calculateAndCheck(__LINE__, precalced_results);

View File

@ -804,9 +804,9 @@ void tst_QItemDelegate::dateTimeEditor()
dateTimeEditor->setTime(time.addSecs(600));
widget.clearFocus();
QVERIFY(item1->data(Qt::EditRole).userType() == QMetaType::QTime);
QVERIFY(item2->data(Qt::EditRole).userType() == QMetaType::QDate);
QVERIFY(item3->data(Qt::EditRole).userType() == QMetaType::QDateTime);
QCOMPARE(item1->data(Qt::EditRole).userType(), int(QMetaType::QTime));
QCOMPARE(item2->data(Qt::EditRole).userType(), int(QMetaType::QDate));
QCOMPARE(item3->data(Qt::EditRole).userType(), int(QMetaType::QDateTime));
}
// A delegate where we can either enforce a certain widget or use the standard widget.
@ -901,9 +901,9 @@ void tst_QItemDelegate::dateAndTimeEditorTest2()
s.setData(i1, datetime2);
editor = w.fastEdit(i1);
timeEdit = qobject_cast<QTimeEdit*>(editor);
QVERIFY(timeEdit == 0);
QVERIFY(!timeEdit);
dateEdit = qobject_cast<QDateEdit*>(editor);
QVERIFY(dateEdit == 0);
QVERIFY(!dateEdit);
dateTimeEdit = qobject_cast<QDateTimeEdit*>(editor);
QVERIFY(dateTimeEdit);
QCOMPARE(dateTimeEdit->dateTime(), datetime2);

View File

@ -552,7 +552,7 @@ void tst_QItemView::visualRect()
QFETCH(bool, displays);
if (!displays){
QVERIFY(view->visualRect(topIndex) == QRect());
QCOMPARE(view->visualRect(topIndex), QRect());
return;
}
@ -560,15 +560,15 @@ void tst_QItemView::visualRect()
view->show();
QVERIFY(view->visualRect(topIndex) != QRect());
QVERIFY(topIndex == view->indexAt(view->visualRect(topIndex).center()));
QVERIFY(topIndex == view->indexAt(view->visualRect(topIndex).bottomLeft()));
QVERIFY(topIndex == view->indexAt(view->visualRect(topIndex).bottomRight()));
QVERIFY(topIndex == view->indexAt(view->visualRect(topIndex).topLeft()));
QVERIFY(topIndex == view->indexAt(view->visualRect(topIndex).topRight()));
QCOMPARE(topIndex, view->indexAt(view->visualRect(topIndex).center()));
QCOMPARE(topIndex, view->indexAt(view->visualRect(topIndex).bottomLeft()));
QCOMPARE(topIndex, view->indexAt(view->visualRect(topIndex).bottomRight()));
QCOMPARE(topIndex, view->indexAt(view->visualRect(topIndex).topLeft()));
QCOMPARE(topIndex, view->indexAt(view->visualRect(topIndex).topRight()));
testViews->hideIndexes(view);
QModelIndex hiddenIndex = treeModel->index(1, 0);
QVERIFY(view->visualRect(hiddenIndex) == QRect());
QCOMPARE(view->visualRect(hiddenIndex), QRect());
}
void tst_QItemView::walkScreen(QAbstractItemView *view)
@ -616,7 +616,7 @@ void walkIndex(QModelIndex index, QAbstractItemView *view)
if (view->indexAt(point) != index) {
qDebug() << "index" << index << "visualRect" << visualRect << point << view->indexAt(point);
}
QVERIFY(view->indexAt(point) == index);
QCOMPARE(view->indexAt(point), index);
}
}

View File

@ -2456,10 +2456,10 @@ void tst_QListView::horizontalScrollingByVerticalWheelEvents()
QVERIFY(lv.horizontalScrollBar()->value() > hValue);
QApplication::sendEvent(lv.viewport(), &wheelUpEvent);
QVERIFY(lv.horizontalScrollBar()->value() == hValue);
QCOMPARE(lv.horizontalScrollBar()->value(), hValue);
QApplication::sendEvent(lv.viewport(), &wheelLeftDownEvent);
QVERIFY(lv.horizontalScrollBar()->value() == hValue);
QCOMPARE(lv.horizontalScrollBar()->value(), hValue);
// ensure that vertical wheel events are not converted when vertical
// scroll bar is not visible but vertical scrolling is possible

View File

@ -427,9 +427,9 @@ void tst_QListWidget::currentItem()
// actual test
QModelIndex currentIndex = testWidget->selectionModel()->currentIndex();
if (currentIndex.isValid())
QVERIFY(testWidget->currentItem() == testWidget->item(currentIndex.row()));
QCOMPARE(testWidget->currentItem(), testWidget->item(currentIndex.row()));
else
QVERIFY(testWidget->currentItem() == (QListWidgetItem*)0);
QCOMPARE(testWidget->currentItem(), (QListWidgetItem*)0);
}
void tst_QListWidget::currentRow()
@ -742,7 +742,7 @@ void tst_QListWidget::selectedItems()
QFETCH(IntList, selectedRows);
QFETCH(IntList, expectedRows);
QVERIFY(testWidget->count() == 0);
QCOMPARE(testWidget->count(), 0);
//insert items
for (int i=0; i<itemCount; ++i)
@ -1159,7 +1159,7 @@ void tst_QListWidget::setData()
QFETCH(int, expectedSignalCount);
qRegisterMetaType<QListWidgetItem *>("QListWidgetItem*");
QVERIFY(roles.count() == values.count());
QCOMPARE(roles.count(), values.count());
for (int manipulateModel=0; manipulateModel<2; ++manipulateModel) {
testWidget->clear();
@ -1711,7 +1711,7 @@ void tst_QListWidget::mimeData()
QVERIFY(data->hasFormat(format));
QVERIFY(data2->hasFormat(format));
QVERIFY(data->data(format) == data2->data(format));
QCOMPARE(data->data(format), data2->data(format));
delete data;
delete data2;

View File

@ -196,9 +196,9 @@ void tst_QTableWidget::clearContents()
{
QTableWidgetItem *item = new QTableWidgetItem("test");
testWidget->setHorizontalHeaderItem(0, item);
QVERIFY(testWidget->horizontalHeaderItem(0) == item);
QCOMPARE(testWidget->horizontalHeaderItem(0), item);
testWidget->clearContents();
QVERIFY(testWidget->horizontalHeaderItem(0) == item);
QCOMPARE(testWidget->horizontalHeaderItem(0), item);
}
void tst_QTableWidget::clear()
@ -1559,7 +1559,7 @@ void tst_QTableWidget::mimeData()
QVERIFY(data->hasFormat(format));
QVERIFY(data2->hasFormat(format));
QVERIFY(data->data(format) == data2->data(format));
QCOMPARE(data->data(format), data2->data(format));
delete data;
delete data2;

View File

@ -3657,7 +3657,7 @@ void tst_QTreeView::task202039_closePersistentEditor()
QVERIFY(view.indexWidget(current));
view.closePersistentEditor(current);
QVERIFY(view.indexWidget(current) == 0);
QVERIFY(!view.indexWidget(current));
//here was the bug: closing the persistent editor would not reset the state
//and it was impossible to go into editinon again

View File

@ -1586,7 +1586,7 @@ void tst_QTreeWidget::scrollToItem()
testWidget->setHeaderLabels(QStringList() << "foo");
testWidget->scrollToItem(search);
QVERIFY(search->text(0) == "111");
QCOMPARE(search->text(0), QLatin1String("111"));
bar = search->parent();
QVERIFY(testWidget->isItemExpanded(bar));
@ -2287,7 +2287,7 @@ void tst_QTreeWidget::insertExpandedItemsWithSorting()
QCOMPARE(parent->childCount(), childText.count());
QVERIFY(parent->isExpanded());
}
QVERIFY(tree.model()->rowCount() == parentText.count());
QCOMPARE(tree.model()->rowCount(), parentText.count());
// verify that the items are still expanded
foreach (QTreeWidgetItem *item, items) {
@ -2659,7 +2659,7 @@ void tst_QTreeWidget::sortedIndexOfChild()
tw.sortItems(0, (Qt::SortOrder)sortOrder);
tw.expandAll();
QVERIFY(itms.count() == expectedIndexes.count());
QCOMPARE(itms.count(), expectedIndexes.count());
for (int j = 0; j < expectedIndexes.count(); ++j)
QCOMPARE(top->indexOfChild(itms.at(j)), expectedIndexes.at(j));
}
@ -3235,7 +3235,7 @@ void tst_QTreeWidget::setCurrentItemExpandsParent()
QTreeWidgetItem *i1 = new QTreeWidgetItem(&w, QStringList() << "parent");
QTreeWidgetItem *i2 = new QTreeWidgetItem(i1, QStringList() << "child");
QVERIFY(!i2->isExpanded());
QVERIFY(w.currentItem() == 0);
QVERIFY(!w.currentItem());
w.setCurrentItem(i2);
QVERIFY(!i2->isExpanded());
QCOMPARE(w.currentItem(), i2);

View File

@ -1112,13 +1112,13 @@ void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget()
delete item;
item = *it;
if (expecteditemIsNull) {
QVERIFY(item == 0);
QVERIFY(!item);
} else {
QVERIFY(item);
QCOMPARE(item->text(0), expecteditemvalue);
item = *itRemove;
if (expectedUpdatedCurrent.isNull()) {
QVERIFY(item == 0);
QVERIFY(!item);
} else {
QCOMPARE(item->text(0), expectedUpdatedCurrent);
}

View File

@ -242,7 +242,7 @@ void tst_QAction::setStandardKeys()
QList<QKeySequence> list;
act.setShortcuts(list);
act.setShortcuts(QKeySequence::Copy);
QVERIFY(act.shortcut() == act.shortcuts().first());
QCOMPARE(act.shortcut(), act.shortcuts().first());
QList<QKeySequence> expected;
const QKeySequence ctrlC = QKeySequence(QStringLiteral("CTRL+C"));

View File

@ -224,7 +224,7 @@ void tst_QActionGroup::unCheckCurrentAction()
current->setChecked(false);
QVERIFY(!action1.isChecked());
QVERIFY(!action2.isChecked());
QVERIFY(group.checkedAction() == 0);
QVERIFY(!group.checkedAction());
}

View File

@ -1158,7 +1158,7 @@ void tst_QApplication::sendPostedEvents()
QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);
QPointer<SendPostedEventsTester> p = tester;
(void) app.exec();
QVERIFY(p == 0);
QVERIFY(p.isNull());
}
void tst_QApplication::thread()
@ -1176,8 +1176,8 @@ void tst_QApplication::thread()
// *before* the QApplication has a thread
QObject object;
QObject child(&object);
QVERIFY(object.thread() == currentThread);
QVERIFY(child.thread() == currentThread);
QCOMPARE(object.thread(), currentThread);
QCOMPARE(child.thread(), currentThread);
{
int argc = 0;
@ -1207,8 +1207,8 @@ void tst_QApplication::thread()
QVERIFY(!currentThread->isFinished());
// should still have a thread
QVERIFY(object.thread() == currentThread);
QVERIFY(child.thread() == currentThread);
QCOMPARE(object.thread(), currentThread);
QCOMPARE(child.thread(), currentThread);
// do the test again, making sure that the thread is the same as
// before
@ -1229,8 +1229,8 @@ void tst_QApplication::thread()
QVERIFY(!currentThread->isFinished());
// should still have a thread
QVERIFY(object.thread() == currentThread);
QVERIFY(child.thread() == currentThread);
QCOMPARE(object.thread(), currentThread);
QCOMPARE(child.thread(), currentThread);
QTestEventLoop::instance().enterLoop(1);
}
@ -1244,8 +1244,8 @@ void tst_QApplication::thread()
QVERIFY(!currentThread->isFinished());
// should still have a thread
QVERIFY(object.thread() == currentThread);
QVERIFY(child.thread() == currentThread);
QCOMPARE(object.thread(), currentThread);
QCOMPARE(child.thread(), currentThread);
}
class DeleteLaterWidget : public QWidget
@ -1559,9 +1559,9 @@ void tst_QApplication::focusChanged()
QCOMPARE(spy.at(0).count(), 2);
old = qvariant_cast<QWidget*>(spy.at(0).at(0));
now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &le1);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == 0);
QCOMPARE(now, &le1);
QCOMPARE(now, QApplication::focusWidget());
QVERIFY(!old);
spy.clear();
QCOMPARE(spy.count(), 0);
@ -1569,27 +1569,27 @@ void tst_QApplication::focusChanged()
QCOMPARE(spy.count(), 1);
old = qvariant_cast<QWidget*>(spy.at(0).at(0));
now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &pb1);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &le1);
QCOMPARE(now, &pb1);
QCOMPARE(now, QApplication::focusWidget());
QCOMPARE(old, &le1);
spy.clear();
lb1.setFocus();
QCOMPARE(spy.count(), 1);
old = qvariant_cast<QWidget*>(spy.at(0).at(0));
now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &lb1);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &pb1);
QCOMPARE(now, &lb1);
QCOMPARE(now, QApplication::focusWidget());
QCOMPARE(old, &pb1);
spy.clear();
lb1.clearFocus();
QCOMPARE(spy.count(), 1);
old = qvariant_cast<QWidget*>(spy.at(0).at(0));
now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == 0);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &lb1);
QVERIFY(!now);
QCOMPARE(now, QApplication::focusWidget());
QCOMPARE(old, &lb1);
spy.clear();
QWidget parent2;
@ -1606,9 +1606,9 @@ void tst_QApplication::focusChanged()
QVERIFY(spy.count() > 0); // one for deactivation, one for activation on Windows
old = qvariant_cast<QWidget*>(spy.at(spy.count()-1).at(0));
now = qvariant_cast<QWidget*>(spy.at(spy.count()-1).at(1));
QVERIFY(now == &le2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == 0);
QCOMPARE(now, &le2);
QCOMPARE(now, QApplication::focusWidget());
QVERIFY(!old);
spy.clear();
QTestKeyEvent tab(QTest::Press, Qt::Key_Tab, 0, 0);
@ -1630,82 +1630,82 @@ void tst_QApplication::focusChanged()
tab.simulate(now);
if (!tabAllControls) {
QVERIFY(spy.count() == 0);
QVERIFY(now == QApplication::focusWidget());
QCOMPARE(spy.count(), 0);
QCOMPARE(now, QApplication::focusWidget());
} else {
QVERIFY(spy.count() > 0);
old = qvariant_cast<QWidget*>(spy.at(0).at(0));
now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &pb2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &le2);
QCOMPARE(now, &pb2);
QCOMPARE(now, QApplication::focusWidget());
QCOMPARE(old, &le2);
spy.clear();
}
if (!tabAllControls) {
QVERIFY(spy.count() == 0);
QVERIFY(now == QApplication::focusWidget());
QCOMPARE(spy.count(), 0);
QCOMPARE(now, QApplication::focusWidget());
} else {
tab.simulate(now);
QVERIFY(spy.count() > 0);
old = qvariant_cast<QWidget*>(spy.at(0).at(0));
now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &le2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &pb2);
QCOMPARE(now, &le2);
QCOMPARE(now, QApplication::focusWidget());
QCOMPARE(old, &pb2);
spy.clear();
}
if (!tabAllControls) {
QVERIFY(spy.count() == 0);
QVERIFY(now == QApplication::focusWidget());
QCOMPARE(spy.count(), 0);
QCOMPARE(now, QApplication::focusWidget());
} else {
backtab.simulate(now);
QVERIFY(spy.count() > 0);
old = qvariant_cast<QWidget*>(spy.at(0).at(0));
now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &pb2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &le2);
QCOMPARE(now, &pb2);
QCOMPARE(now, QApplication::focusWidget());
QCOMPARE(old, &le2);
spy.clear();
}
if (!tabAllControls) {
QVERIFY(spy.count() == 0);
QVERIFY(now == QApplication::focusWidget());
QCOMPARE(spy.count(), 0);
QCOMPARE(now, QApplication::focusWidget());
old = &pb2;
} else {
backtab.simulate(now);
QVERIFY(spy.count() > 0);
old = qvariant_cast<QWidget*>(spy.at(0).at(0));
now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &le2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &pb2);
QCOMPARE(now, &le2);
QCOMPARE(now, QApplication::focusWidget());
QCOMPARE(old, &pb2);
spy.clear();
}
click.simulate(old);
if (!(pb2.focusPolicy() & Qt::ClickFocus)) {
QVERIFY(spy.count() == 0);
QVERIFY(now == QApplication::focusWidget());
QCOMPARE(spy.count(), 0);
QCOMPARE(now, QApplication::focusWidget());
} else {
QVERIFY(spy.count() > 0);
old = qvariant_cast<QWidget*>(spy.at(0).at(0));
now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &pb2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &le2);
QCOMPARE(now, &pb2);
QCOMPARE(now, QApplication::focusWidget());
QCOMPARE(old, &le2);
spy.clear();
click.simulate(old);
QVERIFY(spy.count() > 0);
old = qvariant_cast<QWidget*>(spy.at(0).at(0));
now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &le2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &pb2);
QCOMPARE(now, &le2);
QCOMPARE(now, QApplication::focusWidget());
QCOMPARE(old, &pb2);
spy.clear();
}
@ -1720,9 +1720,9 @@ void tst_QApplication::focusChanged()
else
old = qvariant_cast<QWidget*>(spy.at(spy.count()-2).at(0));
now = qvariant_cast<QWidget*>(spy.at(spy.count()-1).at(1));
QVERIFY(now == &le1);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &le2);
QCOMPARE(now, &le1);
QCOMPARE(now, QApplication::focusWidget());
QCOMPARE(old, &le2);
spy.clear();
}

View File

@ -131,8 +131,8 @@ void tst_QBoxLayout::insertSpacerItem()
layout->insertSpacerItem(0, spacer2);
window.setLayout(layout);
QVERIFY(layout->itemAt(0) == spacer2);
QVERIFY(layout->itemAt(2) == spacer1);
QCOMPARE(layout->itemAt(0), spacer2);
QCOMPARE(layout->itemAt(2), spacer1);
window.show();
}

View File

@ -165,13 +165,13 @@ void tst_QFormLayout::buddies()
QLineEdit *le2 = new QLineEdit;
fl->addRow(0, le2);
QWidget *label2 = fl->labelForField(le2);
QVERIFY(label2 == 0);
QVERIFY(!label2);
//no label
QLineEdit *le3 = new QLineEdit;
fl->addRow(le3);
QWidget *label3 = fl->labelForField(le3);
QVERIFY(label3 == 0);
QVERIFY(!label3);
//TODO: empty label?
}
@ -389,18 +389,18 @@ void tst_QFormLayout::setFormStyle()
#if 0 // QT_NO_STYLE_PLASTIQUE
widget.setStyle(new QPlastiqueStyle());
QVERIFY(layout.labelAlignment() == Qt::AlignRight);
QCOMPARE(layout.labelAlignment(), Qt::AlignRight);
QVERIFY(layout.formAlignment() == (Qt::AlignLeft | Qt::AlignTop));
QVERIFY(layout.fieldGrowthPolicy() == QFormLayout::ExpandingFieldsGrow);
QVERIFY(layout.rowWrapPolicy() == QFormLayout::DontWrapRows);
QCOMPARE(layout.fieldGrowthPolicy(), QFormLayout::ExpandingFieldsGrow);
QCOMPARE(layout.rowWrapPolicy(), QFormLayout::DontWrapRows);
#endif
widget.setStyle(QStyleFactory::create("windows"));
QVERIFY(layout.labelAlignment() == Qt::AlignLeft);
QCOMPARE(layout.labelAlignment(), Qt::AlignLeft);
QVERIFY(layout.formAlignment() == (Qt::AlignLeft | Qt::AlignTop));
QVERIFY(layout.fieldGrowthPolicy() == QFormLayout::AllNonFixedFieldsGrow);
QVERIFY(layout.rowWrapPolicy() == QFormLayout::DontWrapRows);
QCOMPARE(layout.fieldGrowthPolicy(), QFormLayout::AllNonFixedFieldsGrow);
QCOMPARE(layout.rowWrapPolicy(), QFormLayout::DontWrapRows);
/* can't directly create mac style or qtopia style, since
this test is cross platform.. so create dummy styles that
@ -408,17 +408,17 @@ void tst_QFormLayout::setFormStyle()
*/
widget.setStyle(new DummyMacStyle());
QVERIFY(layout.labelAlignment() == Qt::AlignRight);
QCOMPARE(layout.labelAlignment(), Qt::AlignRight);
QVERIFY(layout.formAlignment() == (Qt::AlignHCenter | Qt::AlignTop));
QVERIFY(layout.fieldGrowthPolicy() == QFormLayout::FieldsStayAtSizeHint);
QVERIFY(layout.rowWrapPolicy() == QFormLayout::DontWrapRows);
QCOMPARE(layout.fieldGrowthPolicy(), QFormLayout::FieldsStayAtSizeHint);
QCOMPARE(layout.rowWrapPolicy(), QFormLayout::DontWrapRows);
widget.setStyle(new DummyQtopiaStyle());
QVERIFY(layout.labelAlignment() == Qt::AlignRight);
QCOMPARE(layout.labelAlignment(), Qt::AlignRight);
QVERIFY(layout.formAlignment() == (Qt::AlignLeft | Qt::AlignTop));
QVERIFY(layout.fieldGrowthPolicy() == QFormLayout::AllNonFixedFieldsGrow);
QVERIFY(layout.rowWrapPolicy() == QFormLayout::WrapLongRows);
QCOMPARE(layout.fieldGrowthPolicy(), QFormLayout::AllNonFixedFieldsGrow);
QCOMPARE(layout.rowWrapPolicy(), QFormLayout::WrapLongRows);
}
void tst_QFormLayout::setFieldGrowthPolicy()
@ -443,14 +443,14 @@ void tst_QFormLayout::setFieldGrowthPolicy()
layout.activate();
if (i == 0) {
QVERIFY(fld1.width() == fld2.width());
QVERIFY(fld2.width() == fld3.width());
QCOMPARE(fld1.width(), fld2.width());
QCOMPARE(fld2.width(), fld3.width());
} else if (i == 1) {
QVERIFY(fld1.width() == fld2.width());
QCOMPARE(fld1.width(), fld2.width());
QVERIFY(fld2.width() < fld3.width());
} else {
QVERIFY(fld1.width() < fld2.width());
QVERIFY(fld2.width() == fld3.width());
QCOMPARE(fld2.width(), fld3.width());
}
}
}
@ -639,17 +639,17 @@ void tst_QFormLayout::insertRow_QString_QWidget()
layout->insertRow(-5, "&Name:", fld1);
QLabel *label1 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label1 != 0);
QVERIFY(label1->buddy() == fld1);
QCOMPARE(label1->buddy(), fld1);
layout->insertRow(0, "&Email:", fld2);
QLabel *label2 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label2 != 0);
QVERIFY(label2->buddy() == fld2);
QCOMPARE(label2->buddy(), fld2);
layout->insertRow(5, "&Age:", fld3);
QLabel *label3 = qobject_cast<QLabel *>(layout->itemAt(2, QFormLayout::LabelRole)->widget());
QVERIFY(label3 != 0);
QVERIFY(label3->buddy() == fld3);
QCOMPARE(label3->buddy(), fld3);
}
void tst_QFormLayout::insertRow_QString_QLayout()
@ -663,21 +663,21 @@ void tst_QFormLayout::insertRow_QString_QLayout()
layout->insertRow(-5, "&Name:", fld1);
QLabel *label1 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label1 != 0);
QVERIFY(label1->buddy() == 0);
QVERIFY(!label1->buddy());
QCOMPARE(layout->rowCount(), 1);
layout->insertRow(0, "&Email:", fld2);
QLabel *label2 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label2 != 0);
QVERIFY(label2->buddy() == 0);
QVERIFY(!label2->buddy());
QCOMPARE(layout->rowCount(), 2);
layout->insertRow(5, "&Age:", fld3);
QLabel *label3 = qobject_cast<QLabel *>(layout->itemAt(2, QFormLayout::LabelRole)->widget());
QVERIFY(label3 != 0);
QVERIFY(label3->buddy() == 0);
QVERIFY(!label3->buddy());
QCOMPARE(layout->rowCount(), 3);
}

View File

@ -218,12 +218,12 @@ void tst_QLayout::setLayoutBugs()
}
widget.setLayout(hBoxLayout);
QVERIFY(widget.layout() == hBoxLayout);
QCOMPARE(widget.layout(), hBoxLayout);
QWidget containerWidget(0);
containerWidget.setLayout(widget.layout());
QVERIFY(widget.layout() == 0);
QVERIFY(containerWidget.layout() == hBoxLayout);
QVERIFY(!widget.layout());
QCOMPARE(containerWidget.layout(), hBoxLayout);
}
class MyLayout : public QLayout

View File

@ -3373,7 +3373,7 @@ void tst_QWidget::widgetAt()
#if defined(Q_OS_WINCE)
QEXPECT_FAIL("", "Windows CE does only support rectangular regions", Continue); //See also task 147191
#endif
QTRY_VERIFY(QApplication::widgetAt(testPos) == w1.data());
QTRY_COMPARE(QApplication::widgetAt(testPos), w1.data());
QTRY_VERIFY(QApplication::widgetAt(testPos + QPoint(1, 1)) == w2.data());
}
@ -3420,24 +3420,24 @@ void tst_QWidget::testDeletionInEventHandlers()
QPointer<Widget> w = new Widget;
w->deleteThis = true;
w->close();
QVERIFY(w == 0);
QVERIFY(w.isNull());
delete w;
// focusOut (crashes)
//w = new Widget;
//w->show();
//w->setFocus();
//QVERIFY(qApp->focusWidget() == w);
//QCOMPARE(qApp->focusWidget(), w);
//w->deleteThis = true;
//w->clearFocus();
//QVERIFY(w == 0);
//QVERIFY(w.isNull());
// key press
w = new Widget;
w->show();
w->deleteThis = true;
QTest::keyPress(w, Qt::Key_A);
QVERIFY(w == 0);
QVERIFY(w.isNull());
delete w;
// key release
@ -3445,7 +3445,7 @@ void tst_QWidget::testDeletionInEventHandlers()
w->show();
w->deleteThis = true;
QTest::keyRelease(w, Qt::Key_A);
QVERIFY(w == 0);
QVERIFY(w.isNull());
delete w;
// mouse press
@ -3453,7 +3453,7 @@ void tst_QWidget::testDeletionInEventHandlers()
w->show();
w->deleteThis = true;
QTest::mousePress(w, Qt::LeftButton);
QVERIFY(w == 0);
QVERIFY(w.isNull());
delete w;
// mouse release
@ -3462,7 +3462,7 @@ void tst_QWidget::testDeletionInEventHandlers()
w->deleteThis = true;
QMouseEvent me(QEvent::MouseButtonRelease, QPoint(1, 1), Qt::LeftButton, Qt::LeftButton, 0);
qApp->notify(w, &me);
QVERIFY(w == 0);
QVERIFY(w.isNull());
delete w;
// mouse double click
@ -3470,7 +3470,7 @@ void tst_QWidget::testDeletionInEventHandlers()
w->show();
w->deleteThis = true;
QTest::mouseDClick(w, Qt::LeftButton);
QVERIFY(w == 0);
QVERIFY(w.isNull());
delete w;
// hide event (crashes)
@ -3478,13 +3478,13 @@ void tst_QWidget::testDeletionInEventHandlers()
//w->show();
//w->deleteThis = true;
//w->hide();
//QVERIFY(w == 0);
//QVERIFY(w.isNull());
// action event
w = new Widget;
w->deleteThis = true;
w->addAction(new QAction(w));
QVERIFY(w == 0);
QVERIFY(w.isNull());
delete w;
// change event
@ -3492,7 +3492,7 @@ void tst_QWidget::testDeletionInEventHandlers()
w->show();
w->deleteThis = true;
w->setMouseTracking(true);
QVERIFY(w == 0);
QVERIFY(w.isNull());
delete w;
w = new Widget;
@ -3501,7 +3501,7 @@ void tst_QWidget::testDeletionInEventHandlers()
w->deleteThis = true;
me = QMouseEvent(QEvent::MouseMove, QPoint(0, 0), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
QApplication::sendEvent(w, &me);
QVERIFY(w == 0);
QVERIFY(w.isNull());
delete w;
}
@ -3931,7 +3931,7 @@ void tst_QWidget::winIdChangeEvent()
QCOMPARE(winIdBefore, winIdAfter);
QCOMPARE(child.winIdChangeEventCount(), 3);
// winId is set to zero during reparenting
QVERIFY(0 == child.m_winIdList[1]);
QCOMPARE(WId(0), child.m_winIdList[1]);
}
{
@ -3971,7 +3971,7 @@ void tst_QWidget::winIdChangeEvent()
QCOMPARE(winIdBefore, winIdAfter);
QCOMPARE(child.winIdChangeEventCount(), 3);
// winId is set to zero during reparenting
QVERIFY(0 == child.m_winIdList[1]);
QCOMPARE(WId(0), child.m_winIdList[1]);
}
}
@ -10484,7 +10484,7 @@ void tst_QWidget::qmlSetParentHelper()
QWidget child;
QVERIFY(QAbstractDeclarativeData::setWidgetParent);
QAbstractDeclarativeData::setWidgetParent(&child, &parent);
QVERIFY(child.parentWidget() == &parent);
QCOMPARE(child.parentWidget(), &parent);
QAbstractDeclarativeData::setWidgetParent(&child, 0);
QVERIFY(!child.parentWidget());
#else

View File

@ -138,14 +138,14 @@ void tst_QWidgetAction::defaultWidget()
action->setDefaultWidget(combo);
tb1.addAction(action);
QVERIFY(combo->parent() == &tb1);
QCOMPARE(combo->parent(), &tb1);
qApp->processEvents();
qApp->processEvents();
QVERIFY(combo->isVisible());
// not supported, not supposed to work, hence the parent() check
tb2.addAction(action);
QVERIFY(combo->parent() == &tb1);
QCOMPARE(combo->parent(), &tb1);
tb2.removeAction(action);
tb1.removeAction(action);
@ -156,11 +156,11 @@ void tst_QWidgetAction::defaultWidget()
tb2.addAction(action);
qApp->processEvents(); //the call to hide is delayd by the toolbar layout
qApp->processEvents();
QVERIFY(combo->parent() == &tb2);
QCOMPARE(combo->parent(), &tb2);
QVERIFY(combo->isVisible());
tb1.addAction(action);
QVERIFY(combo->parent() == &tb2);
QCOMPARE(combo->parent(), &tb2);
delete action;
QVERIFY(!combo);
@ -171,17 +171,17 @@ void tst_QWidgetAction::defaultWidget()
QPointer<QComboBox> combo1 = new QComboBox;
a->setDefaultWidget(combo1);
QVERIFY(a->defaultWidget() == combo1);
QCOMPARE(a->defaultWidget(), combo1.data());
a->setDefaultWidget(combo1);
QVERIFY(combo1);
QVERIFY(a->defaultWidget() == combo1);
QCOMPARE(a->defaultWidget(), combo1.data());
QPointer<QComboBox> combo2 = new QComboBox;
QVERIFY(combo1 != combo2);
a->setDefaultWidget(combo2);
QVERIFY(!combo1);
QVERIFY(a->defaultWidget() == combo2);
QCOMPARE(a->defaultWidget(), combo2.data());
delete a;
QVERIFY(!combo2);
@ -253,7 +253,7 @@ void tst_QWidgetAction::customWidget()
combos = action->createdWidgets();
QCOMPARE(combos.count(), 2);
QVERIFY(combos.at(0) == combo1);
QCOMPARE(combos.at(0), combo1.data());
QPointer<QComboBox> combo2 = qobject_cast<QComboBox *>(combos.at(1));
QVERIFY(combo2);
@ -277,7 +277,7 @@ void tst_QWidgetAction::keepOwnership()
{
QToolBar *tb = new QToolBar;
tb->addAction(action);
QVERIFY(combo->parent() == tb);
QCOMPARE(combo->parent(), tb);
delete tb;
}

View File

@ -84,13 +84,13 @@ void tst_QWidgetsVariant::constructor_invalid()
QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:"));
QVariant variant(static_cast<QVariant::Type>(typeId));
QVERIFY(!variant.isValid());
QVERIFY(variant.userType() == QMetaType::UnknownType);
QCOMPARE(variant.userType(), int(QMetaType::UnknownType));
}
{
QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:"));
QVariant variant(typeId, /* copy */ 0);
QVERIFY(!variant.isValid());
QVERIFY(variant.userType() == QMetaType::UnknownType);
QCOMPARE(variant.userType(), int(QMetaType::UnknownType));
}
}
@ -208,7 +208,7 @@ void tst_QWidgetsVariant::qvariant_cast_QObject_derived()
CustomQWidget customWidget;
QWidget *widget = &customWidget;
QVariant data = QVariant::fromValue(widget);
QVERIFY(data.userType() == qMetaTypeId<QWidget*>());
QCOMPARE(data.userType(), qMetaTypeId<QWidget*>());
QCOMPARE(data.value<QObject*>(), widget);
QCOMPARE(data.value<QWidget*>(), widget);

View File

@ -327,7 +327,7 @@ void tst_QWindowContainer::testDockWidget()
QTest::qWait(1000);
dock->setFloating(false);
QTRY_VERIFY(window->parent() == mainWindow.window()->windowHandle());
QTRY_COMPARE(window->parent(), mainWindow.window()->windowHandle());
}
QTEST_MAIN(tst_QWindowContainer)

View File

@ -214,12 +214,12 @@ void tst_QStyle::testProxyStyle()
QProxyStyle *proxyStyle = new QProxyStyle();
QVERIFY(proxyStyle->baseStyle());
QStyle *style = QStyleFactory::create("Windows");
QVERIFY(style->proxy() == style);
QCOMPARE(style->proxy(), style);
proxyStyle->setBaseStyle(style);
QVERIFY(style->proxy() == proxyStyle);
QVERIFY(style->parent() == proxyStyle);
QVERIFY(proxyStyle->baseStyle() == style);
QCOMPARE(style->proxy(), proxyStyle);
QCOMPARE(style->parent(), proxyStyle);
QCOMPARE(proxyStyle->baseStyle(), style);
QVERIFY(testAllFunctions(proxyStyle));
proxyStyle->setBaseStyle(0);
@ -236,7 +236,7 @@ void tst_QStyle::testProxyStyle()
QLineEdit edit;
edit.setStyle(&customStyle);
QVERIFY(!customStyle.parent());
QVERIFY(edit.style()->pixelMetric(QStyle::PM_ButtonIconSize) == 13);
QCOMPARE(edit.style()->pixelMetric(QStyle::PM_ButtonIconSize), 13);
}
void tst_QStyle::drawItemPixmap()

View File

@ -178,45 +178,49 @@ void tst_QStyleSheetStyle::numinstances()
void tst_QStyleSheetStyle::widgetsBeforeAppStyleSheet()
{
QPushButton w1; // widget with no stylesheet
const QColor red(Qt::red);
const QColor white(Qt::white);
qApp->setStyleSheet("* { color: red; }");
QVERIFY(COLOR(w1) == QColor("red"));
QCOMPARE(COLOR(w1), red);
w1.setStyleSheet("color: white");
QVERIFY(COLOR(w1) == QColor("white"));
QCOMPARE(COLOR(w1), white);
qApp->setStyleSheet("");
QVERIFY(COLOR(w1) == QColor("white"));
QCOMPARE(COLOR(w1), white);
w1.setStyleSheet("");
QVERIFY(COLOR(w1) == APPCOLOR(w1));
QCOMPARE(COLOR(w1), APPCOLOR(w1));
}
class FriendlySpinBox : public QSpinBox { friend class tst_QStyleSheetStyle; };
void tst_QStyleSheetStyle::widgetsAfterAppStyleSheet()
{
const QColor red(Qt::red);
const QColor white(Qt::white);
qApp->setStyleSheet("* { color: red; font-size: 32pt; }");
QPushButton w1;
FriendlySpinBox spin;
QVERIFY(COLOR(w1) == QColor("red"));
QVERIFY(COLOR(spin) == QColor("red"));
QVERIFY(COLOR(*spin.lineEdit()) == QColor("red"));
QCOMPARE(COLOR(w1), red);
QCOMPARE(COLOR(spin), red);
QCOMPARE(COLOR(*spin.lineEdit()), red);
QCOMPARE(FONTSIZE(w1), 32);
QCOMPARE(FONTSIZE(spin), 32);
QCOMPARE(FONTSIZE(*spin.lineEdit()), 32);
w1.setStyleSheet("color: white");
QVERIFY(COLOR(w1) == QColor("white"));
QVERIFY(COLOR(spin) == QColor("red"));
QVERIFY(COLOR(*spin.lineEdit()) == QColor("red"));
QCOMPARE(COLOR(w1), white);
QCOMPARE(COLOR(spin), red);
QCOMPARE(COLOR(*spin.lineEdit()), red);
w1.setStyleSheet("");
QVERIFY(COLOR(w1) == QColor("red"));
QVERIFY(COLOR(spin) == QColor("red"));
QVERIFY(COLOR(*spin.lineEdit()) == QColor("red"));
QCOMPARE(COLOR(w1), red);
QCOMPARE(COLOR(spin), red);
QCOMPARE(COLOR(*spin.lineEdit()), red);
w1.setStyleSheet("color: white");
QVERIFY(COLOR(w1) == QColor("white"));
QCOMPARE(COLOR(w1), white);
qApp->setStyleSheet("");
QVERIFY(COLOR(w1) == QColor("white"));
QVERIFY(COLOR(spin) == APPCOLOR(spin));
QVERIFY(COLOR(*spin.lineEdit()) == APPCOLOR(*spin.lineEdit()));
QCOMPARE(COLOR(w1), white);
QCOMPARE(COLOR(spin), APPCOLOR(spin));
QCOMPARE(COLOR(*spin.lineEdit()), APPCOLOR(*spin.lineEdit()));
w1.setStyleSheet("");
QVERIFY(COLOR(w1) == APPCOLOR(w1));
QCOMPARE(COLOR(w1), APPCOLOR(w1));
// QCOMPARE(FONTSIZE(w1), APPFONTSIZE(w1)); //### task 244261
QCOMPARE(FONTSIZE(spin), APPFONTSIZE(spin));
//QCOMPARE(FONTSIZE(*spin.lineEdit()), APPFONTSIZE(*spin.lineEdit())); //### task 244261
@ -224,121 +228,135 @@ void tst_QStyleSheetStyle::widgetsAfterAppStyleSheet()
void tst_QStyleSheetStyle::applicationStyleSheet()
{
const QColor red(Qt::red);
const QColor white(Qt::white);
QPushButton w1;
qApp->setStyleSheet("* { color: red; }");
QVERIFY(COLOR(w1) == QColor("red"));
QCOMPARE(COLOR(w1), red);
qApp->setStyleSheet("* { color: white; }");
QVERIFY(COLOR(w1) == QColor("white"));
QCOMPARE(COLOR(w1), white);
qApp->setStyleSheet("");
QVERIFY(COLOR(w1) == APPCOLOR(w1));
QCOMPARE(COLOR(w1), APPCOLOR(w1));
qApp->setStyleSheet("* { color: red }");
QVERIFY(COLOR(w1) == QColor("red"));
QCOMPARE(COLOR(w1), red);
}
void tst_QStyleSheetStyle::windowStyleSheet()
{
const QColor red(Qt::red);
const QColor white(Qt::white);
QPushButton w1;
qApp->setStyleSheet("");
w1.setStyleSheet("* { color: red; }");
QVERIFY(COLOR(w1) == QColor("red"));
QCOMPARE(COLOR(w1), red);
w1.setStyleSheet("* { color: white; }");
QVERIFY(COLOR(w1) == QColor("white"));
QCOMPARE(COLOR(w1), white);
w1.setStyleSheet("");
QVERIFY(COLOR(w1) == APPCOLOR(w1));
QCOMPARE(COLOR(w1), APPCOLOR(w1));
w1.setStyleSheet("* { color: red }");
QVERIFY(COLOR(w1) == QColor("red"));
QCOMPARE(COLOR(w1), red);
qApp->setStyleSheet("* { color: green }");
QVERIFY(COLOR(w1) == QColor("red"));
QCOMPARE(COLOR(w1), red);
w1.setStyleSheet("");
QVERIFY(COLOR(w1) == QColor("green"));
QCOMPARE(COLOR(w1), QColor("green"));
qApp->setStyleSheet("");
QVERIFY(COLOR(w1) == APPCOLOR(w1));
QCOMPARE(COLOR(w1), APPCOLOR(w1));
}
void tst_QStyleSheetStyle::widgetStyleSheet()
{
const QColor blue(Qt::blue);
const QColor red(Qt::red);
const QColor white(Qt::white);
QPushButton w1;
QPushButton *pb = new QPushButton(&w1);
QPushButton &w2 = *pb;
qApp->setStyleSheet("");
w1.setStyleSheet("* { color: red }");
QVERIFY(COLOR(w1) == QColor("red"));
QVERIFY(COLOR(w2) == QColor("red"));
QCOMPARE(COLOR(w1), red);
QCOMPARE(COLOR(w2), red);
w2.setStyleSheet("* { color: white }");
QVERIFY(COLOR(w2) == QColor("white"));
QCOMPARE(COLOR(w2), white);
w1.setStyleSheet("* { color: blue }");
QVERIFY(COLOR(w1) == QColor("blue"));
QVERIFY(COLOR(w2) == QColor("white"));
QCOMPARE(COLOR(w1), blue);
QCOMPARE(COLOR(w2), white);
w1.setStyleSheet("");
QVERIFY(COLOR(w1) == APPCOLOR(w1));
QVERIFY(COLOR(w2) == QColor("white"));
QCOMPARE(COLOR(w1), APPCOLOR(w1));
QCOMPARE(COLOR(w2), white);
w2.setStyleSheet("");
QVERIFY(COLOR(w1) == APPCOLOR(w1));
QVERIFY(COLOR(w2) == APPCOLOR(w2));
QCOMPARE(COLOR(w1), APPCOLOR(w1));
QCOMPARE(COLOR(w2), APPCOLOR(w2));
}
void tst_QStyleSheetStyle::reparentWithNoChildStyleSheet()
{
const QColor blue(Qt::blue);
const QColor red(Qt::red);
const QColor white(Qt::white);
QPushButton p1, p2;
QPushButton *pb = new QPushButton(&p1);
QPushButton &c1 = *pb; // child with no stylesheet
qApp->setStyleSheet("");
p1.setStyleSheet("* { color: red }");
QVERIFY(COLOR(c1) == QColor("red"));
QCOMPARE(COLOR(c1), red);
c1.setParent(&p2);
QVERIFY(COLOR(c1) == APPCOLOR(c1));
QCOMPARE(COLOR(c1), APPCOLOR(c1));
p2.setStyleSheet("* { color: white }");
QVERIFY(COLOR(c1) == QColor("white"));
QCOMPARE(COLOR(c1), white);
c1.setParent(&p1);
QVERIFY(COLOR(c1) == QColor("red"));
QCOMPARE(COLOR(c1), red);
qApp->setStyleSheet("* { color: blue }");
c1.setParent(0);
QVERIFY(COLOR(c1) == QColor("blue"));
QCOMPARE(COLOR(c1), blue);
delete pb;
}
void tst_QStyleSheetStyle::reparentWithChildStyleSheet()
{
const QColor gray("gray");
const QColor white(Qt::white);
qApp->setStyleSheet("");
QPushButton p1, p2;
QPushButton *pb = new QPushButton(&p1);
QPushButton &c1 = *pb;
c1.setStyleSheet("background: gray");
QVERIFY(BACKGROUND(c1) == QColor("gray"));
QCOMPARE(BACKGROUND(c1), gray);
c1.setParent(&p2);
QVERIFY(BACKGROUND(c1) == QColor("gray"));
QCOMPARE(BACKGROUND(c1), gray);
qApp->setStyleSheet("* { color: white }");
c1.setParent(&p1);
QVERIFY(BACKGROUND(c1) == QColor("gray"));
QVERIFY(COLOR(c1) == QColor("white"));
QCOMPARE(BACKGROUND(c1), gray);
QCOMPARE(COLOR(c1), white);
}
void tst_QStyleSheetStyle::repolish()
{
const QColor red(Qt::red);
const QColor white(Qt::white);
qApp->setStyleSheet("");
QPushButton p1;
p1.setStyleSheet("color: red; background: white");
QVERIFY(BACKGROUND(p1) == QColor("white"));
QCOMPARE(BACKGROUND(p1), white);
p1.setStyleSheet("background: white");
QVERIFY(COLOR(p1) == APPCOLOR(p1));
QCOMPARE(COLOR(p1), APPCOLOR(p1));
p1.setStyleSheet("color: red");
QVERIFY(COLOR(p1) == QColor("red"));
QVERIFY(BACKGROUND(p1) == APPBACKGROUND(p1));
QCOMPARE(COLOR(p1), red);
QCOMPARE(BACKGROUND(p1), APPBACKGROUND(p1));
p1.setStyleSheet("");
QVERIFY(COLOR(p1) == APPCOLOR(p1));
QVERIFY(BACKGROUND(p1) == APPBACKGROUND(p1));
QCOMPARE(COLOR(p1), APPCOLOR(p1));
QCOMPARE(BACKGROUND(p1), APPBACKGROUND(p1));
}
void tst_QStyleSheetStyle::widgetStyle()
@ -492,12 +510,12 @@ void tst_QStyleSheetStyle::appStyle()
QPointer<QStyle> style2 = QStyleFactory::create("Windows");
qApp->setStyle(style1);
// Basic sanity
QVERIFY(qApp->style() == style1);
QCOMPARE(QApplication::style(), style1.data());
qApp->setStyle(style2);
QVERIFY(style1.isNull()); // qApp must have taken ownership and deleted it
// Setting null should not crash
qApp->setStyle(0);
QVERIFY(qApp->style() == style2);
QCOMPARE(QApplication::style(), style2.data());
// Set the stylesheet
qApp->setStyleSheet("whatever");
@ -505,7 +523,7 @@ void tst_QStyleSheetStyle::appStyle()
QVERIFY(!sss.isNull());
QCOMPARE(sss->metaObject()->className(), "QStyleSheetStyle"); // must be our proxy now
QVERIFY(!style2.isNull()); // this should exist as it is the base of the proxy
QVERIFY(sss->baseStyle() == style2);
QCOMPARE(sss->baseStyle(), style2.data());
style1 = QStyleFactory::create("Windows");
qApp->setStyle(style1);
QVERIFY(style2.isNull()); // should disappear automatically
@ -514,16 +532,16 @@ void tst_QStyleSheetStyle::appStyle()
// Update the stylesheet and check nothing changes
sss = (QStyleSheetStyle *)qApp->style();
qApp->setStyleSheet("whatever2");
QVERIFY(qApp->style() == sss);
QVERIFY(sss->baseStyle() == style1);
QCOMPARE(QApplication::style(), sss.data());
QCOMPARE(sss->baseStyle(), style1.data());
// Revert the stylesheet
qApp->setStyleSheet("");
QVERIFY(sss.isNull()); // should have disappeared
QVERIFY(qApp->style() == style1);
QCOMPARE(QApplication::style(), style1.data());
qApp->setStyleSheet("");
QVERIFY(qApp->style() == style1);
QCOMPARE(QApplication::style(), style1.data());
}
void tst_QStyleSheetStyle::dynamicProperty()
@ -589,21 +607,24 @@ namespace ns {
void tst_QStyleSheetStyle::namespaces()
{
const QColor blue(Qt::blue);
const QColor red(Qt::red);
const QColor white(Qt::white);
ns::PushButton1 pb1;
qApp->setStyleSheet("ns--PushButton1 { background: white }");
QVERIFY(BACKGROUND(pb1) == QColor("white"));
QCOMPARE(BACKGROUND(pb1), white);
qApp->setStyleSheet(".ns--PushButton1 { background: red }");
QVERIFY(BACKGROUND(pb1) == QColor("red"));
QCOMPARE(BACKGROUND(pb1), red);
ns::PushButton2 pb2;
qApp->setStyleSheet("ns--PushButton1 { background: blue}");
QVERIFY(BACKGROUND(pb2) == QColor("blue"));
QCOMPARE(BACKGROUND(pb2), blue);
qApp->setStyleSheet("ns--PushButton2 { background: magenta }");
QVERIFY(BACKGROUND(pb2) == QColor("magenta"));
QCOMPARE(BACKGROUND(pb2), QColor(Qt::magenta));
qApp->setStyleSheet(".PushButtonTwo { background: white; }");
QVERIFY(BACKGROUND(pb2) == QColor("white"));
QCOMPARE(BACKGROUND(pb2), white);
qApp->setStyleSheet(".PushButtonDuo { background: red; }");
QVERIFY(BACKGROUND(pb2) == QColor("red"));
QCOMPARE(BACKGROUND(pb2), red);
}
void tst_QStyleSheetStyle::palettePropagation()
@ -639,8 +660,8 @@ void tst_QStyleSheetStyle::fontPropagation()
int viewFontSize = FONTSIZE(*popup);
cb.setStyleSheet("QComboBox { font-size: 20pt; }");
QVERIFY(FONTSIZE(cb) == 20);
QVERIFY(FONTSIZE(*popup) == viewFontSize);
QCOMPARE(FONTSIZE(cb), 20);
QCOMPARE(FONTSIZE(*popup), viewFontSize);
QGroupBox gb;
QPushButton *push = new QPushButton(&gb);
QPushButton &pb = *push;
@ -648,25 +669,25 @@ void tst_QStyleSheetStyle::fontPropagation()
int gbFontSize = FONTSIZE(gb);
gb.setStyleSheet("QGroupBox { font-size: 20pt }");
QVERIFY(FONTSIZE(gb) == 20);
QCOMPARE(FONTSIZE(gb), 20);
QVERIFY(FONTSIZE(pb) == buttonFontSize); // font does not propagate
gb.setStyleSheet("QGroupBox * { font-size: 20pt; }");
QVERIFY(FONTSIZE(gb) == gbFontSize);
QVERIFY(FONTSIZE(pb) == 20);
QCOMPARE(FONTSIZE(gb), gbFontSize);
QCOMPARE(FONTSIZE(pb), 20);
QWidget window;
window.setStyleSheet("* { font-size: 10pt }");
pb.setParent(&window);
QCOMPARE(FONTSIZE(pb), 10);
window.setStyleSheet("");
QVERIFY(FONTSIZE(pb) == buttonFontSize);
QCOMPARE(FONTSIZE(pb), buttonFontSize);
QTabWidget tw;
tw.setStyleSheet("QTabWidget { font-size: 20pt; }");
QVERIFY(FONTSIZE(tw) == 20);
QCOMPARE(FONTSIZE(tw), 20);
QWidget *child = tw.findChild<QWidget *>("qt_tabwidget_tabbar");
QVERIFY2(child, "QTabWidget did not contain a widget named \"qt_tabwidget_tabbar\"");
QVERIFY(FONTSIZE(*child) == 20);
QCOMPARE(FONTSIZE(*child), 20);
}
void tst_QStyleSheetStyle::onWidgetDestroyed()
@ -1009,6 +1030,8 @@ void tst_QStyleSheetStyle::tabAlignement()
void tst_QStyleSheetStyle::attributesList()
{
const QColor blue(Qt::blue);
const QColor red(Qt::red);
QWidget w;
QPushButton *p1=new QPushButton(&w);
QPushButton *p2=new QPushButton(&w);
@ -1019,10 +1042,10 @@ void tst_QStyleSheetStyle::attributesList()
p3->setProperty("prop", QStringList() << "foo" << "bar");
w.setStyleSheet(" QPushButton{ background-color:blue; } QPushButton[prop~=red] { background-color:red; }");
QCOMPARE(BACKGROUND(*p1) , QColor("red"));
QCOMPARE(BACKGROUND(*p2) , QColor("red"));
QCOMPARE(BACKGROUND(*p3) , QColor("blue"));
QCOMPARE(BACKGROUND(*p4) , QColor("blue"));
QCOMPARE(BACKGROUND(*p1) , red);
QCOMPARE(BACKGROUND(*p2) , red);
QCOMPARE(BACKGROUND(*p3) , blue);
QCOMPARE(BACKGROUND(*p4) , blue);
}
void tst_QStyleSheetStyle::minmaxSizes()
@ -1065,6 +1088,7 @@ void tst_QStyleSheetStyle::minmaxSizes()
void tst_QStyleSheetStyle::task206238_twice()
{
const QColor red(Qt::red);
QMainWindow w;
QTabWidget* tw = new QTabWidget;
tw->addTab(new QLabel("foo"), "test");
@ -1073,12 +1097,12 @@ void tst_QStyleSheetStyle::task206238_twice()
centerOnScreen(&w);
w.show();
QTest::qWait(20);
QCOMPARE(BACKGROUND(w) , QColor("red"));
QCOMPARE(BACKGROUND(*tw), QColor("red"));
QCOMPARE(BACKGROUND(w) , red);
QCOMPARE(BACKGROUND(*tw), red);
w.setStyleSheet("background: red;");
QTest::qWait(20);
QCOMPARE(BACKGROUND(w) , QColor("red"));
QCOMPARE(BACKGROUND(*tw), QColor("red"));
QCOMPARE(BACKGROUND(w) , red);
QCOMPARE(BACKGROUND(*tw), red);
}
void tst_QStyleSheetStyle::transparent()

View File

@ -1043,9 +1043,9 @@ void tst_QCompleter::setters()
QAbstractItemModel *oldModel = completer->model();
completer->setModel(dirModel);
QVERIFY(completer->popup()->model() != oldModel);
QVERIFY(completer->popup()->model() == completer->completionModel());
QCOMPARE(completer->popup()->model(), completer->completionModel());
completer->setPopup(new QListView);
QVERIFY(completer->popup()->model() == completer->completionModel());
QCOMPARE(completer->popup()->model(), completer->completionModel());
completer->setModel(new QStringListModel(completer));
QVERIFY(dirModel == 0); // must have been deleted
@ -1062,7 +1062,7 @@ void tst_QCompleter::modelDeletion()
QStringListModel *listModel = new QStringListModel(list);
completer->setCompletionPrefix("i");
completer->setModel(listModel);
QVERIFY(completer->completionCount() == 3);
QCOMPARE(completer->completionCount(), 3);
QScopedPointer<QListView> view(new QListView);
view->setModel(completer->completionModel());
delete listModel;
@ -1070,8 +1070,8 @@ void tst_QCompleter::modelDeletion()
view->show();
qApp->processEvents();
view.reset();
QVERIFY(completer->completionCount() == 0);
QVERIFY(completer->currentRow() == -1);
QCOMPARE(completer->completionCount(), 0);
QCOMPARE(completer->currentRow(), -1);
}
void tst_QCompleter::multipleWidgets()
@ -1098,7 +1098,7 @@ void tst_QCompleter::multipleWidgets()
window.activateWindow();
QApplication::setActiveWindow(&window);
QTest::qWait(50);
QTRY_VERIFY(qApp->focusWidget() == comboBox);
QTRY_COMPARE(QApplication::focusWidget(), comboBox);
comboBox->lineEdit()->setText("it");
QCOMPARE(comboBox->currentText(), QString("it")); // should not complete with setText
QTest::keyPress(comboBox, 'e');
@ -1111,7 +1111,7 @@ void tst_QCompleter::multipleWidgets()
lineEdit->show();
lineEdit->setFocus();
QTest::qWait(50);
QTRY_VERIFY(qApp->focusWidget() == lineEdit);
QTRY_COMPARE(QApplication::focusWidget(), lineEdit);
lineEdit->setText("it");
QCOMPARE(lineEdit->text(), QString("it")); // should not completer with setText
QCOMPARE(comboBox->currentText(), QString("")); // combo box text must not change!
@ -1148,13 +1148,13 @@ void tst_QCompleter::focusIn()
lineEdit2->show();
comboBox->setFocus();
QTRY_VERIFY(completer.widget() == comboBox);
QTRY_COMPARE(completer.widget(), comboBox);
lineEdit->setFocus();
QTRY_VERIFY(completer.widget() == lineEdit);
QTRY_COMPARE(completer.widget(), lineEdit);
comboBox->setFocus();
QTRY_VERIFY(completer.widget() == comboBox);
QTRY_COMPARE(completer.widget(), comboBox);
lineEdit2->setFocus();
QTRY_VERIFY(completer.widget() == comboBox);
QTRY_COMPARE(completer.widget(), comboBox);
}
void tst_QCompleter::dynamicSortOrder()

View File

@ -297,7 +297,7 @@ void tst_QScroller::staticScrollers()
QScrollerProperties sp2 = QScroller::scroller(o2)->scrollerProperties();
// default properties should be the same
QVERIFY(sp1 == sp2);
QCOMPARE(sp1, sp2);
QCOMPARE(QScroller::scroller(o1)->scrollerProperties(), sp1);

View File

@ -136,7 +136,7 @@ void tst_QSystemTrayIcon::lastWindowClosed()
QTimer::singleShot(2500, &window, SLOT(close()));
QTimer::singleShot(20000, qApp, SLOT(quit())); // in case the test fails
qApp->exec();
QVERIFY(spy.count() == 1);
QCOMPARE(spy.count(), 1);
}
QTEST_MAIN(tst_QSystemTrayIcon)

View File

@ -283,9 +283,9 @@ void tst_QAbstractButton::setAutoRepeat()
QTest::qWait(REPEAT_DELAY);
QVERIFY(testWidget->isDown());
QTest::keyRelease(testWidget, Qt::Key_Space);
QVERIFY(release_count == press_count);
QVERIFY(toggle_count == 0);
QVERIFY(press_count == click_count);
QCOMPARE(release_count, press_count);
QCOMPARE(toggle_count, uint(0));
QCOMPARE(press_count, click_count);
QVERIFY(click_count > 1);
break;
case 4:

View File

@ -324,13 +324,13 @@ void tst_QButtonGroup::testSignals()
int expectedId = -2;
QVERIFY(clickedIdSpy.takeFirst().at(0).toInt() == expectedId);
QCOMPARE(clickedIdSpy.takeFirst().at(0).toInt(), expectedId);
QCOMPARE(pressedSpy.count(), 1);
QCOMPARE(pressedIdSpy.count(), 1);
QVERIFY(pressedIdSpy.takeFirst().at(0).toInt() == expectedId);
QCOMPARE(pressedIdSpy.takeFirst().at(0).toInt(), expectedId);
QCOMPARE(releasedSpy.count(), 1);
QCOMPARE(releasedIdSpy.count(), 1);
QVERIFY(releasedIdSpy.takeFirst().at(0).toInt() == expectedId);
QCOMPARE(releasedIdSpy.takeFirst().at(0).toInt(), expectedId);
clickedSpy.clear();
clickedIdSpy.clear();
@ -344,13 +344,13 @@ void tst_QButtonGroup::testSignals()
QCOMPARE(clickedSpy.count(), 1);
QCOMPARE(clickedIdSpy.count(), 1);
QVERIFY(clickedIdSpy.takeFirst().at(0).toInt() == 23);
QCOMPARE(clickedIdSpy.takeFirst().at(0).toInt(), 23);
QCOMPARE(pressedSpy.count(), 1);
QCOMPARE(pressedIdSpy.count(), 1);
QVERIFY(pressedIdSpy.takeFirst().at(0).toInt() == 23);
QCOMPARE(pressedIdSpy.takeFirst().at(0).toInt(), 23);
QCOMPARE(releasedSpy.count(), 1);
QCOMPARE(releasedIdSpy.count(), 1);
QVERIFY(releasedIdSpy.takeFirst().at(0).toInt() == 23);
QCOMPARE(releasedIdSpy.takeFirst().at(0).toInt(), 23);
QSignalSpy toggledSpy(&buttons, SIGNAL(buttonToggled(QAbstractButton*, bool)));
@ -427,25 +427,25 @@ void tst_QButtonGroup::checkedButton()
buttons.addButton(&pb1);
buttons.addButton(&pb2, 23);
QVERIFY(buttons.checkedButton() == 0);
QVERIFY(!buttons.checkedButton());
pb1.setChecked(true);
QVERIFY(buttons.checkedButton() == &pb1);
QCOMPARE(buttons.checkedButton(), &pb1);
pb2.setChecked(true);
QVERIFY(buttons.checkedButton() == &pb2);
QCOMPARE(buttons.checkedButton(), &pb2);
pb2.setChecked(false);
QVERIFY(buttons.checkedButton() == &pb1);
QCOMPARE(buttons.checkedButton(), &pb1);
pb1.setChecked(false);
QVERIFY(buttons.checkedButton() == 0);
QVERIFY(!buttons.checkedButton());
buttons.setExclusive(true);
QVERIFY(buttons.checkedButton() == 0);
QVERIFY(!buttons.checkedButton());
pb1.setChecked(true);
QVERIFY(buttons.checkedButton() == &pb1);
QCOMPARE(buttons.checkedButton(), &pb1);
pb2.setChecked(true);
QVERIFY(buttons.checkedButton() == &pb2);
QCOMPARE(buttons.checkedButton(), &pb2);
// checked button cannot be unchecked
pb2.setChecked(false);
QVERIFY(buttons.checkedButton() == &pb2);
QCOMPARE(buttons.checkedButton(), &pb2);
}
class task209485_ButtonDeleter : public QObject
@ -523,9 +523,9 @@ void tst_QButtonGroup::autoIncrementId()
radio1->setChecked(true);
QVERIFY(buttons->id(radio1) == -2);
QVERIFY(buttons->id(radio2) == -3);
QVERIFY(buttons->id(radio3) == -4);
QCOMPARE(buttons->id(radio1), -2);
QCOMPARE(buttons->id(radio2), -3);
QCOMPARE(buttons->id(radio3), -4);
dlg.show();
}

View File

@ -324,7 +324,7 @@ void tst_QCheckBox::isToggleButton()
void tst_QCheckBox::foregroundRole()
{
QVERIFY(testWidget->foregroundRole() == QPalette::WindowText);
QCOMPARE(testWidget->foregroundRole(), QPalette::WindowText);
}
void tst_QCheckBox::minimumSizeHint()

View File

@ -453,7 +453,7 @@ void tst_QComboBox::setPalette()
for (int i = 0; i < comboChildren.size(); ++i) {
QObject *o = comboChildren.at(i);
if (o->isWidgetType()) {
QVERIFY(((QWidget*)o)->palette() == pal);
QCOMPARE(((QWidget*)o)->palette(), pal);
}
}
@ -462,12 +462,12 @@ void tst_QComboBox::setPalette()
//Setting it on the lineedit should be separate form the combo
testWidget->lineEdit()->setPalette(pal);
QVERIFY(testWidget->palette() != pal);
QVERIFY(testWidget->lineEdit()->palette() == pal);
QCOMPARE(testWidget->lineEdit()->palette(), pal);
pal.setColor(QPalette::Base, Qt::green);
//Setting it on the combo directly should override lineedit
testWidget->setPalette(pal);
QVERIFY(testWidget->palette() == pal);
QVERIFY(testWidget->lineEdit()->palette() == pal);
QCOMPARE(testWidget->palette(), pal);
QCOMPARE(testWidget->lineEdit()->palette(), pal);
}
void tst_QComboBox::sizeAdjustPolicy()
@ -478,7 +478,7 @@ void tst_QComboBox::sizeAdjustPolicy()
QComboBox *testWidget = topLevel.comboBox();
// test that adding new items will not change the sizehint for AdjustToContentsOnFirstShow
QVERIFY(!testWidget->count());
QVERIFY(testWidget->sizeAdjustPolicy() == QComboBox::AdjustToContentsOnFirstShow);
QCOMPARE(testWidget->sizeAdjustPolicy(), QComboBox::AdjustToContentsOnFirstShow);
QVERIFY(testWidget->isVisible());
QSize firstShow = testWidget->sizeHint();
testWidget->addItem("normal item");
@ -751,7 +751,7 @@ void tst_QComboBox::insertPolicy()
// First check that there is the right number of entries, or
// we may unwittingly pass
QVERIFY((int)result.count() == testWidget->count());
QCOMPARE((int)result.count(), testWidget->count());
// No need to compare if there are no strings to compare
if (result.count() > 0) {
@ -796,7 +796,7 @@ void tst_QComboBox::virtualAutocompletion()
QApplication::sendEvent(testWidget, &kr1);
qApp->processEvents(); // Process events to trigger autocompletion
QTRY_VERIFY(testWidget->currentIndex() == 1);
QTRY_COMPARE(testWidget->currentIndex(), 1);
QKeyEvent kp2(QEvent::KeyPress, Qt::Key_O, 0, "o");
QKeyEvent kr2(QEvent::KeyRelease, Qt::Key_O, 0, "o");
@ -845,7 +845,7 @@ void tst_QComboBox::autoCompletionCaseSensitivity()
testWidget->clearEditText();
QSignalSpy spyReturn(testWidget, SIGNAL(activated(int)));
testWidget->setAutoCompletionCaseSensitivity(Qt::CaseInsensitive);
QVERIFY(testWidget->autoCompletionCaseSensitivity() == Qt::CaseInsensitive);
QCOMPARE(testWidget->autoCompletionCaseSensitivity(), Qt::CaseInsensitive);
QTest::keyClick(testWidget->lineEdit(), Qt::Key_A);
qApp->processEvents();
@ -879,7 +879,7 @@ void tst_QComboBox::autoCompletionCaseSensitivity()
// case sensitive
testWidget->clearEditText();
testWidget->setAutoCompletionCaseSensitivity(Qt::CaseSensitive);
QVERIFY(testWidget->autoCompletionCaseSensitivity() == Qt::CaseSensitive);
QCOMPARE(testWidget->autoCompletionCaseSensitivity(), Qt::CaseSensitive);
QTest::keyClick(testWidget->lineEdit(), Qt::Key_A);
qApp->processEvents();
QCOMPARE(testWidget->currentText(), QString("aww"));
@ -1377,7 +1377,7 @@ void tst_QComboBox::textpixmapdata()
QCOMPARE(icon.cacheKey(), icons.at(i).cacheKey());
QPixmap original = icons.at(i).pixmap(1024);
QPixmap pixmap = icon.pixmap(1024);
QVERIFY(pixmap.toImage() == original.toImage());
QCOMPARE(pixmap.toImage(), original.toImage());
}
for (int i = 0; i<text.count(); ++i) {
@ -1611,7 +1611,7 @@ void tst_QComboBox::setModel()
QCOMPARE(box.currentIndex(), 0);
QVERIFY(box.model() != oldModel);
QVERIFY(box.rootModelIndex() != rootModelIndex);
QVERIFY(box.rootModelIndex() == QModelIndex());
QCOMPARE(box.rootModelIndex(), QModelIndex());
// check that setting the very same model doesn't move the current item
box.setCurrentIndex(1);

View File

@ -98,11 +98,11 @@ void tst_QCommandLinkButton::getSetCheck()
QString text("mytext");
QVERIFY(obj1.description().isEmpty());
obj1.setDescription(text);
QVERIFY(obj1.description() == text);
QCOMPARE(obj1.description(), text);
QVERIFY(obj1.text().isEmpty());
obj1.setText(text);
QVERIFY(obj1.text() == text);
QCOMPARE(obj1.text(), text);
QMenu *var1 = new QMenu;
obj1.setMenu(var1);
@ -236,8 +236,8 @@ void tst_QCommandLinkButton::setAutoRepeat()
QVERIFY( testWidget->isDown() );
QVERIFY( toggle_count == 0 );
QTest::keyRelease( testWidget, Qt::Key_Space );
QVERIFY(press_count == release_count);
QVERIFY(release_count == click_count);
QCOMPARE(press_count, release_count);
QCOMPARE(release_count, click_count);
QVERIFY(press_count > 1);
// #### shouldn't I check here to see if multiple signals have been fired???

View File

@ -2416,7 +2416,7 @@ void tst_QDateTimeEdit::displayedSections()
QFETCH(uint, section);
testWidget->setDisplayFormat(format);
QVERIFY((QDateTimeEdit::Section)section == testWidget->displayedSections());
QCOMPARE(QDateTimeEdit::Sections(section), testWidget->displayedSections());
}
void tst_QDateTimeEdit::currentSection_data()
@ -2460,7 +2460,7 @@ void tst_QDateTimeEdit::currentSection()
if ((QDateTimeEdit::Section)section == QDateTimeEdit::NoSection)
testWidget->setCurrentSection(QDateTimeEdit::YearSection); // Ensure it's not reset (see above)
testWidget->setCurrentSection((QDateTimeEdit::Section)section);
QVERIFY((QDateTimeEdit::Section)currentSection == testWidget->currentSection());
QCOMPARE((QDateTimeEdit::Section)currentSection, testWidget->currentSection());
}
void tst_QDateTimeEdit::readOnly()
@ -2825,7 +2825,7 @@ void tst_QDateTimeEdit::calendarPopup()
rect = style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, &timeEdit);
QTest::mouseClick(&timeEdit, Qt::LeftButton, 0, QPoint(rect.left()+rect.width()/2, rect.top()+rect.height()/2));
QWidget *wid2 = timeEdit.findChild<QWidget *>("qt_datetimedit_calendar");
QVERIFY(wid2 == 0);
QVERIFY(!wid2);
timeEdit.hide();
@ -2839,7 +2839,7 @@ void tst_QDateTimeEdit::calendarPopup()
rect = style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, &dateEdit);
QTest::mouseClick(&dateEdit, Qt::LeftButton, 0, QPoint(rect.left()+rect.width()/2, rect.top()+rect.height()/2));
QWidget *wid3 = dateEdit.findChild<QWidget *>("qt_datetimedit_calendar");
QVERIFY(wid3 == 0);
QVERIFY(!wid3);
dateEdit.hide();
}

View File

@ -132,12 +132,12 @@ void tst_QDialogButtonBox::layoutReuse()
QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Ok);
QPointer<QLayout> layout = box->layout();
box->setCenterButtons(!box->centerButtons());
QVERIFY(layout == box->layout());
QCOMPARE(layout.data(), box->layout());
QEvent event(QEvent::StyleChange);
QApplication::sendEvent(box, &event);
QVERIFY(layout == box->layout());
QCOMPARE(layout.data(), box->layout());
box->setOrientation(box->orientation() == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal);
QVERIFY(layout == 0);
QVERIFY(layout.isNull());
QVERIFY(layout != box->layout());
delete box;
}

View File

@ -120,7 +120,7 @@ void tst_QDockWidget::widget()
{
{
QDockWidget dw;
QVERIFY(dw.widget() == 0);
QVERIFY(!dw.widget());
}
{
@ -130,32 +130,32 @@ void tst_QDockWidget::widget()
dw.setWidget(w1);
QVERIFY(dw.widget() != 0);
QVERIFY(dw.widget() == w1);
QCOMPARE(dw.widget(), w1);
QCOMPARE(w1->parentWidget(), (QWidget*)&dw);
dw.setWidget(0);
QVERIFY(dw.widget() == 0);
QVERIFY(!dw.widget());
dw.setWidget(w2);
QVERIFY(dw.widget() != 0);
QVERIFY(dw.widget() == w2);
QCOMPARE(dw.widget(), w2);
QCOMPARE(w2->parentWidget(), (QWidget*)&dw);
dw.setWidget(0);
QVERIFY(dw.widget() == 0);
QVERIFY(!dw.widget());
dw.setWidget(w1);
QVERIFY(dw.widget() != 0);
QVERIFY(dw.widget() == w1);
QCOMPARE(dw.widget(), w1);
QCOMPARE(w1->parentWidget(), (QWidget*)&dw);
dw.setWidget(w2);
QVERIFY(dw.widget() != 0);
QVERIFY(dw.widget() == w2);
QCOMPARE(dw.widget(), w2);
QCOMPARE(w2->parentWidget(), (QWidget*)&dw);
dw.setWidget(0);
QVERIFY(dw.widget() == 0);
QVERIFY(!dw.widget());
}
{
@ -165,37 +165,37 @@ void tst_QDockWidget::widget()
dw.setWidget(w1);
QVERIFY(dw.widget() != 0);
QVERIFY(dw.widget() == w1);
QCOMPARE(dw.widget(), w1);
QCOMPARE(w1->parentWidget(), (QWidget*)&dw);
w1->setParent(0);
QVERIFY(dw.widget() == 0);
QVERIFY(!dw.widget());
dw.setWidget(w2);
QVERIFY(dw.widget() != 0);
QVERIFY(dw.widget() == w2);
QCOMPARE(dw.widget(), w2);
QCOMPARE(w2->parentWidget(), (QWidget*)&dw);
w2->setParent(0);
QVERIFY(dw.widget() == 0);
QVERIFY(!dw.widget());
dw.setWidget(w1);
QVERIFY(dw.widget() != 0);
QVERIFY(dw.widget() == w1);
QCOMPARE(dw.widget(), w1);
QCOMPARE(w1->parentWidget(), (QWidget*)&dw);
dw.setWidget(w2);
QVERIFY(dw.widget() != 0);
QVERIFY(dw.widget() == w2);
QCOMPARE(dw.widget(), w2);
QCOMPARE(w2->parentWidget(), (QWidget*)&dw);
w1->setParent(0);
QVERIFY(dw.widget() != 0);
QVERIFY(dw.widget() == w2);
QCOMPARE(dw.widget(), w2);
QCOMPARE(w2->parentWidget(), (QWidget*)&dw);
w2->setParent(0);
QVERIFY(dw.widget() == 0);
QVERIFY(!dw.widget());
delete w1;
delete w2;
}

View File

@ -321,7 +321,7 @@ void tst_QLabel::eventPropagation()
test_label->setText(text);
test_box->events.clear();
test_label->setTextInteractionFlags(Qt::TextInteractionFlags(textInteractionFlags));
QVERIFY(int(test_label->focusPolicy()) == focusPolicy);
QCOMPARE(int(test_label->focusPolicy()), focusPolicy);
QTest::mousePress(test_label, Qt::LeftButton);
QVERIFY(test_box->events.contains(QEvent::MouseButtonPress) == propagation); // should have propagated!
}

View File

@ -1668,7 +1668,7 @@ void tst_QLineEdit::displayText()
testWidget->setEchoMode(mode);
testWidget->setText(insertString);
QCOMPARE(testWidget->displayText(), expectedString);
QVERIFY(testWidget->echoMode() == mode);
QCOMPARE(testWidget->echoMode(), mode);
}
void tst_QLineEdit::passwordEchoOnEdit()
@ -1838,9 +1838,9 @@ void tst_QLineEdit::maxLength()
// Make sure that the textChanged is not emitted unless the text is actually changed
if (insertString == expectedString) {
QVERIFY(changed_count == 0);
QCOMPARE(changed_count, 0);
} else {
QVERIFY(changed_count == 1);
QCOMPARE(changed_count, 1);
}
}
@ -1961,7 +1961,7 @@ void tst_QLineEdit::psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardMo
void tst_QLineEdit::cursorPosition()
{
QLineEdit *testWidget = ensureTestWidget();
QVERIFY(testWidget->cursorPosition() == 0);
QCOMPARE(testWidget->cursorPosition(), 0);
// start with a basic text
QTest::keyClicks(testWidget, "The");
@ -2207,7 +2207,7 @@ void tst_QLineEdit::selectedText()
testWidget->cursorForward(true, 9);
QVERIFY(testWidget->hasSelectedText());
QCOMPARE(testWidget->selectedText(), QString("Abc defg "));
QVERIFY(selection_count == 1);
QCOMPARE(selection_count, 1);
// reset selection
testWidget->home(false);
@ -2263,19 +2263,19 @@ void tst_QLineEdit::textChangedAndTextEdited()
QLineEdit *testWidget = ensureTestWidget();
QTest::keyClick(testWidget, Qt::Key_A);
QCOMPARE(changed_count, 1);
QVERIFY(edited_count == changed_count);
QCOMPARE(edited_count, changed_count);
QTest::keyClick(testWidget, 'b');
QCOMPARE(changed_count, 2);
QVERIFY(edited_count == changed_count);
QCOMPARE(edited_count, changed_count);
QTest::keyClick(testWidget, 'c');
QCOMPARE(changed_count, 3);
QVERIFY(edited_count == changed_count);
QCOMPARE(edited_count, changed_count);
QTest::keyClick(testWidget, ' ');
QCOMPARE(changed_count, 4);
QVERIFY(edited_count == changed_count);
QCOMPARE(edited_count, changed_count);
QTest::keyClick(testWidget, 'd');
QCOMPARE(changed_count, 5);
QVERIFY(edited_count == changed_count);
QCOMPARE(edited_count, changed_count);
changed_count = 0;
edited_count = 0;
@ -2321,27 +2321,27 @@ void tst_QLineEdit::returnPressed()
QLineEdit *testWidget = ensureTestWidget();
QTest::keyClick(testWidget, Qt::Key_Return);
QVERIFY(return_count == 1);
QCOMPARE(return_count, 1);
return_count = 0;
QTest::keyClick(testWidget, 'A');
QVERIFY(return_count == 0);
QCOMPARE(return_count, 0);
QTest::keyClick(testWidget, 'b');
QVERIFY(return_count == 0);
QCOMPARE(return_count, 0);
QTest::keyClick(testWidget, 'c');
QVERIFY(return_count == 0);
QCOMPARE(return_count, 0);
QTest::keyClick(testWidget, ' ');
QVERIFY(return_count == 0);
QCOMPARE(return_count, 0);
QTest::keyClick(testWidget, 'd');
QVERIFY(return_count == 0);
QCOMPARE(return_count, 0);
psKeyClick(testWidget, Qt::Key_Home);
QVERIFY(return_count == 0);
QCOMPARE(return_count, 0);
psKeyClick(testWidget, Qt::Key_End);
QVERIFY(return_count == 0);
QCOMPARE(return_count, 0);
QTest::keyClick(testWidget, Qt::Key_Escape);
QVERIFY(return_count == 0);
QCOMPARE(return_count, 0);
QTest::keyClick(testWidget, Qt::Key_Return);
QVERIFY(return_count == 1);
QCOMPARE(return_count, 1);
}
// int validator that fixes all !isNumber to '0'
@ -2497,14 +2497,14 @@ void tst_QLineEdit::setValidator()
QCOMPARE(testWidget->validator(), static_cast<const QValidator*>(&iv1));
testWidget->setValidator(0);
QVERIFY(testWidget->validator() == 0);
QVERIFY(!testWidget->validator());
QIntValidator iv2(0, 99, 0);
testWidget->setValidator(&iv2);
QCOMPARE(testWidget->validator(), static_cast<const QValidator *>(&iv2));
testWidget->setValidator(0);
QVERIFY(testWidget->validator() == 0);
QVERIFY(!testWidget->validator());
}
void tst_QLineEdit::setValidator_QIntValidator_data()
@ -2746,7 +2746,7 @@ void tst_QLineEdit::setAlignment()
QTEST(testWidget, "left");
#endif
#endif
QVERIFY(testWidget->alignment() == Qt::AlignLeft);
QCOMPARE(testWidget->alignment(), Qt::AlignLeft);
testWidget->setText("hcenter");
testWidget->setAlignment(Qt::AlignHCenter);
@ -2755,7 +2755,7 @@ void tst_QLineEdit::setAlignment()
QTEST(testWidget, "hcenter");
#endif
#endif
QVERIFY(testWidget->alignment() == Qt::AlignHCenter);
QCOMPARE(testWidget->alignment(), Qt::AlignHCenter);
testWidget->setText("right");
testWidget->setAlignment(Qt::AlignRight);
@ -2764,16 +2764,16 @@ void tst_QLineEdit::setAlignment()
QTEST(testWidget, "right");
#endif
#endif
QVERIFY(testWidget->alignment() == Qt::AlignRight);
QCOMPARE(testWidget->alignment(), Qt::AlignRight);
testWidget->setAlignment(Qt::AlignTop);
QVERIFY(testWidget->alignment() == Qt::AlignTop);
QCOMPARE(testWidget->alignment(), Qt::AlignTop);
testWidget->setAlignment(Qt::AlignBottom);
QVERIFY(testWidget->alignment() == Qt::AlignBottom);
QCOMPARE(testWidget->alignment(), Qt::AlignBottom);
testWidget->setAlignment(Qt::AlignCenter);
QVERIFY(testWidget->alignment() == Qt::AlignCenter);
QCOMPARE(testWidget->alignment(), Qt::AlignCenter);
}
void tst_QLineEdit::isModified()
@ -3081,10 +3081,10 @@ void tst_QLineEdit::maxLengthAndInputMask()
QLineEdit *testWidget = ensureTestWidget();
QVERIFY(testWidget->inputMask().isNull());
testWidget->setMaxLength(10);
QVERIFY(testWidget->maxLength() == 10);
QCOMPARE(testWidget->maxLength(), 10);
testWidget->setInputMask(QString::null);
QVERIFY(testWidget->inputMask().isNull());
QVERIFY(testWidget->maxLength() == 10);
QCOMPARE(testWidget->maxLength(), 10);
}
@ -4415,7 +4415,7 @@ void tst_QLineEdit::QTBUG1266_setInputMaskEmittingTextEdited()
QSignalSpy spy(&lineEdit, SIGNAL(textEdited(QString)));
lineEdit.setInputMask("AAAA");
lineEdit.setInputMask(QString());
QVERIFY(spy.count() == 0);
QCOMPARE(spy.count(), 0);
}
QTEST_MAIN(tst_QLineEdit)

View File

@ -211,15 +211,15 @@ tst_QMainWindow::tst_QMainWindow()
void tst_QMainWindow::constructor()
{
QMainWindow mw;
QVERIFY(mw.parentWidget() == 0);
QVERIFY(!mw.parentWidget());
QVERIFY(mw.isWindow());
QMainWindow mw2(&mw);
QVERIFY(mw2.parentWidget() == &mw);
QCOMPARE(mw2.parentWidget(), &mw);
QVERIFY(mw2.isWindow());
QMainWindow mw3(&mw, Qt::FramelessWindowHint);
QVERIFY(mw3.parentWidget() == &mw);
QCOMPARE(mw3.parentWidget(), &mw);
QVERIFY(mw3.isWindow());
}
@ -607,7 +607,7 @@ void tst_QMainWindow::menuBar()
QVERIFY(mw.menuBar() != 0);
//we now call deleteLater on the previous menubar
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(mb1 == 0);
QVERIFY(mb1.isNull());
mw.setMenuBar(mb2);
QVERIFY(mw.menuBar() != 0);
@ -618,7 +618,7 @@ void tst_QMainWindow::menuBar()
QVERIFY(mw.menuBar() != 0);
//we now call deleteLater on the previous menubar
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(mb2 == 0);
QVERIFY(mb2.isNull());
mb1 = new QMenuBar;
mw.setMenuBar(mb1);
@ -631,7 +631,7 @@ void tst_QMainWindow::menuBar()
QCOMPARE(mw.menuBar(), (QMenuBar *)mb2);
//we now call deleteLater on the previous menubar
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(mb1 == 0);
QVERIFY(mb1.isNull());
mb1 = new QMenuBar;
mw.setMenuBar(mb1);
@ -639,7 +639,7 @@ void tst_QMainWindow::menuBar()
QCOMPARE(mw.menuBar(), (QMenuBar *)mb1);
//we now call deleteLater on the previous menubar
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(mb2 == 0);
QVERIFY(mb2.isNull());
QPointer<QWidget> topLeftCornerWidget = new QWidget;
mb1->setCornerWidget(topLeftCornerWidget, Qt::TopLeftCorner);
@ -652,7 +652,7 @@ void tst_QMainWindow::menuBar()
QCOMPARE(mw.menuBar(), (QMenuBar *)mb2);
//we now call deleteLater on the previous menubar
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(mb1 == 0);
QVERIFY(mb1.isNull());
QVERIFY(topLeftCornerWidget);
QCOMPARE(mb2->cornerWidget(Qt::TopLeftCorner), static_cast<QWidget *>(topLeftCornerWidget));
@ -663,8 +663,8 @@ void tst_QMainWindow::menuBar()
QVERIFY(mw.menuBar() != 0);
//we now call deleteLater on the previous menubar
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(mb2 == 0);
QVERIFY(mb2.isNull());
QVERIFY(!topLeftCornerWidget);
QVERIFY(!topRightCornerWidget);
}
@ -692,7 +692,7 @@ void tst_QMainWindow::statusBar()
QVERIFY(mw.statusBar() != 0);
//we now call deleteLater on the previous statusbar
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(sb1 == 0);
QVERIFY(sb1.isNull());
mw.setStatusBar(sb2);
QVERIFY(mw.statusBar() != 0);
@ -703,7 +703,7 @@ void tst_QMainWindow::statusBar()
QVERIFY(mw.statusBar() != 0);
//we now call deleteLater on the previous statusbar
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(sb2 == 0);
QVERIFY(sb2.isNull());
sb1 = new QStatusBar;
mw.setStatusBar(sb1);
@ -718,7 +718,7 @@ void tst_QMainWindow::statusBar()
QCOMPARE(sb2->parentWidget(), (QWidget *)&mw);
//we now call deleteLater on the previous statusbar
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(sb1 == 0);
QVERIFY(sb1.isNull());
sb1 = new QStatusBar;
mw.setStatusBar(sb1);
@ -727,7 +727,7 @@ void tst_QMainWindow::statusBar()
QCOMPARE(sb1->parentWidget(), (QWidget *)&mw);
//we now call deleteLater on the previous statusbar
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(sb2 == 0);
QVERIFY(sb2.isNull());
sb2 = new QStatusBar;
mw.setStatusBar(sb2);
@ -736,7 +736,7 @@ void tst_QMainWindow::statusBar()
QCOMPARE(sb2->parentWidget(), (QWidget *)&mw);
//we now call deleteLater on the previous statusbar
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(sb1 == 0);
QVERIFY(sb1.isNull());
}
{
@ -749,7 +749,7 @@ void tst_QMainWindow::statusBar()
QVERIFY(indexOfSb != -1);
delete sb;
indexOfSb = l->indexOf(sb);
QVERIFY(indexOfSb == -1);
QCOMPARE(indexOfSb, -1);
}
}
@ -791,7 +791,7 @@ void tst_QMainWindow::centralWidget()
{
{
QMainWindow mw;
QVERIFY(mw.centralWidget() == 0);
QVERIFY(!mw.centralWidget());
}
{
@ -799,7 +799,7 @@ void tst_QMainWindow::centralWidget()
QPointer<QWidget> w1 = new QWidget;
QPointer<QWidget> w2 = new QWidget;
QVERIFY(mw.centralWidget() == 0);
QVERIFY(!mw.centralWidget());
mw.setCentralWidget(w1);
QVERIFY(mw.centralWidget() != 0);
@ -812,12 +812,12 @@ void tst_QMainWindow::centralWidget()
QCOMPARE(w2->parentWidget(), (QWidget *)&mw);
mw.setCentralWidget(0);
QVERIFY(mw.centralWidget() == 0);
QVERIFY(!mw.centralWidget());
//we now call deleteLater on the previous central widgets
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(w1 == 0);
QVERIFY(w2 == 0);
QVERIFY(w1.isNull());
QVERIFY(w2.isNull());
}
{
@ -831,7 +831,7 @@ void tst_QMainWindow::centralWidget()
QPointer<QWidget> w1 = new QWidget;
QPointer<QWidget> w2 = new QWidget;
QVERIFY(mw.centralWidget() == 0);
QVERIFY(!mw.centralWidget());
mw.setCentralWidget(w1);
QVERIFY(mw.centralWidget() != 0);
@ -844,12 +844,12 @@ void tst_QMainWindow::centralWidget()
QCOMPARE(w2->parentWidget(), (QWidget *)&mw);
mw.setCentralWidget(0);
QVERIFY(mw.centralWidget() == 0);
QVERIFY(!mw.centralWidget());
//we now call deleteLater on the previous central widgets
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(w1 == 0);
QVERIFY(w2 == 0);
QVERIFY(w1.isNull());
QVERIFY(w2.isNull());
}
}
@ -860,25 +860,25 @@ void tst_QMainWindow::takeCentralWidget() {
QPointer<QWidget> w1 = new QWidget;
QVERIFY(mw.centralWidget() == 0);
QVERIFY(!mw.centralWidget());
mw.setCentralWidget(w1);
QWidget *oldCentralWidget = mw.takeCentralWidget();
QVERIFY(oldCentralWidget == w1.data());
QCOMPARE(oldCentralWidget, w1.data());
// ensure that takeCentralWidget doesn't end up calling deleteLater
// on the central widget
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(mw.centralWidget() == 0);
QVERIFY(!mw.centralWidget());
QVERIFY(!w1.isNull());
QVERIFY(w1->parent() == 0);
QVERIFY(!w1->parent());
mw.setCentralWidget(w1);
// ensure that the deleteLater called by setCentralWidget
// gets executed
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(mw.centralWidget() == w1.data());
QCOMPARE(mw.centralWidget(), w1.data());
QPointer<QWidget> w2 = new QWidget;
@ -887,10 +887,10 @@ void tst_QMainWindow::takeCentralWidget() {
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(w1.isNull());
QVERIFY(mw.centralWidget() == w2.data());
QCOMPARE(mw.centralWidget(), w2.data());
QWidget *hopefullyW2 = mw.takeCentralWidget();
QVERIFY(mw.centralWidget() == 0);
QVERIFY(!mw.centralWidget());
// ensure that takeCentralWidget doesn't end up calling deleteLater
// on the central widget
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
@ -1928,9 +1928,9 @@ void tst_QMainWindow::toggleUnifiedTitleAndToolBarOnMac()
mw.show();
QRect frameGeometry = mw.frameGeometry();
mw.setUnifiedTitleAndToolBarOnMac(false);
QVERIFY(frameGeometry.topLeft() == mw.frameGeometry().topLeft());
QCOMPARE(frameGeometry.topLeft(), mw.frameGeometry().topLeft());
mw.setUnifiedTitleAndToolBarOnMac(true);
QVERIFY(frameGeometry.topLeft() == mw.frameGeometry().topLeft());
QCOMPARE(frameGeometry.topLeft(), mw.frameGeometry().topLeft());
}
#endif

View File

@ -377,13 +377,13 @@ void tst_QMdiArea::subWindowActivated()
while (workspace->activeSubWindow() ) {
workspace->activeSubWindow()->close();
qApp->processEvents();
QVERIFY(activeWindow == workspace->activeSubWindow());
QCOMPARE(activeWindow, workspace->activeSubWindow());
QCOMPARE(spy.count(), 1);
spy.clear();
}
QVERIFY(activeWindow == 0);
QVERIFY(workspace->activeSubWindow() == 0);
QVERIFY(!activeWindow);
QVERIFY(!workspace->activeSubWindow());
QCOMPARE(workspace->subWindowList().count(), 0);
{
@ -432,13 +432,13 @@ void tst_QMdiArea::subWindowActivated()
QCOMPARE(spy.count(), 1);
spy.clear();
QVERIFY( activeWindow == window );
QVERIFY(workspace->activeSubWindow() == window);
QCOMPARE(workspace->activeSubWindow(), window);
window->close();
qApp->processEvents();
QCOMPARE(spy.count(), 1);
spy.clear();
QVERIFY(workspace->activeSubWindow() == 0);
QVERIFY( activeWindow == 0 );
QVERIFY(!workspace->activeSubWindow());
QVERIFY(!activeWindow);
}
}
@ -564,8 +564,8 @@ void tst_QMdiArea::subWindowActivatedWithMinimize()
window1->close();
qApp->processEvents();
QVERIFY(workspace->activeSubWindow() == 0);
QVERIFY( activeWindow == 0 );
QVERIFY(!workspace->activeSubWindow());
QVERIFY(!activeWindow);
QVERIFY( workspace->subWindowList().count() == 0 );
}
@ -1104,7 +1104,7 @@ void tst_QMdiArea::addAndRemoveWindows()
QVERIFY(window);
qApp->processEvents();
QCOMPARE(workspace.subWindowList().count(), 1);
QVERIFY(window->windowFlags() == DefaultWindowFlags);
QCOMPARE(window->windowFlags(), DefaultWindowFlags);
QCOMPARE(window->size(), workspace.viewport()->size());
}
@ -1115,7 +1115,7 @@ void tst_QMdiArea::addAndRemoveWindows()
QVERIFY(window);
qApp->processEvents();
QCOMPARE(workspace.subWindowList().count(), 2);
QVERIFY(window->windowFlags() == DefaultWindowFlags);
QCOMPARE(window->windowFlags(), DefaultWindowFlags);
QCOMPARE(window->size(), window->minimumSize());
}
@ -1127,7 +1127,7 @@ void tst_QMdiArea::addAndRemoveWindows()
QVERIFY(window);
qApp->processEvents();
QCOMPARE(workspace.subWindowList().count(), 3);
QVERIFY(window->windowFlags() == DefaultWindowFlags);
QCOMPARE(window->windowFlags(), DefaultWindowFlags);
QCOMPARE(window->size(), QSize(1500, 1500));
}
@ -1142,7 +1142,7 @@ void tst_QMdiArea::addAndRemoveWindows()
QMdiSubWindow *window = new QMdiSubWindow;
workspace.addSubWindow(window);
qApp->processEvents();
QVERIFY(window->windowFlags() == DefaultWindowFlags);
QCOMPARE(window->windowFlags(), DefaultWindowFlags);
window->setWidget(new QWidget);
QCOMPARE(workspace.subWindowList().count(), 4);
QTest::ignoreMessage(QtWarningMsg, "QMdiArea::addSubWindow: window is already added");
@ -1206,7 +1206,7 @@ void tst_QMdiArea::addAndRemoveWindowsWithReparenting()
{
QMdiArea workspace;
QMdiSubWindow window(&workspace);
QVERIFY(window.windowFlags() == DefaultWindowFlags);
QCOMPARE(window.windowFlags(), DefaultWindowFlags);
// 0 because the window list contains widgets and not actual
// windows. Silly, but that's the behavior.
@ -1219,7 +1219,7 @@ void tst_QMdiArea::addAndRemoveWindowsWithReparenting()
QCOMPARE(workspace.subWindowList().count(), 0);
window.setParent(&workspace);
QCOMPARE(workspace.subWindowList().count(), 1);
QVERIFY(window.windowFlags() == DefaultWindowFlags);
QCOMPARE(window.windowFlags(), DefaultWindowFlags);
QTest::ignoreMessage(QtWarningMsg, "QMdiArea::addSubWindow: window is already added");
workspace.addSubWindow(&window);

View File

@ -70,7 +70,7 @@ void tst_QOpenGLWidget::create()
QVERIFY(w->isValid());
QVERIFY(w->context());
QVERIFY(w->context()->format() == w->format());
QCOMPARE(w->context()->format(), w->format());
QVERIFY(w->defaultFramebufferObject() != 0);
}
@ -304,7 +304,7 @@ void tst_QOpenGLWidget::asViewport()
// the widget stack.
btn->update();
qApp->processEvents();
QVERIFY(view->paintCount() == 0);
QCOMPARE(view->paintCount(), 0);
}
class PaintCountWidget : public QOpenGLWidget

View File

@ -333,7 +333,7 @@ void tst_QPlainTextEdit::selectAllSetsNotSelection()
QSKIP("Test only relevant for systems with selection");
QApplication::clipboard()->setText(QString("foobar"), QClipboard::Selection);
QVERIFY(QApplication::clipboard()->text(QClipboard::Selection) == QString("foobar"));
QCOMPARE(QApplication::clipboard()->text(QClipboard::Selection), QString("foobar"));
ed->insertPlainText("Hello World");
ed->selectAll();
@ -905,13 +905,13 @@ void tst_QPlainTextEdit::mouseCursorShape()
{
// always show an IBeamCursor, see change 170146
QVERIFY(!ed->isReadOnly());
QVERIFY(ed->viewport()->cursor().shape() == Qt::IBeamCursor);
QCOMPARE(ed->viewport()->cursor().shape(), Qt::IBeamCursor);
ed->setReadOnly(true);
QVERIFY(ed->viewport()->cursor().shape() == Qt::IBeamCursor);
QCOMPARE(ed->viewport()->cursor().shape(), Qt::IBeamCursor);
ed->setPlainText("Foo");
QVERIFY(ed->viewport()->cursor().shape() == Qt::IBeamCursor);
QCOMPARE(ed->viewport()->cursor().shape(), Qt::IBeamCursor);
}
#endif
@ -1324,7 +1324,7 @@ void tst_QPlainTextEdit::preserveCharFormatAfterSetPlainText()
QTextBlock block = ed->document()->begin();
block = block.next();
QCOMPARE(block.text(), QString("This should still be blue"));
QVERIFY(block.begin().fragment().charFormat().foreground().color() == QColor(Qt::blue));
QCOMPARE(block.begin().fragment().charFormat().foreground().color(), QColor(Qt::blue));
}
void tst_QPlainTextEdit::extraSelections()
@ -1444,7 +1444,7 @@ void tst_QPlainTextEdit::wordWrapProperty()
doc->setDocumentLayout(new QPlainTextDocumentLayout(doc));
edit.setDocument(doc);
edit.setWordWrapMode(QTextOption::NoWrap);
QVERIFY(doc->defaultTextOption().wrapMode() == QTextOption::NoWrap);
QCOMPARE(doc->defaultTextOption().wrapMode(), QTextOption::NoWrap);
}
{
QPlainTextEdit edit;
@ -1452,18 +1452,18 @@ void tst_QPlainTextEdit::wordWrapProperty()
doc->setDocumentLayout(new QPlainTextDocumentLayout(doc));
edit.setWordWrapMode(QTextOption::NoWrap);
edit.setDocument(doc);
QVERIFY(doc->defaultTextOption().wrapMode() == QTextOption::NoWrap);
QCOMPARE(doc->defaultTextOption().wrapMode(), QTextOption::NoWrap);
}
}
void tst_QPlainTextEdit::lineWrapProperty()
{
QVERIFY(ed->wordWrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere);
QVERIFY(ed->lineWrapMode() == QPlainTextEdit::WidgetWidth);
QCOMPARE(ed->wordWrapMode(), QTextOption::WrapAtWordBoundaryOrAnywhere);
QCOMPARE(ed->lineWrapMode(), QPlainTextEdit::WidgetWidth);
ed->setLineWrapMode(QPlainTextEdit::NoWrap);
QVERIFY(ed->lineWrapMode() == QPlainTextEdit::NoWrap);
QVERIFY(ed->wordWrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere);
QVERIFY(ed->document()->defaultTextOption().wrapMode() == QTextOption::NoWrap);
QCOMPARE(ed->lineWrapMode(), QPlainTextEdit::NoWrap);
QCOMPARE(ed->wordWrapMode(), QTextOption::WrapAtWordBoundaryOrAnywhere);
QCOMPARE(ed->document()->defaultTextOption().wrapMode(), QTextOption::NoWrap);
}
void tst_QPlainTextEdit::selectionChanged()

View File

@ -227,8 +227,8 @@ void tst_QPushButton::autoRepeat()
QVERIFY( testWidget->isDown() );
QVERIFY( toggle_count == 0 );
QTest::keyRelease( testWidget, Qt::Key_Space );
QVERIFY(press_count == release_count);
QVERIFY(release_count == click_count);
QCOMPARE(press_count, release_count);
QCOMPARE(release_count, click_count);
QVERIFY(press_count > 1);
// #### shouldn't I check here to see if multiple signals have been fired???

View File

@ -166,8 +166,8 @@ void tst_QScrollArea::checkHFW_Task_197736()
scrollArea.setWidgetResizable(false);
scrollArea.resize(QSize(100,100));
w->resize(QSize(200,200));
QVERIFY(w->width() == 200);
QVERIFY(w->height() == 200);
QCOMPARE(w->width(), 200);
QCOMPARE(w->height(), 200);
}
QTEST_MAIN(tst_QScrollArea)

View File

@ -165,7 +165,7 @@ void tst_QTabWidget::init()
tw = new QTabWidget(0);
QCOMPARE(tw->count(), 0);
QCOMPARE(tw->currentIndex(), -1);
QVERIFY(tw->currentWidget() == NULL);
QVERIFY(!tw->currentWidget());
}
void tst_QTabWidget::cleanup()
@ -208,7 +208,7 @@ void tst_QTabWidget::addRemoveTab()
QCOMPARE(tw->count(), 0);
tw->removeTab(-1);
QCOMPARE(tw->count(), 0);
QVERIFY(tw->widget(-1) == 0);
QVERIFY(!tw->widget(-1));
QWidget *w = new QWidget();
int index = tw->addTab(w, LABEL);
@ -216,7 +216,7 @@ void tst_QTabWidget::addRemoveTab()
QCOMPARE(tw->indexOf(w), index);
QCOMPARE(tw->count(), 1);
QVERIFY(tw->widget(index) == w);
QCOMPARE(tw->widget(index), w);
QCOMPARE(tw->tabText(index), QString(LABEL));
removePage(index);
@ -333,21 +333,21 @@ void tst_QTabWidget::currentWidget()
{
// Test bad arguments
tw->setCurrentWidget(NULL);
QVERIFY(tw->currentWidget() == NULL);
QVERIFY(!tw->currentWidget());
int index = addPage();
QWidget *w = tw->widget(index);
QVERIFY(tw->currentWidget() == w);
QCOMPARE(tw->currentWidget(), w);
QCOMPARE(tw->currentIndex(), index);
tw->setCurrentWidget(NULL);
QVERIFY(tw->currentWidget() == w);
QCOMPARE(tw->currentWidget(), w);
QCOMPARE(tw->currentIndex(), index);
int index2 = addPage();
QWidget *w2 = tw->widget(index2);
Q_UNUSED(w2);
QVERIFY(tw->currentWidget() == w);
QCOMPARE(tw->currentWidget(), w);
QCOMPARE(tw->currentIndex(), index);
removePage(index2);
@ -372,7 +372,7 @@ void tst_QTabWidget::currentIndex()
QCOMPARE(tw->currentIndex(), firstIndex);
QCOMPARE(spy.count(), 1);
QList<QVariant> arguments = spy.takeFirst();
QVERIFY(arguments.at(0).toInt() == firstIndex);
QCOMPARE(arguments.at(0).toInt(), firstIndex);
int index = addPage();
QCOMPARE(tw->currentIndex(), firstIndex);
@ -380,19 +380,19 @@ void tst_QTabWidget::currentIndex()
QCOMPARE(tw->currentIndex(), index);
QCOMPARE(spy.count(), 1);
arguments = spy.takeFirst();
QVERIFY(arguments.at(0).toInt() == index);
QCOMPARE(arguments.at(0).toInt(), index);
removePage(index);
QCOMPARE(tw->currentIndex(), firstIndex);
QCOMPARE(spy.count(), 1);
arguments = spy.takeFirst();
QVERIFY(arguments.at(0).toInt() == firstIndex);
QCOMPARE(arguments.at(0).toInt(), firstIndex);
removePage(firstIndex);
QCOMPARE(tw->currentIndex(), -1);
QCOMPARE(spy.count(), 1);
arguments = spy.takeFirst();
QVERIFY(arguments.at(0).toInt() == -1);
QCOMPARE(arguments.at(0).toInt(), -1);
}
void tst_QTabWidget::cornerWidget()
@ -400,24 +400,24 @@ void tst_QTabWidget::cornerWidget()
// Test bad arguments
tw->setCornerWidget(NULL, Qt::TopRightCorner);
QVERIFY(tw->cornerWidget(Qt::TopLeftCorner) == 0);
QVERIFY(tw->cornerWidget(Qt::TopRightCorner) == 0);
QVERIFY(tw->cornerWidget(Qt::BottomLeftCorner) == 0);
QVERIFY(tw->cornerWidget(Qt::BottomRightCorner) == 0);
QVERIFY(!tw->cornerWidget(Qt::TopLeftCorner));
QVERIFY(!tw->cornerWidget(Qt::TopRightCorner));
QVERIFY(!tw->cornerWidget(Qt::BottomLeftCorner));
QVERIFY(!tw->cornerWidget(Qt::BottomRightCorner));
QWidget *w = new QWidget(0);
tw->setCornerWidget(w, Qt::TopLeftCorner);
QCOMPARE(w->parent(), (QObject *)tw);
QVERIFY(tw->cornerWidget(Qt::TopLeftCorner) == w);
QCOMPARE(tw->cornerWidget(Qt::TopLeftCorner), w);
tw->setCornerWidget(w, Qt::TopRightCorner);
QVERIFY(tw->cornerWidget(Qt::TopRightCorner) == w);
QCOMPARE(tw->cornerWidget(Qt::TopRightCorner), w);
tw->setCornerWidget(w, Qt::BottomLeftCorner);
QVERIFY(tw->cornerWidget(Qt::BottomLeftCorner) == w);
QCOMPARE(tw->cornerWidget(Qt::BottomLeftCorner), w);
tw->setCornerWidget(w, Qt::BottomRightCorner);
QVERIFY(tw->cornerWidget(Qt::BottomRightCorner) == w);
QCOMPARE(tw->cornerWidget(Qt::BottomRightCorner), w);
tw->setCornerWidget(0, Qt::TopRightCorner);
QVERIFY(tw->cornerWidget(Qt::TopRightCorner) == 0);
QVERIFY(!tw->cornerWidget(Qt::TopRightCorner));
QCOMPARE(w->isHidden(), true);
}

View File

@ -141,14 +141,14 @@ void tst_QTextBrowser::noReloadOnAnchorJump()
browser->setSource(url);
QCOMPARE(browser->htmlLoadAttempts, 1);
QVERIFY(!browser->toPlainText().isEmpty());
QVERIFY(browser->source() == url);
QCOMPARE(browser->source(), url);
}
void tst_QTextBrowser::bgColorOnSourceChange()
{
browser->setSource(QUrl::fromLocalFile("pagewithbg.html"));
QVERIFY(browser->document()->rootFrame()->frameFormat().hasProperty(QTextFormat::BackgroundBrush));
QVERIFY(browser->document()->rootFrame()->frameFormat().background().color() == Qt::blue);
QCOMPARE(browser->document()->rootFrame()->frameFormat().background().color(), QColor(Qt::blue));
browser->setSource(QUrl::fromLocalFile("pagewithoutbg.html"));
QVERIFY(!browser->document()->rootFrame()->frameFormat().hasProperty(QTextFormat::BackgroundBrush));
@ -167,12 +167,12 @@ void tst_QTextBrowser::forwardButton()
QVERIFY(!forwardEmissions.isEmpty());
QVariant val = forwardEmissions.takeLast()[0];
QVERIFY(val.type() == QVariant::Bool);
QCOMPARE(val.type(), QVariant::Bool);
QVERIFY(!val.toBool());
QVERIFY(!backwardEmissions.isEmpty());
val = backwardEmissions.takeLast()[0];
QVERIFY(val.type() == QVariant::Bool);
QCOMPARE(val.type(), QVariant::Bool);
QVERIFY(!val.toBool());
QVERIFY(browser->historyTitle(-1).isEmpty());
@ -185,12 +185,12 @@ void tst_QTextBrowser::forwardButton()
QVERIFY(!forwardEmissions.isEmpty());
val = forwardEmissions.takeLast()[0];
QVERIFY(val.type() == QVariant::Bool);
QCOMPARE(val.type(), QVariant::Bool);
QVERIFY(!val.toBool());
QVERIFY(!backwardEmissions.isEmpty());
val = backwardEmissions.takeLast()[0];
QVERIFY(val.type() == QVariant::Bool);
QCOMPARE(val.type(), QVariant::Bool);
QVERIFY(val.toBool());
QCOMPARE(browser->historyTitle(-1), QString("Page With BG"));
@ -201,12 +201,12 @@ void tst_QTextBrowser::forwardButton()
QVERIFY(!forwardEmissions.isEmpty());
val = forwardEmissions.takeLast()[0];
QVERIFY(val.type() == QVariant::Bool);
QCOMPARE(val.type(), QVariant::Bool);
QVERIFY(val.toBool());
QVERIFY(!backwardEmissions.isEmpty());
val = backwardEmissions.takeLast()[0];
QVERIFY(val.type() == QVariant::Bool);
QCOMPARE(val.type(), QVariant::Bool);
QVERIFY(!val.toBool());
QVERIFY(browser->historyTitle(-1).isEmpty());
@ -217,12 +217,12 @@ void tst_QTextBrowser::forwardButton()
QVERIFY(!forwardEmissions.isEmpty());
val = forwardEmissions.takeLast()[0];
QVERIFY(val.type() == QVariant::Bool);
QCOMPARE(val.type(), QVariant::Bool);
QVERIFY(!val.toBool());
QVERIFY(!backwardEmissions.isEmpty());
val = backwardEmissions.takeLast()[0];
QVERIFY(val.type() == QVariant::Bool);
QCOMPARE(val.type(), QVariant::Bool);
QVERIFY(val.toBool());
}
@ -244,29 +244,29 @@ void tst_QTextBrowser::relativeLinks()
QSignalSpy sourceChangedSpy(browser, SIGNAL(sourceChanged(QUrl)));
browser->setSource(QUrl("subdir/../qtextbrowser.html"));
QVERIFY(!browser->document()->isEmpty());
QVERIFY(sourceChangedSpy.count() == 1);
QCOMPARE(sourceChangedSpy.count(), 1);
QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("subdir/../qtextbrowser.html"));
browser->setSource(QUrl("subdir/index.html"));
QVERIFY(!browser->document()->isEmpty());
QVERIFY(sourceChangedSpy.count() == 1);
QCOMPARE(sourceChangedSpy.count(), 1);
QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("subdir/index.html"));
browser->setSource(QUrl("anchor.html"));
QVERIFY(!browser->document()->isEmpty());
QVERIFY(sourceChangedSpy.count() == 1);
QCOMPARE(sourceChangedSpy.count(), 1);
QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("anchor.html"));
browser->setSource(QUrl("subdir/index.html"));
QVERIFY(!browser->document()->isEmpty());
QVERIFY(sourceChangedSpy.count() == 1);
QCOMPARE(sourceChangedSpy.count(), 1);
QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("subdir/index.html"));
// using QUrl::fromLocalFile()
browser->setSource(QUrl::fromLocalFile("anchor.html"));
QVERIFY(!browser->document()->isEmpty());
QVERIFY(sourceChangedSpy.count() == 1);
QCOMPARE(sourceChangedSpy.count(), 1);
QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("file:anchor.html"));
browser->setSource(QUrl("subdir/../qtextbrowser.html"));
QVERIFY(!browser->document()->isEmpty());
QVERIFY(sourceChangedSpy.count() == 1);
QCOMPARE(sourceChangedSpy.count(), 1);
QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("subdir/../qtextbrowser.html"));
}
@ -446,13 +446,13 @@ void tst_QTextBrowser::sourceInsideLoadResource()
void tst_QTextBrowser::textInteractionFlags_vs_readOnly()
{
QVERIFY(browser->isReadOnly());
QVERIFY(browser->textInteractionFlags() == Qt::TextBrowserInteraction);
QCOMPARE(browser->textInteractionFlags(), Qt::TextBrowserInteraction);
browser->setReadOnly(true);
QVERIFY(browser->textInteractionFlags() == Qt::TextBrowserInteraction);
QCOMPARE(browser->textInteractionFlags(), Qt::TextBrowserInteraction);
browser->setReadOnly(false);
QVERIFY(browser->textInteractionFlags() == Qt::TextEditorInteraction);
QCOMPARE(browser->textInteractionFlags(), Qt::TextEditorInteraction);
browser->setReadOnly(true);
QVERIFY(browser->textInteractionFlags() == Qt::TextBrowserInteraction);
QCOMPARE(browser->textInteractionFlags(), Qt::TextBrowserInteraction);
}
void tst_QTextBrowser::anchorsWithSelfBuiltHtml()
@ -525,7 +525,7 @@ void tst_QTextBrowser::loadResourceOnRelativeLocalFiles()
QVERIFY(!browser->toPlainText().isEmpty());
QVariant v = browser->loadResource(QTextDocument::HtmlResource, QUrl("../anchor.html"));
QVERIFY(v.isValid());
QVERIFY(v.type() == QVariant::ByteArray);
QCOMPARE(v.type(), QVariant::ByteArray);
QVERIFY(!v.toByteArray().isEmpty());
}
@ -658,7 +658,7 @@ void tst_QTextBrowser::urlEncoding()
QCOMPARE(spy.count(), 1);
QUrl url = spy.at(0).at(0).toUrl();
QVERIFY(url.toEncoded() == QByteArray("http://www.google.com/q=%22"));
QCOMPARE(url.toEncoded(), QByteArray("http://www.google.com/q=%22"));
delete browser;
}

View File

@ -398,12 +398,13 @@ void tst_QTextEdit::cleanup()
void tst_QTextEdit::inlineAttributesOnInsert()
{
QVERIFY(ed->textCursor().charFormat().foreground().color() != Qt::blue);
const QColor blue(Qt::blue);
QVERIFY(ed->textCursor().charFormat().foreground().color() != blue);
ed->setTextColor(Qt::blue);
ed->setTextColor(blue);
QTest::keyClick(ed, Qt::Key_A);
QVERIFY(ed->textCursor().charFormat().foreground().color() == Qt::blue);
QCOMPARE(ed->textCursor().charFormat().foreground().color(), blue);
}
void tst_QTextEdit::inlineAttributesOnSelection()
@ -457,7 +458,7 @@ void tst_QTextEdit::autoBulletList1()
QTest::keyClicks(ed, "*This should become a list");
QVERIFY(ed->textCursor().currentList());
QVERIFY(ed->textCursor().currentList()->format().style() == QTextListFormat::ListDisc);
QCOMPARE(ed->textCursor().currentList()->format().style(), QTextListFormat::ListDisc);
}
void tst_QTextEdit::autoBulletList2()
@ -582,7 +583,7 @@ void tst_QTextEdit::selectAllSetsNotSelection()
}
QApplication::clipboard()->setText(QString("foobar"), QClipboard::Selection);
QVERIFY(QApplication::clipboard()->text(QClipboard::Selection) == QString("foobar"));
QCOMPARE(QApplication::clipboard()->text(QClipboard::Selection), QString("foobar"));
ed->insertPlainText("Hello World");
ed->selectAll();
@ -867,11 +868,12 @@ void tst_QTextEdit::appendShouldUseCurrentFormat()
fmt.setFontItalic(true);
ed->setCurrentCharFormat(fmt);
ed->append("Hello");
const QColor blue(Qt::blue);
QTextCursor cursor(ed->document());
QVERIFY(cursor.movePosition(QTextCursor::NextCharacter));
QVERIFY(cursor.charFormat().foreground().color() != Qt::blue);
QVERIFY(cursor.charFormat().foreground().color() != blue);
QVERIFY(!cursor.charFormat().fontItalic());
QVERIFY(cursor.movePosition(QTextCursor::NextBlock));
@ -883,7 +885,7 @@ void tst_QTextEdit::appendShouldUseCurrentFormat()
}
QVERIFY(cursor.movePosition(QTextCursor::NextCharacter));
QVERIFY(cursor.charFormat().foreground().color() == Qt::blue);
QCOMPARE(cursor.charFormat().foreground().color(), blue);
QVERIFY(cursor.charFormat().fontItalic());
}
@ -1211,7 +1213,7 @@ void tst_QTextEdit::lineWrapModes()
{
ed->setLineWrapMode(QTextEdit::NoWrap);
// NoWrap at the same time as having all lines that are all left aligned means we optimize to only layout once. The effect is that the width is always 0
QVERIFY(ed->document()->pageSize().width() == qreal(0));
QCOMPARE(ed->document()->pageSize().width(), qreal(0));
QTextCursor cursor = QTextCursor(ed->document());
cursor.insertText(QString("A simple line"));
@ -1237,13 +1239,13 @@ void tst_QTextEdit::mouseCursorShape()
{
// always show an IBeamCursor, see change 170146
QVERIFY(!ed->isReadOnly());
QVERIFY(ed->viewport()->cursor().shape() == Qt::IBeamCursor);
QCOMPARE(ed->viewport()->cursor().shape(), Qt::IBeamCursor);
ed->setReadOnly(true);
QVERIFY(ed->viewport()->cursor().shape() == Qt::IBeamCursor);
QCOMPARE(ed->viewport()->cursor().shape(), Qt::IBeamCursor);
ed->setPlainText("Foo");
QVERIFY(ed->viewport()->cursor().shape() == Qt::IBeamCursor);
QCOMPARE(ed->viewport()->cursor().shape(), Qt::IBeamCursor);
}
#endif
@ -1661,7 +1663,7 @@ void tst_QTextEdit::preserveCharFormatAfterSetPlainText()
QTextBlock block = ed->document()->begin();
block = block.next();
QCOMPARE(block.text(), QString("This should still be blue"));
QVERIFY(block.begin().fragment().charFormat().foreground().color() == QColor(Qt::blue));
QCOMPARE(block.begin().fragment().charFormat().foreground().color(), QColor(Qt::blue));
}
void tst_QTextEdit::extraSelections()
@ -1796,25 +1798,25 @@ void tst_QTextEdit::wordWrapProperty()
QTextDocument *doc = new QTextDocument(&edit);
edit.setDocument(doc);
edit.setWordWrapMode(QTextOption::NoWrap);
QVERIFY(doc->defaultTextOption().wrapMode() == QTextOption::NoWrap);
QCOMPARE(doc->defaultTextOption().wrapMode(), QTextOption::NoWrap);
}
{
QTextEdit edit;
QTextDocument *doc = new QTextDocument(&edit);
edit.setWordWrapMode(QTextOption::NoWrap);
edit.setDocument(doc);
QVERIFY(doc->defaultTextOption().wrapMode() == QTextOption::NoWrap);
QCOMPARE(doc->defaultTextOption().wrapMode(), QTextOption::NoWrap);
}
}
void tst_QTextEdit::lineWrapProperty()
{
QVERIFY(ed->wordWrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere);
QVERIFY(ed->lineWrapMode() == QTextEdit::WidgetWidth);
QCOMPARE(ed->wordWrapMode(), QTextOption::WrapAtWordBoundaryOrAnywhere);
QCOMPARE(ed->lineWrapMode(), QTextEdit::WidgetWidth);
ed->setLineWrapMode(QTextEdit::NoWrap);
QVERIFY(ed->lineWrapMode() == QTextEdit::NoWrap);
QVERIFY(ed->wordWrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere);
QVERIFY(ed->document()->defaultTextOption().wrapMode() == QTextOption::NoWrap);
QCOMPARE(ed->lineWrapMode(), QTextEdit::NoWrap);
QCOMPARE(ed->wordWrapMode(), QTextOption::WrapAtWordBoundaryOrAnywhere);
QCOMPARE(ed->document()->defaultTextOption().wrapMode(), QTextOption::NoWrap);
}
void tst_QTextEdit::selectionChanged()
@ -2119,7 +2121,7 @@ void tst_QTextEdit::setDocumentPreservesPalette()
QTextDocument *newDoc = new QTextDocument(ed);
ed->setDocument(newDoc);
QVERIFY(control->document() == newDoc);
QCOMPARE(control->document(), newDoc);
QVERIFY(whitePal.color(QPalette::Active, QPalette::Text)
== control->palette().color(QPalette::Active, QPalette::Text));
}

View File

@ -513,13 +513,13 @@ void tst_QToolBar::insertWidget()
QToolBar tb;
QPointer<QWidget> widget = new QWidget;
QAction *action = tb.addWidget(widget);
QVERIFY(action->parent() == &tb);
QCOMPARE(action->parent(), &tb);
QToolBar tb2;
tb.removeAction(action);
tb2.addAction(action);
QVERIFY(widget && widget->parent() == &tb2);
QVERIFY(action->parent() == &tb2);
QCOMPARE(action->parent(), &tb2);
}
}
@ -978,10 +978,10 @@ void tst_QToolBar::actionOwnership()
QToolBar *tb2 = new QToolBar;
QPointer<QAction> action = tb1->addAction("test");
QVERIFY(action->parent() == tb1);
QCOMPARE(action->parent(), tb1);
tb2->addAction(action);
QVERIFY(action->parent() == tb1);
QCOMPARE(action->parent(), tb1);
delete tb1;
QVERIFY(!action);
@ -992,13 +992,13 @@ void tst_QToolBar::actionOwnership()
QToolBar *tb2 = new QToolBar;
QPointer<QAction> action = tb1->addAction("test");
QVERIFY(action->parent() == tb1);
QCOMPARE(action->parent(), tb1);
tb1->removeAction(action);
QVERIFY(action->parent() == tb1);
QCOMPARE(action->parent(), tb1);
tb2->addAction(action);
QVERIFY(action->parent() == tb1);
QCOMPARE(action->parent(), tb1);
delete tb1;
QVERIFY(!action);

View File

@ -170,10 +170,10 @@ void tst_QToolButton::collapseTextOnPriority()
QStyleOptionToolButton option;
button.initStyleOption(&option);
QVERIFY(option.toolButtonStyle == Qt::ToolButtonTextBesideIcon);
QCOMPARE(option.toolButtonStyle, Qt::ToolButtonTextBesideIcon);
action.setPriority(QAction::LowPriority);
button.initStyleOption(&option);
QVERIFY(option.toolButtonStyle == Qt::ToolButtonIconOnly);
QCOMPARE(option.toolButtonStyle, Qt::ToolButtonIconOnly);
}