mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-02 07:15:27 +08:00
qt 6.6.0 clean
This commit is contained in:
@ -38,6 +38,9 @@ private slots:
|
||||
void detailsButtonText();
|
||||
void expandDetailsWithoutMoving();
|
||||
|
||||
void optionsEmptyByDefault();
|
||||
void changeNativeOption();
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
void shortcut();
|
||||
#endif
|
||||
@ -627,6 +630,20 @@ void tst_QMessageBox::expandDetailsWithoutMoving() // QTBUG-32473
|
||||
QCOMPARE(box.geometry().topLeft(), geom.topLeft());
|
||||
}
|
||||
|
||||
void tst_QMessageBox::optionsEmptyByDefault()
|
||||
{
|
||||
QMessageBox b;
|
||||
QCOMPARE(b.options(), QMessageBox::Options());
|
||||
QVERIFY(!b.testOption(QMessageBox::Option::DontUseNativeDialog));
|
||||
}
|
||||
|
||||
void tst_QMessageBox::changeNativeOption()
|
||||
{
|
||||
QMessageBox b;
|
||||
b.setOption(QMessageBox::Option::DontUseNativeDialog);
|
||||
QCOMPARE(b.options(), QMessageBox::Options(QMessageBox::Option::DontUseNativeDialog));
|
||||
}
|
||||
|
||||
void tst_QMessageBox::incorrectDefaultButton()
|
||||
{
|
||||
ExecCloseHelper closeHelper;
|
||||
|
@ -84,7 +84,7 @@ void tst_QProgressDialog::autoShow()
|
||||
// in order to test for the setValue() behavior instead
|
||||
// See autoShowCtor() for the ctor timer check
|
||||
dlg.setValue(value);
|
||||
QThread::msleep(delay);
|
||||
QThread::sleep(std::chrono::milliseconds{delay});
|
||||
dlg.setValue(min+1);
|
||||
QCOMPARE(dlg.isVisible(), expectedAutoShow);
|
||||
}
|
||||
@ -93,7 +93,7 @@ void tst_QProgressDialog::autoShowCtor()
|
||||
{
|
||||
QProgressDialog dlg;
|
||||
QVERIFY(!dlg.isVisible());
|
||||
QThread::msleep(dlg.minimumDuration());
|
||||
QThread::sleep(std::chrono::milliseconds{dlg.minimumDuration()});
|
||||
QTRY_VERIFY(dlg.isVisible());
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ void tst_QProgressDialog::QTBUG_31046()
|
||||
{
|
||||
QProgressDialog dlg("", "", 50, 60);
|
||||
dlg.setValue(0);
|
||||
QThread::msleep(200);
|
||||
QThread::sleep(std::chrono::milliseconds{200});
|
||||
dlg.setValue(50);
|
||||
QCOMPARE(50, dlg.value());
|
||||
}
|
||||
|
@ -4873,7 +4873,7 @@ void tst_QTableView::selectWithHeader()
|
||||
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
|
||||
QHeaderView *header;
|
||||
QHeaderView *header = nullptr;
|
||||
QPoint clickPos;
|
||||
QModelIndex lastIndex;
|
||||
|
||||
|
@ -174,6 +174,7 @@ private slots:
|
||||
void appFocusWidgetWhenLosingFocusProxy();
|
||||
void explicitTabOrderWithComplexWidget();
|
||||
void explicitTabOrderWithSpinBox_QTBUG81097();
|
||||
void tabOrderList();
|
||||
void tabOrderComboBox_data();
|
||||
void tabOrderComboBox();
|
||||
#if defined(Q_OS_WIN)
|
||||
@ -1932,6 +1933,26 @@ public:
|
||||
QLineEdit *lineEdit3;
|
||||
};
|
||||
|
||||
static QList<QWidget *> getFocusChain(QWidget *start, bool bForward)
|
||||
{
|
||||
QList<QWidget *> ret;
|
||||
QWidget *cur = start;
|
||||
// detect infinite loop
|
||||
int count = 100;
|
||||
auto loopGuard = qScopeGuard([]{
|
||||
QFAIL("Inifinite loop detected in focus chain");
|
||||
});
|
||||
do {
|
||||
ret += cur;
|
||||
auto widgetPrivate = static_cast<QWidgetPrivate *>(qt_widget_private(cur));
|
||||
cur = bForward ? widgetPrivate->focus_next : widgetPrivate->focus_prev;
|
||||
if (!--count)
|
||||
return ret;
|
||||
} while (cur != start);
|
||||
loopGuard.dismiss();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void tst_QWidget::defaultTabOrder()
|
||||
{
|
||||
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
|
||||
@ -2051,6 +2072,17 @@ void tst_QWidget::reverseTabOrder()
|
||||
QVERIFY(firstEdit->hasFocus());
|
||||
}
|
||||
|
||||
void tst_QWidget::tabOrderList()
|
||||
{
|
||||
Composite c;
|
||||
QCOMPARE(getFocusChain(&c, true),
|
||||
QList<QWidget *>({&c, c.lineEdit1, c.lineEdit2, c.lineEdit3}));
|
||||
QWidget::setTabOrder({c.lineEdit3, c.lineEdit2, c.lineEdit1});
|
||||
// not starting with 3 like one would maybe expect, but still 3, 2, 1
|
||||
QCOMPARE(getFocusChain(&c, true),
|
||||
QList<QWidget *>({&c, c.lineEdit1, c.lineEdit3, c.lineEdit2}));
|
||||
}
|
||||
|
||||
void tst_QWidget::tabOrderComboBox_data()
|
||||
{
|
||||
QTest::addColumn<const bool>("editableAtBeginning");
|
||||
@ -2061,26 +2093,6 @@ void tst_QWidget::tabOrderComboBox_data()
|
||||
QTest::addRow("4 editable") << true << QList<int>{2, 1, 0, 3} << QList<int>{3, 0, 2, 1};
|
||||
}
|
||||
|
||||
static QList<QWidget *> getFocusChain(QWidget *start, bool bForward)
|
||||
{
|
||||
QList<QWidget *> ret;
|
||||
QWidget *cur = start;
|
||||
// detect infinite loop
|
||||
int count = 100;
|
||||
auto loopGuard = qScopeGuard([]{
|
||||
QFAIL("Inifinite loop detected in focus chain");
|
||||
});
|
||||
do {
|
||||
ret += cur;
|
||||
auto widgetPrivate = static_cast<QWidgetPrivate *>(qt_widget_private(cur));
|
||||
cur = bForward ? widgetPrivate->focus_next : widgetPrivate->focus_prev;
|
||||
if (!--count)
|
||||
return ret;
|
||||
} while (cur != start);
|
||||
loopGuard.dismiss();
|
||||
return ret;
|
||||
}
|
||||
|
||||
QWidgetList expectedFocusChain(const QList<QComboBox *> &boxes, const QList<int> &sequence)
|
||||
{
|
||||
Q_ASSERT(boxes.count() == sequence.count());
|
||||
@ -2132,6 +2144,7 @@ void tst_QWidget::tabOrderComboBox()
|
||||
QFETCH(const QList<int>, secondTabOrder);
|
||||
const int count = firstTabOrder.count();
|
||||
Q_ASSERT(count == secondTabOrder.count());
|
||||
Q_ASSERT(count > 1);
|
||||
|
||||
QWidget w;
|
||||
w.setObjectName("MainWidget");
|
||||
@ -2164,6 +2177,31 @@ void tst_QWidget::tabOrderComboBox()
|
||||
|
||||
COMPARE(secondTabOrder);
|
||||
|
||||
// Remove the focus proxy of the first combobox's line edit.
|
||||
QComboBox *box = boxes.at(0);
|
||||
QLineEdit *lineEdit = box->lineEdit();
|
||||
QWidgetPrivate *lePriv = QWidgetPrivate::get(lineEdit);
|
||||
const QWidget *prev = lePriv->focus_prev;
|
||||
const QWidget *next = lePriv->focus_next;
|
||||
const QWidget *proxy = lePriv->extra->focus_proxy;
|
||||
QCOMPARE(proxy, box);
|
||||
lineEdit->setFocusProxy(nullptr);
|
||||
QCOMPARE(lePriv->extra->focus_proxy, nullptr);
|
||||
QCOMPARE(lePriv->focus_prev, prev);
|
||||
QCOMPARE(lePriv->focus_next, next);
|
||||
|
||||
// Remove first item and check chain consistency
|
||||
boxes.removeFirst();
|
||||
delete box;
|
||||
|
||||
// Create new list with 0 removed and other indexes updated
|
||||
QList<int> thirdTabOrder(secondTabOrder);
|
||||
thirdTabOrder.removeIf([](int i){ return i == 0; });
|
||||
for (int &i : thirdTabOrder)
|
||||
--i;
|
||||
|
||||
COMPARE(thirdTabOrder);
|
||||
|
||||
#undef COMPARE
|
||||
}
|
||||
|
||||
@ -2557,9 +2595,9 @@ void tst_QWidget::tabOrderWithCompoundWidgetsInflection()
|
||||
qCritical() << " Actual :" << forwardChain;
|
||||
qCritical() << " Expected:" << expectedFocusChain;
|
||||
});
|
||||
for (qsizetype i = 0; i < expectedFocusChain.size() - 2; ++i) {
|
||||
QVERIFY(forwardChain.indexOf(expectedFocusChain.at(i)) <
|
||||
forwardChain.indexOf(expectedFocusChain.at(i + 1)));
|
||||
for (qsizetype i = 0; i < expectedFocusChain.size() - 2; ++i) {
|
||||
QCOMPARE_LT(forwardChain.indexOf(expectedFocusChain.at(i)),
|
||||
forwardChain.indexOf(expectedFocusChain.at(i + 1)));
|
||||
}
|
||||
logger.dismiss();
|
||||
}
|
||||
|
@ -107,6 +107,7 @@ private slots:
|
||||
void QTBUG36933_brokenPseudoClassLookup();
|
||||
void styleSheetChangeBeforePolish();
|
||||
void placeholderColor();
|
||||
void accent();
|
||||
void enumPropertySelector_data();
|
||||
void enumPropertySelector();
|
||||
//at the end because it mess with the style.
|
||||
@ -2405,6 +2406,15 @@ void tst_QStyleSheetStyle::placeholderColor()
|
||||
QCOMPARE(le1.palette().placeholderText().color(), QColor(phSpec));
|
||||
}
|
||||
|
||||
void tst_QStyleSheetStyle::accent()
|
||||
{
|
||||
QLineEdit lineEdit;
|
||||
const QColor universe(42, 42, 42);
|
||||
lineEdit.setStyleSheet(QString("QLineEdit { accent-color: %1; }").arg(universe.name()));
|
||||
lineEdit.ensurePolished();
|
||||
QCOMPARE(lineEdit.palette().accent().color(), universe);
|
||||
}
|
||||
|
||||
void tst_QStyleSheetStyle::enumPropertySelector_data()
|
||||
{
|
||||
QTest::addColumn<QString>("styleSheet");
|
||||
|
@ -110,11 +110,19 @@ void tst_QCalendarWidget::getSetCheck()
|
||||
object.setSelectedDate(selectedDate);
|
||||
QCOMPARE(minDate, object.selectedDate());
|
||||
QVERIFY(selectedDate != object.selectedDate());
|
||||
object.clearMinimumDate();
|
||||
object.setSelectedDate(selectedDate);
|
||||
QCOMPARE(selectedDate, object.selectedDate());
|
||||
|
||||
//date should not go beyond the maximum.
|
||||
selectedDate = maxDate.addDays(10);
|
||||
object.setSelectedDate(selectedDate);
|
||||
QCOMPARE(maxDate, object.selectedDate());
|
||||
QVERIFY(selectedDate != object.selectedDate());
|
||||
object.clearMaximumDate();
|
||||
object.setSelectedDate(selectedDate);
|
||||
QCOMPARE(selectedDate, object.selectedDate());
|
||||
|
||||
//show today
|
||||
QDate today = QDate::currentDate();
|
||||
object.showToday();
|
||||
|
@ -191,24 +191,29 @@ void tst_QCheckBox::toggled()
|
||||
void tst_QCheckBox::stateChanged()
|
||||
{
|
||||
QCheckBox testWidget;
|
||||
int cur_state = -1;
|
||||
QCOMPARE(testWidget.checkState(), Qt::Unchecked);
|
||||
|
||||
Qt::CheckState cur_state = Qt::Unchecked;
|
||||
QSignalSpy stateChangedSpy(&testWidget, &QCheckBox::stateChanged);
|
||||
connect(&testWidget, &QCheckBox::stateChanged, this, [&](int state) { ++cur_state = state; });
|
||||
connect(&testWidget, &QCheckBox::stateChanged, this, [&](auto state) { cur_state = Qt::CheckState(state); });
|
||||
testWidget.setChecked(true);
|
||||
QCoreApplication::processEvents();
|
||||
QCOMPARE(cur_state, 2);
|
||||
QVERIFY(QTest::qWaitFor([&]() { return stateChangedSpy.size() == 1; }));
|
||||
QCOMPARE(stateChangedSpy.size(), 1);
|
||||
QCOMPARE(cur_state, Qt::Checked);
|
||||
QCOMPARE(testWidget.checkState(), Qt::Checked);
|
||||
|
||||
cur_state = -1;
|
||||
testWidget.setChecked(false);
|
||||
QCoreApplication::processEvents();
|
||||
QCOMPARE(cur_state, 0);
|
||||
QVERIFY(QTest::qWaitFor([&]() { return stateChangedSpy.size() == 2; }));
|
||||
QCOMPARE(stateChangedSpy.size(), 2);
|
||||
QCOMPARE(cur_state, Qt::Unchecked);
|
||||
QCOMPARE(testWidget.checkState(), Qt::Unchecked);
|
||||
|
||||
cur_state = -1;
|
||||
testWidget.setCheckState(Qt::PartiallyChecked);
|
||||
QCoreApplication::processEvents();
|
||||
QCOMPARE(cur_state, 1);
|
||||
|
||||
QVERIFY(QTest::qWaitFor([&]() { return stateChangedSpy.size() == 3; }));
|
||||
QCOMPARE(stateChangedSpy.size(), 3);
|
||||
QCOMPARE(cur_state, Qt::PartiallyChecked);
|
||||
QCOMPARE(testWidget.checkState(), Qt::PartiallyChecked);
|
||||
|
||||
testWidget.setCheckState(Qt::PartiallyChecked);
|
||||
QCoreApplication::processEvents();
|
||||
QCOMPARE(stateChangedSpy.size(), 3);
|
||||
|
@ -1505,42 +1505,70 @@ void tst_QComboBox::currentTextChanged()
|
||||
testWidget->addItems(QStringList() << "foo" << "bar");
|
||||
QCOMPARE(testWidget->count(), 2);
|
||||
|
||||
QSignalSpy spy(testWidget, SIGNAL(currentTextChanged(QString)));
|
||||
QSignalSpy textChangedSpy(testWidget, &QComboBox::currentTextChanged);
|
||||
|
||||
testWidget->setEditable(editable);
|
||||
|
||||
// set text in list
|
||||
testWidget->setCurrentIndex(0);
|
||||
QCOMPARE(testWidget->currentIndex(), 0);
|
||||
spy.clear();
|
||||
textChangedSpy.clear();
|
||||
testWidget->setCurrentText(QString("bar"));
|
||||
QCOMPARE(spy.size(), 1);
|
||||
QCOMPARE(qvariant_cast<QString>(spy.at(0).at(0)), QString("bar"));
|
||||
QCOMPARE(textChangedSpy.size(), 1);
|
||||
QCOMPARE(qvariant_cast<QString>(textChangedSpy.at(0).at(0)), QString("bar"));
|
||||
|
||||
// set text not in list
|
||||
testWidget->setCurrentIndex(0);
|
||||
QCOMPARE(testWidget->currentIndex(), 0);
|
||||
spy.clear();
|
||||
textChangedSpy.clear();
|
||||
testWidget->setCurrentText(QString("qt"));
|
||||
if (editable) {
|
||||
QCOMPARE(spy.size(), 1);
|
||||
QCOMPARE(qvariant_cast<QString>(spy.at(0).at(0)), QString("qt"));
|
||||
QCOMPARE(textChangedSpy.size(), 1);
|
||||
QCOMPARE(qvariant_cast<QString>(textChangedSpy.at(0).at(0)), QString("qt"));
|
||||
} else {
|
||||
QCOMPARE(spy.size(), 0);
|
||||
QCOMPARE(textChangedSpy.size(), 0);
|
||||
}
|
||||
|
||||
// item changed
|
||||
testWidget->setCurrentIndex(0);
|
||||
QCOMPARE(testWidget->currentIndex(), 0);
|
||||
spy.clear();
|
||||
textChangedSpy.clear();
|
||||
testWidget->setItemText(0, QString("ape"));
|
||||
QCOMPARE(spy.size(), 1);
|
||||
QCOMPARE(qvariant_cast<QString>(spy.at(0).at(0)), QString("ape"));
|
||||
QCOMPARE(textChangedSpy.size(), 1);
|
||||
QCOMPARE(qvariant_cast<QString>(textChangedSpy.at(0).at(0)), QString("ape"));
|
||||
|
||||
// change it back
|
||||
spy.clear();
|
||||
textChangedSpy.clear();
|
||||
testWidget->setItemText(0, QString("foo"));
|
||||
QCOMPARE(spy.size(), 1);
|
||||
QCOMPARE(qvariant_cast<QString>(spy.at(0).at(0)), QString("foo"));
|
||||
QCOMPARE(textChangedSpy.size(), 1);
|
||||
QCOMPARE(qvariant_cast<QString>(textChangedSpy.at(0).at(0)), QString("foo"));
|
||||
|
||||
// currentIndexChanged vs. currentTextChanged
|
||||
testWidget->clear();
|
||||
testWidget->addItems(QStringList() << "first" << "second" << "third" << "fourth" << "fourth");
|
||||
testWidget->setCurrentIndex(4);
|
||||
textChangedSpy.clear();
|
||||
QSignalSpy indexChangedSpy(testWidget, &QComboBox::currentIndexChanged);
|
||||
|
||||
// Index change w/o text change
|
||||
testWidget->removeItem(3);
|
||||
QCOMPARE(textChangedSpy.count(), 0);
|
||||
QCOMPARE(indexChangedSpy.count(), 1);
|
||||
|
||||
// Index and text change
|
||||
testWidget->setCurrentIndex(0);
|
||||
QCOMPARE(textChangedSpy.count(), 1);
|
||||
QCOMPARE(indexChangedSpy.count(), 2);
|
||||
|
||||
// remove item above current index
|
||||
testWidget->removeItem(2);
|
||||
QCOMPARE(textChangedSpy.count(), 1);
|
||||
QCOMPARE(indexChangedSpy.count(), 2);
|
||||
|
||||
// Text change w/o index change
|
||||
testWidget->setItemText(0, "first class");
|
||||
QCOMPARE(textChangedSpy.count(), 2);
|
||||
QCOMPARE(indexChangedSpy.count(), 2);
|
||||
}
|
||||
|
||||
void tst_QComboBox::editTextChanged()
|
||||
|
@ -267,6 +267,8 @@ private slots:
|
||||
void inputMethodQueryImHints_data();
|
||||
void inputMethodQueryImHints();
|
||||
|
||||
void inputMethodQueryEnterKeyType();
|
||||
|
||||
void inputMethodUpdate();
|
||||
|
||||
void undoRedoAndEchoModes_data();
|
||||
@ -4441,6 +4443,33 @@ void tst_QLineEdit::inputMethodQueryImHints()
|
||||
QCOMPARE(static_cast<Qt::InputMethodHints>(value.toInt()), hints);
|
||||
}
|
||||
|
||||
void tst_QLineEdit::inputMethodQueryEnterKeyType()
|
||||
{
|
||||
QWidget mw;
|
||||
QVBoxLayout layout(&mw);
|
||||
QLineEdit le1(&mw);
|
||||
layout.addWidget(&le1);
|
||||
mw.show();
|
||||
QVariant enterType = le1.inputMethodQuery(Qt::ImEnterKeyType);
|
||||
QCOMPARE(enterType.value<Qt::EnterKeyType>(), Qt::EnterKeyDefault);
|
||||
|
||||
mw.hide();
|
||||
QLineEdit le2(&mw);
|
||||
layout.addWidget(&le2);
|
||||
mw.show();
|
||||
|
||||
enterType = le1.inputMethodQuery(Qt::ImEnterKeyType);
|
||||
#ifdef Q_OS_ANDROID
|
||||
// QTBUG-61652
|
||||
// EnterKey is changed to EnterKeyNext if the focus can be moved to widget below
|
||||
QCOMPARE(enterType.value<Qt::EnterKeyType>(), Qt::EnterKeyNext);
|
||||
#else
|
||||
QCOMPARE(enterType.value<Qt::EnterKeyType>(), Qt::EnterKeyDefault);
|
||||
#endif
|
||||
enterType = le2.inputMethodQuery(Qt::ImEnterKeyType);
|
||||
QCOMPARE(enterType.value<Qt::EnterKeyType>(), Qt::EnterKeyDefault);
|
||||
}
|
||||
|
||||
void tst_QLineEdit::inputMethodUpdate()
|
||||
{
|
||||
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
|
||||
|
@ -16,6 +16,7 @@ android
|
||||
android
|
||||
[pushButtonPopulateOnAboutToShow]
|
||||
android
|
||||
wayland
|
||||
[QTBUG8122_widgetActionCrashOnClose]
|
||||
android
|
||||
[click_while_dismissing_submenu]
|
||||
|
@ -1146,14 +1146,18 @@ void tst_QMenu::pushButtonPopulateOnAboutToShow()
|
||||
QSKIP("Your window manager won't allow a window against the bottom of the screen");
|
||||
}
|
||||
|
||||
QTimer::singleShot(300, buttonMenu, SLOT(hide()));
|
||||
QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center());
|
||||
QVERIFY(QTest::qWaitForWindowExposed(buttonMenu));
|
||||
QTest::qWait(300);
|
||||
buttonMenu->hide();
|
||||
QVERIFY2(!buttonMenu->geometry().intersects(b.geometry()), msgGeometryIntersects(buttonMenu->geometry(), b.geometry()));
|
||||
|
||||
// note: we're assuming that, if we previously got the desired geometry, we'll get it here too
|
||||
b.move(10, screen.bottom()-buttonMenu->height()-5);
|
||||
QTimer::singleShot(300, buttonMenu, SLOT(hide()));
|
||||
QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center());
|
||||
QVERIFY(QTest::qWaitForWindowExposed(buttonMenu));
|
||||
QTest::qWait(300);
|
||||
buttonMenu->hide();
|
||||
QVERIFY2(!buttonMenu->geometry().intersects(b.geometry()), msgGeometryIntersects(buttonMenu->geometry(), b.geometry()));
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QtOpenGLWidgets/QOpenGLWidget>
|
||||
#include <QtGui/QOpenGLFunctions>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QBackingStore>
|
||||
#include <QtGui/QScreen>
|
||||
#include <QtGui/QStaticText>
|
||||
#include <QtWidgets/QGraphicsView>
|
||||
@ -21,7 +22,9 @@
|
||||
#include <private/qopengltextureglyphcache_p.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <qpa/qplatformbackingstore.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <rhi/qrhi.h>
|
||||
|
||||
class tst_QOpenGLWidget : public QObject
|
||||
{
|
||||
@ -33,6 +36,9 @@ private slots:
|
||||
void clearAndGrab();
|
||||
void clearAndResizeAndGrab();
|
||||
void createNonTopLevel();
|
||||
#if QT_CONFIG(egl)
|
||||
void deviceLoss();
|
||||
#endif
|
||||
void painter();
|
||||
void reparentToAlreadyCreated();
|
||||
void reparentToNotYetCreated();
|
||||
@ -189,6 +195,45 @@ void tst_QOpenGLWidget::createNonTopLevel()
|
||||
QVERIFY(QOpenGLContext::currentContext() == glw->context() && glw->context());
|
||||
}
|
||||
|
||||
#if QT_CONFIG(egl)
|
||||
void tst_QOpenGLWidget::deviceLoss()
|
||||
{
|
||||
QScopedPointer<QOpenGLWidget> w(new ClearWidget(0, 640, 480));
|
||||
|
||||
w->resize(640, 480);
|
||||
w->show();
|
||||
|
||||
auto rhi = w->backingStore()->handle()->rhi();
|
||||
QNativeInterface::QEGLContext *rhiContext = nullptr;
|
||||
if (rhi->backend() == QRhi::OpenGLES2) {
|
||||
auto rhiHandles = static_cast<const QRhiGles2NativeHandles *>(rhi->nativeHandles());
|
||||
rhiContext = rhiHandles->context->nativeInterface<QNativeInterface::QEGLContext>();
|
||||
}
|
||||
if (!rhiContext)
|
||||
QSKIP("deviceLoss needs EGL");
|
||||
|
||||
QVERIFY(QTest::qWaitForWindowExposed(w.data()));
|
||||
|
||||
QImage image = w->grabFramebuffer();
|
||||
QVERIFY(!image.isNull());
|
||||
QCOMPARE(image.width(), w->width());
|
||||
QCOMPARE(image.height(), w->height());
|
||||
QVERIFY(image.pixel(30, 40) == qRgb(255, 0, 0));
|
||||
|
||||
rhiContext->invalidateContext();
|
||||
|
||||
w->resize(600, 600);
|
||||
QSignalSpy frameSwappedSpy(w.get(), &QOpenGLWidget::resized);
|
||||
QTRY_VERIFY(frameSwappedSpy.size() > 0);
|
||||
|
||||
image = w->grabFramebuffer();
|
||||
QVERIFY(!image.isNull());
|
||||
QCOMPARE(image.width(), w->width());
|
||||
QCOMPARE(image.height(), w->height());
|
||||
QVERIFY(image.pixel(30, 40) == qRgb(255, 0, 0));
|
||||
}
|
||||
#endif
|
||||
|
||||
class PainterWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
||||
{
|
||||
public:
|
||||
|
@ -1829,7 +1829,7 @@ void tst_QPlainTextEdit::placeholderVisibility_data()
|
||||
QTest::addColumn<QList<SetupCommand>>("setupCommands");
|
||||
QTest::addColumn<bool>("placeholderVisible");
|
||||
QTest::addRow("no placeholder set + no text set")
|
||||
<< QList<SetupCommand>{} << true;
|
||||
<< QList<SetupCommand>{} << false;
|
||||
QTest::addRow("no placeholder set + text set or text set + no placeholder set")
|
||||
<< QList<SetupCommand>{ SetContent } << false;
|
||||
QTest::addRow("no placeholder set + text set + empty text set")
|
||||
@ -1839,7 +1839,7 @@ void tst_QPlainTextEdit::placeholderVisibility_data()
|
||||
<< QList<SetupCommand>{ ClearContent, SetContent }
|
||||
<< false;
|
||||
QTest::addRow("empty placeholder set + no text set")
|
||||
<< QList<SetupCommand>{ ClearPlaceHolder } << true;
|
||||
<< QList<SetupCommand>{ ClearPlaceHolder } << false;
|
||||
QTest::addRow("empty placeholder set + text set")
|
||||
<< QList<SetupCommand>{ ClearPlaceHolder, SetContent }
|
||||
<< false;
|
||||
@ -1916,7 +1916,7 @@ void tst_QPlainTextEdit::placeholderVisibility()
|
||||
|
||||
plainTextEdit.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&plainTextEdit));
|
||||
QTRY_VERIFY(plainTextEdit_d->placeholderVisible == placeholderVisible);
|
||||
QTRY_VERIFY(plainTextEdit_d->isPlaceHolderTextVisible() == placeholderVisible);
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,16 +58,15 @@ private slots:
|
||||
protected slots:
|
||||
void resetCounters();
|
||||
void onClicked();
|
||||
void onToggled( bool on );
|
||||
void onToggled(bool on);
|
||||
void onPressed();
|
||||
void onReleased();
|
||||
void helperSlotDelete();
|
||||
|
||||
private:
|
||||
uint click_count;
|
||||
uint toggle_count;
|
||||
uint press_count;
|
||||
uint release_count;
|
||||
int click_count;
|
||||
int toggle_count;
|
||||
int press_count;
|
||||
int release_count;
|
||||
|
||||
QPushButton *testWidget;
|
||||
QPointingDevice *m_touchScreen = QTest::createTouchDevice();
|
||||
@ -82,40 +81,40 @@ void tst_QPushButton::getSetCheck()
|
||||
QMenu *var1 = new QMenu;
|
||||
obj1.setMenu(var1);
|
||||
QCOMPARE(var1, obj1.menu());
|
||||
obj1.setMenu((QMenu *)0);
|
||||
QCOMPARE((QMenu *)0, obj1.menu());
|
||||
obj1.setMenu(nullptr);
|
||||
QCOMPARE(obj1.menu(), nullptr);
|
||||
delete var1;
|
||||
}
|
||||
|
||||
void tst_QPushButton::initTestCase()
|
||||
{
|
||||
// Create the test class
|
||||
testWidget = new QPushButton( "&Start", 0 );
|
||||
testWidget = new QPushButton("&Start", 0);
|
||||
testWidget->setObjectName("testWidget");
|
||||
testWidget->resize( 200, 200 );
|
||||
testWidget->resize(200, 200);
|
||||
testWidget->show();
|
||||
|
||||
connect( testWidget, SIGNAL(clicked()), this, SLOT(onClicked()) );
|
||||
connect( testWidget, SIGNAL(pressed()), this, SLOT(onPressed()) );
|
||||
connect( testWidget, SIGNAL(released()), this, SLOT(onReleased()) );
|
||||
connect( testWidget, SIGNAL(toggled(bool)), this, SLOT(onToggled(bool)) );
|
||||
connect(testWidget, SIGNAL(clicked()), this, SLOT(onClicked()));
|
||||
connect(testWidget, SIGNAL(pressed()), this, SLOT(onPressed()));
|
||||
connect(testWidget, SIGNAL(released()), this, SLOT(onReleased()));
|
||||
connect(testWidget, SIGNAL(toggled(bool)), this, SLOT(onToggled(bool)));
|
||||
}
|
||||
|
||||
void tst_QPushButton::cleanupTestCase()
|
||||
{
|
||||
delete testWidget;
|
||||
testWidget = 0;
|
||||
testWidget = nullptr;
|
||||
}
|
||||
|
||||
void tst_QPushButton::init()
|
||||
{
|
||||
testWidget->setAutoRepeat( false );
|
||||
testWidget->setDown( false );
|
||||
testWidget->setAutoRepeat(false);
|
||||
testWidget->setDown(false);
|
||||
testWidget->setText("Test");
|
||||
testWidget->setEnabled( true );
|
||||
testWidget->setEnabled(true);
|
||||
#if QT_CONFIG(shortcut)
|
||||
QKeySequence seq;
|
||||
testWidget->setShortcut( seq );
|
||||
testWidget->setShortcut(seq);
|
||||
#endif
|
||||
|
||||
resetCounters();
|
||||
@ -134,7 +133,7 @@ void tst_QPushButton::onClicked()
|
||||
click_count++;
|
||||
}
|
||||
|
||||
void tst_QPushButton::onToggled( bool /*on*/ )
|
||||
void tst_QPushButton::onToggled(bool /*on*/)
|
||||
{
|
||||
toggle_count++;
|
||||
}
|
||||
@ -152,46 +151,46 @@ void tst_QPushButton::onReleased()
|
||||
void tst_QPushButton::autoRepeat()
|
||||
{
|
||||
// If this changes, this test must be completely revised.
|
||||
QVERIFY( !testWidget->isCheckable() );
|
||||
QVERIFY(!testWidget->isCheckable());
|
||||
|
||||
// verify autorepeat is off by default.
|
||||
QPushButton tmp( 0 );
|
||||
QPushButton tmp;
|
||||
tmp.setObjectName("tmp");
|
||||
QVERIFY( !tmp.autoRepeat() );
|
||||
QVERIFY(!tmp.autoRepeat());
|
||||
|
||||
// check if we can toggle the mode
|
||||
testWidget->setAutoRepeat( true );
|
||||
QVERIFY( testWidget->autoRepeat() );
|
||||
testWidget->setAutoRepeat(true);
|
||||
QVERIFY(testWidget->autoRepeat());
|
||||
|
||||
testWidget->setAutoRepeat( false );
|
||||
QVERIFY( !testWidget->autoRepeat() );
|
||||
testWidget->setAutoRepeat(false);
|
||||
QVERIFY(!testWidget->autoRepeat());
|
||||
|
||||
resetCounters();
|
||||
|
||||
// check that the button is down if we press space and not in autorepeat
|
||||
testWidget->setDown( false );
|
||||
testWidget->setAutoRepeat( false );
|
||||
QTest::keyPress( testWidget, Qt::Key_Space );
|
||||
testWidget->setDown(false);
|
||||
testWidget->setAutoRepeat(false);
|
||||
QTest::keyPress(testWidget, Qt::Key_Space);
|
||||
|
||||
QTRY_VERIFY( testWidget->isDown() );
|
||||
QVERIFY( toggle_count == 0 );
|
||||
QVERIFY( press_count == 1 );
|
||||
QVERIFY( release_count == 0 );
|
||||
QVERIFY( click_count == 0 );
|
||||
QTRY_VERIFY(testWidget->isDown());
|
||||
QCOMPARE(toggle_count, 0);
|
||||
QCOMPARE(press_count, 1);
|
||||
QCOMPARE(release_count, 0);
|
||||
QCOMPARE(click_count, 0);
|
||||
|
||||
QTest::keyRelease( testWidget, Qt::Key_Space );
|
||||
QTest::keyRelease(testWidget, Qt::Key_Space);
|
||||
resetCounters();
|
||||
|
||||
// check that the button is down if we press space while in autorepeat
|
||||
// we can't actually confirm how many times it is fired, more than 1 is enough.
|
||||
|
||||
testWidget->setDown( false );
|
||||
testWidget->setAutoRepeat( true );
|
||||
QTest::keyPress( testWidget, Qt::Key_Space );
|
||||
testWidget->setDown(false);
|
||||
testWidget->setAutoRepeat(true);
|
||||
QTest::keyPress(testWidget, Qt::Key_Space);
|
||||
QTRY_VERIFY(press_count > 3);
|
||||
QVERIFY( testWidget->isDown() );
|
||||
QVERIFY( toggle_count == 0 );
|
||||
QTest::keyRelease( testWidget, Qt::Key_Space );
|
||||
QVERIFY(testWidget->isDown());
|
||||
QCOMPARE(toggle_count, 0);
|
||||
QTest::keyRelease(testWidget, Qt::Key_Space);
|
||||
QCOMPARE(press_count, release_count);
|
||||
QCOMPARE(release_count, click_count);
|
||||
|
||||
@ -199,7 +198,7 @@ void tst_QPushButton::autoRepeat()
|
||||
|
||||
// check that pressing ENTER has no effect
|
||||
resetCounters();
|
||||
testWidget->setDown( false );
|
||||
testWidget->setDown(false);
|
||||
// Skip after reset if ButtonPressKeys has Key_Enter
|
||||
const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
|
||||
->themeHint(QPlatformTheme::ButtonPressKeys)
|
||||
@ -207,40 +206,40 @@ void tst_QPushButton::autoRepeat()
|
||||
if (buttonPressKeys.contains(Qt::Key_Enter)) {
|
||||
return;
|
||||
}
|
||||
testWidget->setAutoRepeat( false );
|
||||
QTest::keyPress( testWidget, Qt::Key_Enter );
|
||||
testWidget->setAutoRepeat(false);
|
||||
QTest::keyPress(testWidget, Qt::Key_Enter);
|
||||
|
||||
QTest::qWait( 300 );
|
||||
QTest::qWait(300);
|
||||
|
||||
QVERIFY( !testWidget->isDown() );
|
||||
QVERIFY( toggle_count == 0 );
|
||||
QVERIFY( press_count == 0 );
|
||||
QVERIFY( release_count == 0 );
|
||||
QVERIFY( click_count == 0 );
|
||||
QTest::keyRelease( testWidget, Qt::Key_Enter );
|
||||
QVERIFY(!testWidget->isDown());
|
||||
QCOMPARE(toggle_count, 0);
|
||||
QCOMPARE(press_count, 0);
|
||||
QCOMPARE(release_count, 0);
|
||||
QCOMPARE(click_count, 0);
|
||||
QTest::keyRelease(testWidget, Qt::Key_Enter);
|
||||
|
||||
// check that pressing ENTER has no effect
|
||||
resetCounters();
|
||||
testWidget->setDown( false );
|
||||
testWidget->setAutoRepeat( true );
|
||||
QTest::keyClick( testWidget, Qt::Key_Enter );
|
||||
QTest::qWait( 300 );
|
||||
QVERIFY( !testWidget->isDown() );
|
||||
QVERIFY( toggle_count == 0 );
|
||||
QVERIFY( press_count == 0 );
|
||||
QVERIFY( release_count == 0 );
|
||||
QVERIFY( click_count == 0 );
|
||||
testWidget->setDown(false);
|
||||
testWidget->setAutoRepeat(true);
|
||||
QTest::keyClick(testWidget, Qt::Key_Enter);
|
||||
QTest::qWait(300);
|
||||
QVERIFY(!testWidget->isDown());
|
||||
QCOMPARE(toggle_count, 0);
|
||||
QCOMPARE(press_count, 0);
|
||||
QCOMPARE(release_count, 0);
|
||||
QCOMPARE(click_count, 0);
|
||||
}
|
||||
|
||||
void tst_QPushButton::pressed()
|
||||
{
|
||||
QTest::keyPress( testWidget, ' ' );
|
||||
QCOMPARE( press_count, (uint)1 );
|
||||
QCOMPARE( release_count, (uint)0 );
|
||||
QTest::keyPress(testWidget, ' ');
|
||||
QCOMPARE(press_count, 1);
|
||||
QCOMPARE(release_count, 0);
|
||||
|
||||
QTest::keyRelease( testWidget, ' ' );
|
||||
QCOMPARE( press_count, (uint)1 );
|
||||
QCOMPARE( release_count, (uint)1 );
|
||||
QTest::keyRelease(testWidget, ' ');
|
||||
QCOMPARE(press_count, 1);
|
||||
QCOMPARE(release_count, 1);
|
||||
|
||||
// Skip if ButtonPressKeys has Key_Enter
|
||||
const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
|
||||
@ -250,77 +249,77 @@ void tst_QPushButton::pressed()
|
||||
return;
|
||||
}
|
||||
|
||||
QTest::keyPress( testWidget,Qt::Key_Enter );
|
||||
QCOMPARE( press_count, (uint)1 );
|
||||
QCOMPARE( release_count, (uint)1 );
|
||||
QTest::keyPress(testWidget,Qt::Key_Enter);
|
||||
QCOMPARE(press_count, 1);
|
||||
QCOMPARE(release_count, 1);
|
||||
|
||||
testWidget->setAutoDefault(true);
|
||||
QTest::keyPress( testWidget,Qt::Key_Enter );
|
||||
QCOMPARE( press_count, (uint)2 );
|
||||
QCOMPARE( release_count, (uint)2 );
|
||||
QTest::keyPress(testWidget,Qt::Key_Enter);
|
||||
QCOMPARE(press_count, 2);
|
||||
QCOMPARE(release_count, 2);
|
||||
testWidget->setAutoDefault(false);
|
||||
|
||||
}
|
||||
|
||||
void tst_QPushButton::isCheckable()
|
||||
{
|
||||
QVERIFY( !testWidget->isCheckable() );
|
||||
QVERIFY(!testWidget->isCheckable());
|
||||
}
|
||||
|
||||
void tst_QPushButton::setDown()
|
||||
{
|
||||
testWidget->setDown( false );
|
||||
QVERIFY( !testWidget->isDown() );
|
||||
testWidget->setDown(false);
|
||||
QVERIFY(!testWidget->isDown());
|
||||
|
||||
testWidget->setDown( true );
|
||||
QVERIFY( testWidget->isDown() );
|
||||
testWidget->setDown(true);
|
||||
QVERIFY(testWidget->isDown());
|
||||
|
||||
testWidget->setDown( true );
|
||||
QTest::keyClick( testWidget, Qt::Key_Escape );
|
||||
QVERIFY( !testWidget->isDown() );
|
||||
testWidget->setDown(true);
|
||||
QTest::keyClick(testWidget, Qt::Key_Escape);
|
||||
QVERIFY(!testWidget->isDown());
|
||||
}
|
||||
|
||||
void tst_QPushButton::isChecked()
|
||||
{
|
||||
testWidget->setDown( false );
|
||||
QVERIFY( !testWidget->isChecked() );
|
||||
testWidget->setDown(false);
|
||||
QVERIFY(!testWidget->isChecked());
|
||||
|
||||
testWidget->setDown( true );
|
||||
QVERIFY( !testWidget->isChecked() );
|
||||
testWidget->setDown(true);
|
||||
QVERIFY(!testWidget->isChecked());
|
||||
|
||||
testWidget->setDown( false );
|
||||
testWidget->setDown(false);
|
||||
testWidget->toggle();
|
||||
QVERIFY( testWidget->isChecked() == testWidget->isCheckable() );
|
||||
QCOMPARE(testWidget->isChecked(), testWidget->isCheckable());
|
||||
}
|
||||
|
||||
void tst_QPushButton::toggle()
|
||||
{
|
||||
// the pushbutton shouldn't toggle the button.
|
||||
testWidget->toggle();
|
||||
QVERIFY( testWidget->isChecked() == false );
|
||||
QCOMPARE(testWidget->isChecked(), false);
|
||||
}
|
||||
|
||||
void tst_QPushButton::toggled()
|
||||
{
|
||||
// the pushbutton shouldn't send a toggled signal when we call the toggle slot.
|
||||
QVERIFY( !testWidget->isCheckable() );
|
||||
QVERIFY(!testWidget->isCheckable());
|
||||
|
||||
testWidget->toggle();
|
||||
QVERIFY( toggle_count == 0 );
|
||||
QCOMPARE(toggle_count, 0);
|
||||
|
||||
// do it again, just to be sure
|
||||
resetCounters();
|
||||
testWidget->toggle();
|
||||
QVERIFY( toggle_count == 0 );
|
||||
QCOMPARE(toggle_count, 0);
|
||||
|
||||
// finally check that we can toggle using the mouse
|
||||
resetCounters();
|
||||
QTest::mousePress( testWidget, Qt::LeftButton );
|
||||
QVERIFY( toggle_count == 0 );
|
||||
QVERIFY( click_count == 0 );
|
||||
QTest::mousePress(testWidget, Qt::LeftButton);
|
||||
QCOMPARE(toggle_count, 0);
|
||||
QCOMPARE(click_count, 0);
|
||||
|
||||
QTest::mouseRelease( testWidget, Qt::LeftButton );
|
||||
QVERIFY( click_count == 1 );
|
||||
QTest::mouseRelease(testWidget, Qt::LeftButton);
|
||||
QCOMPARE(click_count, 1);
|
||||
}
|
||||
|
||||
#if QT_CONFIG(shortcut)
|
||||
@ -333,56 +332,56 @@ void tst_QPushButton::toggled()
|
||||
void tst_QPushButton::setAccel()
|
||||
{
|
||||
testWidget->setText("&AccelTest");
|
||||
QKeySequence seq( Qt::ALT | Qt::Key_A );
|
||||
testWidget->setShortcut( seq );
|
||||
QKeySequence seq(Qt::ALT | Qt::Key_A);
|
||||
testWidget->setShortcut(seq);
|
||||
|
||||
// The shortcut will not be activated unless the button is in a active
|
||||
// window and has focus
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
testWidget->setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(testWidget));
|
||||
QTest::keyClick( testWidget, 'A', Qt::AltModifier );
|
||||
QTRY_VERIFY( click_count == 1 );
|
||||
QVERIFY( press_count == 1 );
|
||||
QVERIFY( release_count == 1 );
|
||||
QVERIFY( toggle_count == 0 );
|
||||
QTest::keyClick(testWidget, 'A', Qt::AltModifier);
|
||||
QTRY_VERIFY(click_count == 1);
|
||||
QCOMPARE(press_count, 1);
|
||||
QCOMPARE(release_count, 1);
|
||||
QCOMPARE(toggle_count, 0);
|
||||
|
||||
// wait 200 ms because setAccel uses animateClick.
|
||||
// if we don't wait this may screw up a next test.
|
||||
QTest::qWait(200);
|
||||
QTRY_VERIFY( !testWidget->isDown() );
|
||||
QTRY_VERIFY(!testWidget->isDown());
|
||||
}
|
||||
|
||||
#endif // QT_CONFIG(shortcut)
|
||||
|
||||
void tst_QPushButton::clicked()
|
||||
{
|
||||
QTest::mousePress( testWidget, Qt::LeftButton );
|
||||
QVERIFY( press_count == 1 );
|
||||
QVERIFY( release_count == 0 );
|
||||
QTest::mousePress(testWidget, Qt::LeftButton);
|
||||
QCOMPARE(press_count, 1);
|
||||
QCOMPARE(release_count, 0);
|
||||
|
||||
QTest::mouseRelease( testWidget, Qt::LeftButton );
|
||||
QCOMPARE( press_count, (uint)1 );
|
||||
QCOMPARE( release_count, (uint)1 );
|
||||
QTest::mouseRelease(testWidget, Qt::LeftButton);
|
||||
QCOMPARE(press_count, 1);
|
||||
QCOMPARE(release_count, 1);
|
||||
|
||||
press_count = 0;
|
||||
release_count = 0;
|
||||
testWidget->setDown(false);
|
||||
for (uint i=0; i<10; i++)
|
||||
QTest::mouseClick( testWidget, Qt::LeftButton );
|
||||
QCOMPARE( press_count, (uint)10 );
|
||||
QCOMPARE( release_count, (uint)10 );
|
||||
QTest::mouseClick(testWidget, Qt::LeftButton);
|
||||
QCOMPARE(press_count, 10);
|
||||
QCOMPARE(release_count, 10);
|
||||
}
|
||||
|
||||
void tst_QPushButton::touchTap()
|
||||
{
|
||||
QTest::touchEvent(testWidget, m_touchScreen).press(0, QPoint(10, 10));
|
||||
QVERIFY( press_count == 1 );
|
||||
QVERIFY( release_count == 0 );
|
||||
QCOMPARE(press_count, 1);
|
||||
QCOMPARE(release_count, 0);
|
||||
QTest::touchEvent(testWidget, m_touchScreen).release(0, QPoint(10, 10));
|
||||
QCOMPARE( press_count, (uint)1 );
|
||||
QCOMPARE( release_count, (uint)1 );
|
||||
QCOMPARE( click_count, (uint)1 );
|
||||
QCOMPARE(press_count, 1);
|
||||
QCOMPARE(release_count, 1);
|
||||
QCOMPARE(click_count, 1);
|
||||
|
||||
press_count = 0;
|
||||
release_count = 0;
|
||||
@ -392,26 +391,23 @@ void tst_QPushButton::touchTap()
|
||||
QTest::touchEvent(testWidget, m_touchScreen).press(0, QPoint(10, 10));
|
||||
QTest::touchEvent(testWidget, m_touchScreen).release(0, QPoint(10, 10));
|
||||
}
|
||||
QCOMPARE( press_count, (uint)10 );
|
||||
QCOMPARE( release_count, (uint)10 );
|
||||
QCOMPARE( click_count, (uint)10 );
|
||||
}
|
||||
|
||||
QPushButton *pb = 0;
|
||||
void tst_QPushButton::helperSlotDelete()
|
||||
{
|
||||
delete pb;
|
||||
pb = 0;
|
||||
QCOMPARE(press_count, 10);
|
||||
QCOMPARE(release_count, 10);
|
||||
QCOMPARE(click_count, 10);
|
||||
}
|
||||
|
||||
void tst_QPushButton::popupCrash()
|
||||
{
|
||||
pb = new QPushButton("foo");
|
||||
QPushButton *pb = new QPushButton("foo");
|
||||
QMenu *menu = new QMenu("bar", pb);
|
||||
pb->setMenu(menu);
|
||||
QTimer::singleShot(1000, this, SLOT(helperSlotDelete()));
|
||||
QTimer::singleShot(1000, this, [&pb]{
|
||||
delete pb;
|
||||
pb = nullptr;
|
||||
});
|
||||
pb->show();
|
||||
pb->click();
|
||||
QTRY_COMPARE(pb, nullptr);
|
||||
}
|
||||
|
||||
void tst_QPushButton::defaultAndAutoDefault()
|
||||
@ -501,14 +497,14 @@ void tst_QPushButton::defaultAndAutoDefault()
|
||||
|
||||
// Reparenting
|
||||
QVERIFY(button2.autoDefault());
|
||||
button2.setParent(0);
|
||||
button2.setParent(nullptr);
|
||||
QVERIFY(!button2.autoDefault());
|
||||
button2.setAutoDefault(false);
|
||||
button2.setParent(&dialog);
|
||||
QVERIFY(!button2.autoDefault());
|
||||
|
||||
button1.setAutoDefault(true);
|
||||
button1.setParent(0);
|
||||
button1.setParent(nullptr);
|
||||
QVERIFY(button1.autoDefault());
|
||||
}
|
||||
}
|
||||
@ -549,7 +545,7 @@ void tst_QPushButton::sizeHint()
|
||||
button->setParent(widget);
|
||||
button->sizeHint();
|
||||
|
||||
widget->setParent(0);
|
||||
widget->setParent(nullptr);
|
||||
delete dialog;
|
||||
button->setDefault(false);
|
||||
QCOMPARE(button->sizeHint(), initSizeHint);
|
||||
|
Reference in New Issue
Block a user