tests/auto/qwidget/tst_qwidget.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 5 d3bac044e0f0
equal deleted inserted replaced
3:41300fa6a67c 4:3b1da2848fc7
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the test suite of the Qt Toolkit.
     7 ** This file is part of the test suite of the Qt Toolkit.
     8 **
     8 **
    64 #include <qdesktopwidget.h>
    64 #include <qdesktopwidget.h>
    65 #include <private/qwidget_p.h>
    65 #include <private/qwidget_p.h>
    66 #include <private/qapplication_p.h>
    66 #include <private/qapplication_p.h>
    67 #include <qcalendarwidget.h>
    67 #include <qcalendarwidget.h>
    68 #include <qmainwindow.h>
    68 #include <qmainwindow.h>
       
    69 #include <qdockwidget.h>
       
    70 #include <qtoolbar.h>
    69 #include <QtGui/qpaintengine.h>
    71 #include <QtGui/qpaintengine.h>
    70 #include <private/qbackingstore_p.h>
    72 #include <private/qbackingstore_p.h>
    71 
    73 
    72 #include <QtGui/QGraphicsView>
    74 #include <QtGui/QGraphicsView>
    73 #include <QtGui/QGraphicsProxyWidget>
    75 #include <QtGui/QGraphicsProxyWidget>
   354 #if defined (Q_WS_WIN)
   356 #if defined (Q_WS_WIN)
   355     void gdiPainting();
   357     void gdiPainting();
   356     void paintOnScreenPossible();
   358     void paintOnScreenPossible();
   357 #endif
   359 #endif
   358     void reparentStaticWidget();
   360     void reparentStaticWidget();
       
   361     void QTBUG6883_reparentStaticWidget2();
   359 #ifdef Q_WS_QWS
   362 #ifdef Q_WS_QWS
   360     void updateOutsideSurfaceClip();
   363     void updateOutsideSurfaceClip();
   361 #endif
   364 #endif
   362     void translucentWidget();
   365     void translucentWidget();
   363 
   366 
  8726     QTest::qWait(20);
  8729     QTest::qWait(20);
  8727 
  8730 
  8728     // Please don't crash.
  8731     // Please don't crash.
  8729     paintOnScreen.resize(paintOnScreen.size() + QSize(2, 2));
  8732     paintOnScreen.resize(paintOnScreen.size() + QSize(2, 2));
  8730     QTest::qWait(20);
  8733     QTest::qWait(20);
       
  8734 
       
  8735 }
       
  8736 
       
  8737 void tst_QWidget::QTBUG6883_reparentStaticWidget2()
       
  8738 {
       
  8739     QMainWindow mw;
       
  8740     QDockWidget *one = new QDockWidget("one", &mw);
       
  8741     mw.addDockWidget(Qt::LeftDockWidgetArea, one , Qt::Vertical);
       
  8742 
       
  8743     QWidget *child = new QWidget();
       
  8744     child->setPalette(Qt::red);
       
  8745     child->setAutoFillBackground(true);
       
  8746     child->setAttribute(Qt::WA_StaticContents);
       
  8747     child->resize(100, 100);
       
  8748     one->setWidget(child);
       
  8749 
       
  8750     QToolBar *mainTools = mw.addToolBar("Main Tools");
       
  8751     mainTools->addWidget(new QLineEdit);
       
  8752 
       
  8753     mw.show();
       
  8754     QTest::qWaitForWindowShown(&mw);
       
  8755 
       
  8756     one->setFloating(true);
       
  8757     QTest::qWait(20);
       
  8758     //do not crash
  8731 }
  8759 }
  8732 
  8760 
  8733 #ifdef Q_WS_QWS
  8761 #ifdef Q_WS_QWS
  8734 void tst_QWidget::updateOutsideSurfaceClip()
  8762 void tst_QWidget::updateOutsideSurfaceClip()
  8735 {
  8763 {
  9724 {
  9752 {
  9725 public:
  9753 public:
  9726     void deleteBackingStore()
  9754     void deleteBackingStore()
  9727     {
  9755     {
  9728         if (static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) {
  9756         if (static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) {
  9729             delete static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore;    
  9757             delete static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore;
  9730             static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore = 0;
  9758             static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore = 0;
  9731         }
  9759         }
  9732     }
  9760     }
  9733     void enableBackingStore()
  9761     void enableBackingStore()
  9734     {
  9762     {