QWizard: Account for missing background image on macOS 10.14+

We were loading “Background.png” from the KeyboardSetupAssistant
app bundle. As of macOS 10.14 that image is no longer
there.

Adjust auto tests and document the behavior.

Change-Id: Icb4dd73b3fa88927e87bb86db2bc9f7b4a8094f7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Johan Sørvig 2019-06-12 15:29:31 +02:00 committed by Tor Arne Vestbø
parent 3729695cc9
commit 9bcbba36c7
3 changed files with 13 additions and 11 deletions

View File

@ -177,6 +177,9 @@ void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine
QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard() QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard()
{ {
// Note: starting with macOS 10.14, the KeyboardSetupAssistant app bundle no
// longer contains the "Background.png" image. This function then returns a
// null pixmap.
const int ExpectedImageWidth = 242; const int ExpectedImageWidth = 242;
const int ExpectedImageHeight = 414; const int ExpectedImageHeight = 414;
QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier( QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier(

View File

@ -2890,7 +2890,7 @@ void QWizard::setPixmap(WizardPixmap which, const QPixmap &pixmap)
Returns the pixmap set for role \a which. Returns the pixmap set for role \a which.
By default, the only pixmap that is set is the BackgroundPixmap on By default, the only pixmap that is set is the BackgroundPixmap on
\macos. \macos version 10.13 and earlier.
\sa QWizardPage::pixmap(), {Elements of a Wizard Page} \sa QWizardPage::pixmap(), {Elements of a Wizard Page}
*/ */

View File

@ -417,20 +417,19 @@ void tst_QWizard::setPixmap()
QVERIFY(wizard.pixmap(QWizard::BannerPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::BannerPixmap).isNull());
QVERIFY(wizard.pixmap(QWizard::LogoPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::LogoPixmap).isNull());
QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).isNull());
#ifdef Q_OS_OSX if (QSysInfo::macVersion() <= Q_MV_OSX(10, 13))
QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull()); QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull());
#else else
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull());
#endif
QVERIFY(page->pixmap(QWizard::BannerPixmap).isNull()); QVERIFY(page->pixmap(QWizard::BannerPixmap).isNull());
QVERIFY(page->pixmap(QWizard::LogoPixmap).isNull()); QVERIFY(page->pixmap(QWizard::LogoPixmap).isNull());
QVERIFY(page->pixmap(QWizard::WatermarkPixmap).isNull()); QVERIFY(page->pixmap(QWizard::WatermarkPixmap).isNull());
#ifdef Q_OS_OSX if (QSysInfo::macVersion() <= Q_MV_OSX(10, 13))
QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull()); QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull());
#else else
QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull()); QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull());
#endif
wizard.setPixmap(QWizard::BannerPixmap, p1); wizard.setPixmap(QWizard::BannerPixmap, p1);
wizard.setPixmap(QWizard::LogoPixmap, p2); wizard.setPixmap(QWizard::LogoPixmap, p2);
wizard.setPixmap(QWizard::WatermarkPixmap, p3); wizard.setPixmap(QWizard::WatermarkPixmap, p3);