mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-02 23:35:28 +08:00
6.5.3 clean
This commit is contained in:
@ -24,6 +24,8 @@ private slots:
|
||||
void getSetCheck();
|
||||
void setMinMax();
|
||||
void setFromTo();
|
||||
|
||||
void hideNativeByDestruction();
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -135,6 +137,37 @@ void tst_QAbstractPrintDialog::setFromTo()
|
||||
QCOMPARE(obj1.maxPage(), 50);
|
||||
}
|
||||
|
||||
void tst_QAbstractPrintDialog::hideNativeByDestruction()
|
||||
{
|
||||
#ifdef Q_OS_WINDOWS
|
||||
QSKIP("This test fails on windows, the QPrintDialog::setVisible implementation blocks");
|
||||
#endif
|
||||
|
||||
QWidget window;
|
||||
QWidget *child = new QWidget(&window);
|
||||
QPointer<QPrintDialog> dialog = new QPrintDialog(child);
|
||||
// Make it application modal so that we don't end up with a sheet on macOS
|
||||
dialog->setWindowModality(Qt::ApplicationModal);
|
||||
window.show();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
dialog->open();
|
||||
|
||||
// We test that the dialog opens and closes by watching the activation of the
|
||||
// transient parent window. If it doesn't deactivate, then we have to skip.
|
||||
const auto windowActive = [&window]{ return window.isActiveWindow(); };
|
||||
const auto windowInactive = [&window]{ return !window.isActiveWindow(); };
|
||||
if (!QTest::qWaitFor(windowInactive, 2000))
|
||||
QSKIP("Dialog didn't activate");
|
||||
|
||||
// This should destroy the dialog and close the native window
|
||||
child->deleteLater();
|
||||
QTRY_VERIFY(!dialog);
|
||||
// If the native window is still open, then the transient parent can't become
|
||||
// active
|
||||
window.activateWindow();
|
||||
QVERIFY(QTest::qWaitFor(windowActive));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QAbstractPrintDialog)
|
||||
|
@ -336,11 +336,11 @@ void tst_QPrinterInfo::testAssignment()
|
||||
|
||||
void tst_QPrinterInfo::namedPrinter()
|
||||
{
|
||||
QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters();
|
||||
const QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters();
|
||||
|
||||
QStringList printerNames;
|
||||
|
||||
foreach (const QPrinterInfo &pi, printers) {
|
||||
for (const QPrinterInfo &pi : printers) {
|
||||
QPrinterInfo pi2 = QPrinterInfo::printerInfo(pi.printerName());
|
||||
QCOMPARE(pi2.printerName(), pi.printerName());
|
||||
QCOMPARE(pi2.description(), pi.description());
|
||||
|
Reference in New Issue
Block a user