tests/auto/qwizard/tst_qwizard.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
   102     void showCurrentPageOnly();
   102     void showCurrentPageOnly();
   103     void setButtonText();
   103     void setButtonText();
   104     void setCommitPage();
   104     void setCommitPage();
   105     void setWizardStyle();
   105     void setWizardStyle();
   106     void removePage();
   106     void removePage();
       
   107     void sideWidget();
   107 
   108 
   108     // task-specific tests below me:
   109     // task-specific tests below me:
   109     void task161660_buttonSpacing();
   110     void task161660_buttonSpacing();
   110     void task177716_disableCommitButton();
   111     void task177716_disableCommitButton();
   111     void task183550_stretchFactor();
   112     void task183550_stretchFactor();
   567 {
   568 {
   568     QWidget *parent = new QWidget;
   569     QWidget *parent = new QWidget;
   569     QWizard wizard;
   570     QWizard wizard;
   570     const int N = 100;
   571     const int N = 100;
   571     QWizardPage *pages[N];
   572     QWizardPage *pages[N];
       
   573     QSignalSpy spy(&wizard, SIGNAL(pageAdded(int)));
   572 
   574 
   573     for (int i = 0; i < N; ++i) {
   575     for (int i = 0; i < N; ++i) {
   574         pages[i] = new QWizardPage(parent);
   576         pages[i] = new QWizardPage(parent);
   575         QCOMPARE(wizard.addPage(pages[i]), i);
   577         QCOMPARE(wizard.addPage(pages[i]), i);
   576         QCOMPARE(pages[i]->window(), (QWidget *)&wizard);
   578         QCOMPARE(pages[i]->window(), (QWidget *)&wizard);
   577         QCOMPARE(wizard.startId(), 0);
   579         QCOMPARE(wizard.startId(), 0);
       
   580         QCOMPARE(spy.count(), 1);
       
   581         QList<QVariant> arguments = spy.takeFirst();
       
   582         QCOMPARE(arguments.at(0).toInt(), i);
   578     }
   583     }
   579 
   584 
   580     for (int i = 0; i < N; ++i) {
   585     for (int i = 0; i < N; ++i) {
   581         QVERIFY(pages[i] == wizard.page(i));
   586         QVERIFY(pages[i] == wizard.page(i));
   582     }
   587     }
   583     QVERIFY(!wizard.page(-1));
   588     QVERIFY(!wizard.page(-1));
   584     QVERIFY(!wizard.page(N));
   589     QVERIFY(!wizard.page(N));
   585     QVERIFY(!wizard.page(N + 1));
   590     QVERIFY(!wizard.page(N + 1));
   586 
   591 
   587     wizard.setPage(N + 50, new QWizardPage);
   592     wizard.setPage(N + 50, new QWizardPage);
       
   593     QCOMPARE(spy.count(), 1);
       
   594     QList<QVariant> arguments = spy.takeFirst();
       
   595     QCOMPARE(arguments.at(0).toInt(), N + 50);
   588     wizard.setPage(-3000, new QWizardPage);
   596     wizard.setPage(-3000, new QWizardPage);
       
   597     QCOMPARE(spy.count(), 1);
       
   598     arguments = spy.takeFirst();
       
   599     QCOMPARE(arguments.at(0).toInt(), -3000);
   589 
   600 
   590     QWizardPage *pageX = new QWizardPage;
   601     QWizardPage *pageX = new QWizardPage;
   591     QCOMPARE(wizard.addPage(pageX), N + 51);
   602     QCOMPARE(wizard.addPage(pageX), N + 51);
   592     QCOMPARE(wizard.page(N + 51), pageX);
   603     QCOMPARE(wizard.page(N + 51), pageX);
       
   604     QCOMPARE(spy.count(), 1);
       
   605     arguments = spy.takeFirst();
       
   606     QCOMPARE(arguments.at(0).toInt(), N + 51);
   593 
   607 
   594     QCOMPARE(wizard.addPage(new QWizardPage), N + 52);
   608     QCOMPARE(wizard.addPage(new QWizardPage), N + 52);
       
   609     QCOMPARE(spy.count(), 1);
       
   610     arguments = spy.takeFirst();
       
   611     QCOMPARE(arguments.at(0).toInt(), N + 52);
   595 
   612 
   596     QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert null page");    
   613     QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert null page");    
   597     wizard.addPage(0); // generates a warning
   614     wizard.addPage(0); // generates a warning
       
   615     QCOMPARE(spy.count(), 0);
   598     delete parent;
   616     delete parent;
   599 }
   617 }
   600 
   618 
   601 #define CHECK_VISITED(wizard, list) \
   619 #define CHECK_VISITED(wizard, list) \
   602     do { \
   620     do { \
   609 void tst_QWizard::setPage()
   627 void tst_QWizard::setPage()
   610 {
   628 {
   611     QWidget *parent = new QWidget;
   629     QWidget *parent = new QWidget;
   612     QWizard wizard;
   630     QWizard wizard;
   613     QWizardPage *page;
   631     QWizardPage *page;
       
   632     QSignalSpy spy(&wizard, SIGNAL(pageAdded(int)));
   614 
   633 
   615     QCOMPARE(wizard.startId(), -1);
   634     QCOMPARE(wizard.startId(), -1);
   616     QCOMPARE(wizard.currentId(), -1);
   635     QCOMPARE(wizard.currentId(), -1);
   617     QVERIFY(!wizard.currentPage());
   636     QVERIFY(!wizard.currentPage());
   618     QCOMPARE(wizard.nextId(), -1);
   637     QCOMPARE(wizard.nextId(), -1);
   619 
   638 
   620     page = new QWizardPage(parent);
   639     page = new QWizardPage(parent);
   621     QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert page with ID -1");    
   640     QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert page with ID -1");    
   622     wizard.setPage(-1, page);   // gives a warning and does nothing
   641     wizard.setPage(-1, page);   // gives a warning and does nothing
       
   642     QCOMPARE(spy.count(), 0);
   623     QVERIFY(!wizard.page(-2));
   643     QVERIFY(!wizard.page(-2));
   624     QVERIFY(!wizard.page(-1));
   644     QVERIFY(!wizard.page(-1));
   625     QVERIFY(!wizard.page(0));
   645     QVERIFY(!wizard.page(0));
   626     QCOMPARE(wizard.startId(), -1);
   646     QCOMPARE(wizard.startId(), -1);
   627     QCOMPARE(wizard.currentId(), -1);
   647     QCOMPARE(wizard.currentId(), -1);
   629     QCOMPARE(wizard.nextId(), -1);
   649     QCOMPARE(wizard.nextId(), -1);
   630     CHECK_VISITED(wizard, QList<int>());
   650     CHECK_VISITED(wizard, QList<int>());
   631 
   651 
   632     page = new QWizardPage(parent);
   652     page = new QWizardPage(parent);
   633     wizard.setPage(0, page);
   653     wizard.setPage(0, page);
       
   654     QCOMPARE(spy.count(), 1);
       
   655     QList<QVariant> arguments = spy.takeFirst();
       
   656     QCOMPARE(arguments.at(0).toInt(), 0);
   634     QCOMPARE(page->window(), (QWidget *)&wizard);
   657     QCOMPARE(page->window(), (QWidget *)&wizard);
   635     QCOMPARE(wizard.page(0), page);
   658     QCOMPARE(wizard.page(0), page);
   636     QCOMPARE(wizard.startId(), 0);
   659     QCOMPARE(wizard.startId(), 0);
   637     QCOMPARE(wizard.currentId(), -1);
   660     QCOMPARE(wizard.currentId(), -1);
   638     QVERIFY(!wizard.currentPage());
   661     QVERIFY(!wizard.currentPage());
   639     QCOMPARE(wizard.nextId(), -1);
   662     QCOMPARE(wizard.nextId(), -1);
   640     CHECK_VISITED(wizard, QList<int>());
   663     CHECK_VISITED(wizard, QList<int>());
   641 
   664 
   642     page = new QWizardPage(parent);
   665     page = new QWizardPage(parent);
   643     wizard.setPage(-2, page);
   666     wizard.setPage(-2, page);
       
   667     QCOMPARE(spy.count(), 1);
       
   668     arguments = spy.takeFirst();
       
   669     QCOMPARE(arguments.at(0).toInt(), -2);
   644     QCOMPARE(page->window(), (QWidget *)&wizard);
   670     QCOMPARE(page->window(), (QWidget *)&wizard);
   645     QCOMPARE(wizard.page(-2), page);
   671     QCOMPARE(wizard.page(-2), page);
   646     QCOMPARE(wizard.startId(), -2);
   672     QCOMPARE(wizard.startId(), -2);
   647     QCOMPARE(wizard.currentId(), -1);
   673     QCOMPARE(wizard.currentId(), -1);
   648     QVERIFY(!wizard.currentPage());
   674     QVERIFY(!wizard.currentPage());
   657     QCOMPARE(wizard.nextId(), 0);
   683     QCOMPARE(wizard.nextId(), 0);
   658     CHECK_VISITED(wizard, QList<int>() << -2);
   684     CHECK_VISITED(wizard, QList<int>() << -2);
   659 
   685 
   660     page = new QWizardPage(parent);
   686     page = new QWizardPage(parent);
   661     wizard.setPage(2, page);
   687     wizard.setPage(2, page);
       
   688     QCOMPARE(spy.count(), 1);
       
   689     arguments = spy.takeFirst();
       
   690     QCOMPARE(arguments.at(0).toInt(), 2);
   662     QCOMPARE(wizard.page(2), page);
   691     QCOMPARE(wizard.page(2), page);
   663     QCOMPARE(wizard.startId(), -2);
   692     QCOMPARE(wizard.startId(), -2);
   664     QCOMPARE(wizard.currentId(), -2);
   693     QCOMPARE(wizard.currentId(), -2);
   665     QVERIFY(wizard.currentPage() == wizard.page(-2));
   694     QVERIFY(wizard.currentPage() == wizard.page(-2));
   666     QCOMPARE(wizard.nextId(), 0);
   695     QCOMPARE(wizard.nextId(), 0);
   673     QCOMPARE(wizard.nextId(), 0);
   702     QCOMPARE(wizard.nextId(), 0);
   674     CHECK_VISITED(wizard, QList<int>() << -2);
   703     CHECK_VISITED(wizard, QList<int>() << -2);
   675 
   704 
   676     page = new QWizardPage(parent);
   705     page = new QWizardPage(parent);
   677     wizard.setPage(-3, page);
   706     wizard.setPage(-3, page);
       
   707     QCOMPARE(spy.count(), 1);
       
   708     arguments = spy.takeFirst();
       
   709     QCOMPARE(arguments.at(0).toInt(), -3);
   678     QCOMPARE(wizard.page(-3), page);
   710     QCOMPARE(wizard.page(-3), page);
   679     QCOMPARE(wizard.startId(), -3);
   711     QCOMPARE(wizard.startId(), -3);
   680     QCOMPARE(wizard.currentId(), -2);
   712     QCOMPARE(wizard.currentId(), -2);
   681     QVERIFY(wizard.currentPage() == wizard.page(-2));
   713     QVERIFY(wizard.currentPage() == wizard.page(-2));
   682     QCOMPARE(wizard.nextId(), 0);
   714     QCOMPARE(wizard.nextId(), 0);
   741         QCOMPARE(wizard.currentId(), -3);
   773         QCOMPARE(wizard.currentId(), -3);
   742         QVERIFY(wizard.currentPage() == wizard.page(-3));
   774         QVERIFY(wizard.currentPage() == wizard.page(-3));
   743         QCOMPARE(wizard.nextId(), -2);
   775         QCOMPARE(wizard.nextId(), -2);
   744         CHECK_VISITED(wizard, QList<int>() << -3);
   776         CHECK_VISITED(wizard, QList<int>() << -3);
   745     }
   777     }
       
   778     QCOMPARE(spy.count(), 0);
   746     delete parent;
   779     delete parent;
   747 }
   780 }
   748 
   781 
   749 void tst_QWizard::setStartId()
   782 void tst_QWizard::setStartId()
   750 {
   783 {
   764     QCOMPARE(wizard.startId(), INT_MIN);
   797     QCOMPARE(wizard.startId(), INT_MIN);
   765 
   798 
   766     wizard.setPage(INT_MAX, new QWizardPage);
   799     wizard.setPage(INT_MAX, new QWizardPage);
   767     QCOMPARE(wizard.startId(), INT_MIN);
   800     QCOMPARE(wizard.startId(), INT_MIN);
   768 
   801 
   769     QTest::ignoreMessage(QtWarningMsg,"QWizard::setStartId: Invalid page ID -1");    
   802     QTest::ignoreMessage(QtWarningMsg,"QWizard::setStartId: Invalid page ID 123");
       
   803     wizard.setStartId(123);
       
   804     QCOMPARE(wizard.startId(), INT_MIN);
       
   805 
       
   806     wizard.setStartId(-1);
       
   807     QCOMPARE(wizard.startId(), INT_MIN);
       
   808 
       
   809     wizard.setStartId(-2);
       
   810     QCOMPARE(wizard.startId(), -2);
       
   811     QCOMPARE(wizard.nextId(), -1);
       
   812 
   770     wizard.setStartId(-1);
   813     wizard.setStartId(-1);
   771     QCOMPARE(wizard.startId(), INT_MIN);
   814     QCOMPARE(wizard.startId(), INT_MIN);
   772 
   815 
   773     wizard.setStartId(-2);
   816     wizard.setStartId(-2);
   774     QCOMPARE(wizard.startId(), -2);
   817     QCOMPARE(wizard.startId(), -2);
  2207     QWizard wizard;
  2250     QWizard wizard;
  2208     QWizardPage *page0 = new QWizardPage;
  2251     QWizardPage *page0 = new QWizardPage;
  2209     QWizardPage *page1 = new QWizardPage;
  2252     QWizardPage *page1 = new QWizardPage;
  2210     QWizardPage *page2 = new QWizardPage;
  2253     QWizardPage *page2 = new QWizardPage;
  2211     QWizardPage *page3 = new QWizardPage;
  2254     QWizardPage *page3 = new QWizardPage;
       
  2255     QSignalSpy spy(&wizard, SIGNAL(pageRemoved(int)));
  2212 
  2256 
  2213     wizard.setPage(0, page0);
  2257     wizard.setPage(0, page0);
  2214     wizard.setPage(1, page1);
  2258     wizard.setPage(1, page1);
  2215     wizard.setPage(2, page2);
  2259     wizard.setPage(2, page2);
  2216     wizard.setPage(3, page3);
  2260     wizard.setPage(3, page3);
  2217 
  2261 
  2218     wizard.restart();
  2262     wizard.restart();
  2219     QCOMPARE(wizard.pageIds().size(), 4);
  2263     QCOMPARE(wizard.pageIds().size(), 4);
  2220     QCOMPARE(wizard.visitedPages().size(), 1);
  2264     QCOMPARE(wizard.visitedPages().size(), 1);
       
  2265     QCOMPARE(spy.count(), 0);
  2221 
  2266 
  2222     // Removing a non-existent page
  2267     // Removing a non-existent page
  2223     wizard.removePage(4);
  2268     wizard.removePage(4);
  2224     QCOMPARE(wizard.pageIds().size(), 4);
  2269     QCOMPARE(wizard.pageIds().size(), 4);
       
  2270     QCOMPARE(spy.count(), 0);
  2225 
  2271 
  2226     // Removing and then reinserting a page
  2272     // Removing and then reinserting a page
  2227     QCOMPARE(wizard.pageIds().size(), 4);
  2273     QCOMPARE(wizard.pageIds().size(), 4);
  2228     QVERIFY(wizard.pageIds().contains(2));
  2274     QVERIFY(wizard.pageIds().contains(2));
  2229     wizard.removePage(2);
  2275     wizard.removePage(2);
       
  2276     QCOMPARE(spy.count(), 1);
       
  2277     QList<QVariant> arguments = spy.takeFirst();
       
  2278     QCOMPARE(arguments.at(0).toInt(), 2);
  2230     QCOMPARE(wizard.pageIds().size(), 3);
  2279     QCOMPARE(wizard.pageIds().size(), 3);
  2231     QVERIFY(!wizard.pageIds().contains(2));
  2280     QVERIFY(!wizard.pageIds().contains(2));
  2232     wizard.setPage(2, page2);
  2281     wizard.setPage(2, page2);
       
  2282     QCOMPARE(spy.count(), 0);
  2233     QCOMPARE(wizard.pageIds().size(), 4);
  2283     QCOMPARE(wizard.pageIds().size(), 4);
  2234     QVERIFY(wizard.pageIds().contains(2));
  2284     QVERIFY(wizard.pageIds().contains(2));
  2235 
  2285 
  2236     // Removing the same page twice
  2286     // Removing the same page twice
  2237     wizard.removePage(2); // restore
  2287     wizard.removePage(2); // restore
       
  2288     QCOMPARE(spy.count(), 1);
       
  2289     arguments = spy.takeFirst();
       
  2290     QCOMPARE(arguments.at(0).toInt(), 2);
  2238     QCOMPARE(wizard.pageIds().size(), 3);
  2291     QCOMPARE(wizard.pageIds().size(), 3);
  2239     QVERIFY(!wizard.pageIds().contains(2));
  2292     QVERIFY(!wizard.pageIds().contains(2));
  2240     wizard.removePage(2);
  2293     wizard.removePage(2);
       
  2294     QCOMPARE(spy.count(), 0);
  2241     QCOMPARE(wizard.pageIds().size(), 3);
  2295     QCOMPARE(wizard.pageIds().size(), 3);
  2242     QVERIFY(!wizard.pageIds().contains(2));
  2296     QVERIFY(!wizard.pageIds().contains(2));
  2243 
  2297 
  2244     // Removing a page not in the history
  2298     // Removing a page not in the history
  2245     wizard.setPage(2, page2); // restore
  2299     wizard.setPage(2, page2); // restore
  2246     wizard.restart();
  2300     wizard.restart();
  2247     wizard.next();
  2301     wizard.next();
  2248     QCOMPARE(wizard.visitedPages().size(), 2);
  2302     QCOMPARE(wizard.visitedPages().size(), 2);
  2249     QCOMPARE(wizard.currentPage(), page1);
  2303     QCOMPARE(wizard.currentPage(), page1);
       
  2304     QCOMPARE(spy.count(), 0);
  2250     wizard.removePage(2);
  2305     wizard.removePage(2);
       
  2306     QCOMPARE(spy.count(), 1);
       
  2307     arguments = spy.takeFirst();
       
  2308     QCOMPARE(arguments.at(0).toInt(), 2);
  2251     QCOMPARE(wizard.visitedPages().size(), 2);
  2309     QCOMPARE(wizard.visitedPages().size(), 2);
  2252     QVERIFY(!wizard.pageIds().contains(2));
  2310     QVERIFY(!wizard.pageIds().contains(2));
  2253     QCOMPARE(wizard.currentPage(), page1);
  2311     QCOMPARE(wizard.currentPage(), page1);
  2254 
  2312 
  2255     // Removing a page in the history before the current page
  2313     // Removing a page in the history before the current page
  2256     wizard.setPage(2, page2); // restore
  2314     wizard.setPage(2, page2); // restore
  2257     wizard.restart();
  2315     wizard.restart();
  2258     wizard.next();
  2316     wizard.next();
       
  2317     QCOMPARE(spy.count(), 0);
  2259     QCOMPARE(wizard.visitedPages().size(), 2);
  2318     QCOMPARE(wizard.visitedPages().size(), 2);
  2260     QCOMPARE(wizard.currentPage(), page1);
  2319     QCOMPARE(wizard.currentPage(), page1);
  2261     wizard.removePage(0);
  2320     wizard.removePage(0);
       
  2321     QCOMPARE(spy.count(), 1);
       
  2322     arguments = spy.takeFirst();
       
  2323     QCOMPARE(arguments.at(0).toInt(), 0);
  2262     QCOMPARE(wizard.visitedPages().size(), 1);
  2324     QCOMPARE(wizard.visitedPages().size(), 1);
  2263     QVERIFY(!wizard.visitedPages().contains(0));
  2325     QVERIFY(!wizard.visitedPages().contains(0));
  2264     QVERIFY(!wizard.pageIds().contains(0));
  2326     QVERIFY(!wizard.pageIds().contains(0));
  2265     QCOMPARE(wizard.currentPage(), page1);
  2327     QCOMPARE(wizard.currentPage(), page1);
  2266 
  2328 
  2267     // Remove the current page which is not the first one in the history
  2329     // Remove the current page which is not the first one in the history
  2268     wizard.setPage(0, page0); // restore
  2330     wizard.setPage(0, page0); // restore
  2269     wizard.restart();
  2331     wizard.restart();
  2270     wizard.next();
  2332     wizard.next();
       
  2333     QCOMPARE(spy.count(), 0);
  2271     QCOMPARE(wizard.visitedPages().size(), 2);
  2334     QCOMPARE(wizard.visitedPages().size(), 2);
  2272     QCOMPARE(wizard.currentPage(), page1);
  2335     QCOMPARE(wizard.currentPage(), page1);
  2273     wizard.removePage(1);
  2336     wizard.removePage(1);
       
  2337     QCOMPARE(spy.count(), 1);
       
  2338     arguments = spy.takeFirst();
       
  2339     QCOMPARE(arguments.at(0).toInt(), 1);
  2274     QCOMPARE(wizard.visitedPages().size(), 1);
  2340     QCOMPARE(wizard.visitedPages().size(), 1);
  2275     QVERIFY(!wizard.visitedPages().contains(1));
  2341     QVERIFY(!wizard.visitedPages().contains(1));
  2276     QVERIFY(!wizard.pageIds().contains(1));
  2342     QVERIFY(!wizard.pageIds().contains(1));
  2277     QCOMPARE(wizard.currentPage(), page0);
  2343     QCOMPARE(wizard.currentPage(), page0);
  2278 
  2344 
  2279     // Remove the current page which is the first (and only) one in the history
  2345     // Remove the current page which is the first (and only) one in the history
  2280     wizard.removePage(0);
  2346     wizard.removePage(0);
       
  2347     QCOMPARE(spy.count(), 1);
       
  2348     arguments = spy.takeFirst();
       
  2349     QCOMPARE(arguments.at(0).toInt(), 0);
  2281     QCOMPARE(wizard.visitedPages().size(), 1);
  2350     QCOMPARE(wizard.visitedPages().size(), 1);
  2282     QVERIFY(!wizard.visitedPages().contains(0));
  2351     QVERIFY(!wizard.visitedPages().contains(0));
  2283     QCOMPARE(wizard.pageIds().size(), 2);
  2352     QCOMPARE(wizard.pageIds().size(), 2);
  2284     QVERIFY(!wizard.pageIds().contains(0));
  2353     QVERIFY(!wizard.pageIds().contains(0));
  2285     QCOMPARE(wizard.currentPage(), page2);
  2354     QCOMPARE(wizard.currentPage(), page2);
  2286     //
  2355     //
  2287     wizard.removePage(2);
  2356     wizard.removePage(2);
       
  2357     QCOMPARE(spy.count(), 1);
       
  2358     arguments = spy.takeFirst();
       
  2359     QCOMPARE(arguments.at(0).toInt(), 2);
  2288     QCOMPARE(wizard.visitedPages().size(), 1);
  2360     QCOMPARE(wizard.visitedPages().size(), 1);
  2289     QVERIFY(!wizard.visitedPages().contains(2));
  2361     QVERIFY(!wizard.visitedPages().contains(2));
  2290     QCOMPARE(wizard.pageIds().size(), 1);
  2362     QCOMPARE(wizard.pageIds().size(), 1);
  2291     QVERIFY(!wizard.pageIds().contains(2));
  2363     QVERIFY(!wizard.pageIds().contains(2));
  2292     QCOMPARE(wizard.currentPage(), page3);
  2364     QCOMPARE(wizard.currentPage(), page3);
  2293     //
  2365     //
  2294     wizard.removePage(3);
  2366     wizard.removePage(3);
       
  2367     QCOMPARE(spy.count(), 1);
       
  2368     arguments = spy.takeFirst();
       
  2369     QCOMPARE(arguments.at(0).toInt(), 3);
  2295     QVERIFY(wizard.visitedPages().empty());
  2370     QVERIFY(wizard.visitedPages().empty());
  2296     QVERIFY(wizard.pageIds().empty());
  2371     QVERIFY(wizard.pageIds().empty());
  2297     QCOMPARE(wizard.currentPage(), static_cast<QWizardPage *>(0));
  2372     QCOMPARE(wizard.currentPage(), static_cast<QWizardPage *>(0));
       
  2373 }
       
  2374 
       
  2375 void tst_QWizard::sideWidget()
       
  2376 {
       
  2377     QWizard wizard;
       
  2378 
       
  2379     wizard.setSideWidget(0);
       
  2380     QVERIFY(wizard.sideWidget() == 0);
       
  2381     QWidget *w1 = new QWidget(&wizard);
       
  2382     wizard.setSideWidget(w1);
       
  2383     QVERIFY(wizard.sideWidget() == w1);
       
  2384     QWidget *w2 = new QWidget(&wizard);
       
  2385     wizard.setSideWidget(w2);
       
  2386     QVERIFY(wizard.sideWidget() == w2);
       
  2387     QVERIFY(w1->parent() != 0);
       
  2388     QCOMPARE(w1->window(), static_cast<QWidget *>(&wizard));
       
  2389     QCOMPARE(w2->window(), static_cast<QWidget *>(&wizard));
       
  2390     w1->setParent(0);
       
  2391     wizard.setSideWidget(0);
       
  2392     QVERIFY(wizard.sideWidget() == 0);
  2298 }
  2393 }
  2299 
  2394 
  2300 void tst_QWizard::task161660_buttonSpacing()
  2395 void tst_QWizard::task161660_buttonSpacing()
  2301 {
  2396 {
  2302 #ifndef QT_NO_STYLE_PLASTIQUE
  2397 #ifndef QT_NO_STYLE_PLASTIQUE