diff options
author | Morten Sorvig <msorvig@trolltech.com> | 2009-09-10 08:38:21 (GMT) |
---|---|---|
committer | Morten Sorvig <msorvig@trolltech.com> | 2009-09-10 08:38:21 (GMT) |
commit | 87fd237f2857e0d988a476731662a34c6bf045b3 (patch) | |
tree | c07c6d1845d3254d18d66880244b2e51c55d13c3 | |
parent | 4de4da9e3cc3acc7a91599447ee632e9db16ff6d (diff) | |
parent | d7fac182fe090831ac5f9e70d0615aec298ff1e2 (diff) | |
download | Qt-87fd237f2857e0d988a476731662a34c6bf045b3.zip Qt-87fd237f2857e0d988a476731662a34c6bf045b3.tar.gz Qt-87fd237f2857e0d988a476731662a34c6bf045b3.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6
-rw-r--r-- | examples/multimedia/audio/audiodevices/audiodevicesbase.ui | 444 | ||||
-rw-r--r-- | src/opengl/qglframebufferobject.cpp | 15 | ||||
-rw-r--r-- | src/opengl/qglframebufferobject_p.h | 5 | ||||
-rw-r--r-- | src/opengl/qglpaintdevice_p.h | 2 | ||||
-rw-r--r-- | tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp | 28 | ||||
-rw-r--r-- | tests/auto/qmainwindow/tst_qmainwindow.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qthread/tst_qthread.cpp | 10 |
7 files changed, 269 insertions, 243 deletions
diff --git a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui b/examples/multimedia/audio/audiodevices/audiodevicesbase.ui index 674f201..29dd40e 100644 --- a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui +++ b/examples/multimedia/audio/audiodevices/audiodevicesbase.ui @@ -1,7 +1,8 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>AudioDevicesBase</class> - <widget class="QMainWindow" name="AudioDevicesBase" > - <property name="geometry" > + <widget class="QMainWindow" name="AudioDevicesBase"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> @@ -9,246 +10,223 @@ <height>702</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>AudioDevicesBase</string> </property> - <widget class="QWidget" name="centralwidget" > - <property name="geometry" > - <rect> - <x>0</x> - <y>28</y> - <width>504</width> - <height>653</height> - </rect> - </property> - <widget class="QWidget" name="layoutWidget" > - <property name="geometry" > - <rect> - <x>40</x> - <y>21</y> - <width>321</width> - <height>506</height> - </rect> - </property> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="deviceLabel" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > - <horstretch>1</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Device</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QLabel" name="modeLabel" > - <property name="text" > - <string>Mode</string> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QComboBox" name="deviceBox" /> - </item> - <item row="1" column="1" > - <widget class="QComboBox" name="modeBox" /> - </item> - <item row="2" column="0" > - <widget class="QLabel" name="actualLabel" > - <property name="frameShape" > - <enum>QFrame::Panel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Raised</enum> - </property> - <property name="text" > - <string>Actual Settings</string> - </property> - <property name="alignment" > - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item row="2" column="1" > - <widget class="QLabel" name="nearestLabel" > - <property name="frameShape" > - <enum>QFrame::Panel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Raised</enum> - </property> - <property name="text" > - <string>Nearest Settings</string> - </property> - <property name="alignment" > - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item row="3" column="0" > - <widget class="QLabel" name="actualFreqLabel" > - <property name="text" > - <string>Frequency</string> - </property> - </widget> - </item> - <item row="3" column="1" > - <widget class="QLabel" name="nearestFreqLabel" > - <property name="text" > - <string>Frequency</string> - </property> - </widget> - </item> - <item row="4" column="0" > - <widget class="QComboBox" name="frequencyBox" /> - </item> - <item row="4" column="1" > - <widget class="QLineEdit" name="nearestFreq" /> - </item> - <item row="5" column="0" > - <widget class="QLabel" name="actualChannelsLabel" > - <property name="text" > - <string>Channels</string> - </property> - </widget> - </item> - <item row="5" column="1" > - <widget class="QLabel" name="nearestChannelLabel" > - <property name="text" > - <string>Channel</string> - </property> - </widget> - </item> - <item row="6" column="0" > - <widget class="QComboBox" name="channelsBox" /> - </item> - <item row="6" column="1" > - <widget class="QLineEdit" name="nearestChannel" /> - </item> - <item row="7" column="0" > - <widget class="QLabel" name="actualCodecLabel" > - <property name="text" > - <string>Codecs</string> - </property> - </widget> - </item> - <item row="7" column="1" > - <widget class="QLabel" name="nearestCodecLabel" > - <property name="text" > - <string>Codec</string> - </property> - </widget> - </item> - <item row="8" column="0" > - <widget class="QComboBox" name="codecsBox" /> - </item> - <item row="8" column="1" > - <widget class="QLineEdit" name="nearestCodec" /> - </item> - <item row="9" column="0" > - <widget class="QLabel" name="actualSampleSizeLabel" > - <property name="text" > - <string>SampleSize</string> - </property> - </widget> - </item> - <item row="9" column="1" > - <widget class="QLabel" name="nearestSampleSizeLabel" > - <property name="text" > - <string>SampleSize</string> - </property> - </widget> - </item> - <item row="10" column="0" > - <widget class="QComboBox" name="sampleSizesBox" /> - </item> - <item row="10" column="1" > - <widget class="QLineEdit" name="nearestSampleSize" /> - </item> - <item row="11" column="0" > - <widget class="QLabel" name="actualSampleTypeLabel" > - <property name="text" > - <string>SampleType</string> - </property> - </widget> - </item> - <item row="11" column="1" > - <widget class="QLabel" name="nearestSampleTypeLabel" > - <property name="text" > - <string>SampleType</string> - </property> - </widget> - </item> - <item row="12" column="0" > - <widget class="QComboBox" name="sampleTypesBox" /> - </item> - <item row="12" column="1" > - <widget class="QLineEdit" name="nearestSampleType" /> - </item> - <item row="13" column="0" > - <widget class="QLabel" name="actualEndianLabel" > - <property name="text" > - <string>Endianess</string> - </property> - </widget> - </item> - <item row="13" column="1" > - <widget class="QLabel" name="nearestEndianLabel" > - <property name="text" > - <string>Endianess</string> - </property> - </widget> - </item> - <item row="14" column="0" > - <widget class="QComboBox" name="endianBox" /> - </item> - <item row="14" column="1" > - <widget class="QLineEdit" name="nearestEndian" /> - </item> - <item row="15" column="0" colspan="2" > - <widget class="QTextEdit" name="logOutput" > - <property name="minimumSize" > - <size> - <width>0</width> - <height>40</height> - </size> - </property> - </widget> - </item> - <item row="16" column="0" colspan="2" > - <widget class="QPushButton" name="testButton" > - <property name="text" > - <string>Test</string> - </property> - </widget> - </item> - </layout> - </widget> + <widget class="QWidget" name="centralwidget"> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="deviceLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Device</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="modeLabel"> + <property name="text"> + <string>Mode</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QComboBox" name="deviceBox"/> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="modeBox"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="actualLabel"> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>Actual Settings</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="nearestLabel"> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>Nearest Settings</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="actualFreqLabel"> + <property name="text"> + <string>Frequency</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLabel" name="nearestFreqLabel"> + <property name="text"> + <string>Frequency</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QComboBox" name="frequencyBox"/> + </item> + <item row="4" column="1"> + <widget class="QLineEdit" name="nearestFreq"/> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="actualChannelsLabel"> + <property name="text"> + <string>Channels</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QLabel" name="nearestChannelLabel"> + <property name="text"> + <string>Channel</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QComboBox" name="channelsBox"/> + </item> + <item row="6" column="1"> + <widget class="QLineEdit" name="nearestChannel"/> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="actualCodecLabel"> + <property name="text"> + <string>Codecs</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QLabel" name="nearestCodecLabel"> + <property name="text"> + <string>Codec</string> + </property> + </widget> + </item> + <item row="8" column="0"> + <widget class="QComboBox" name="codecsBox"/> + </item> + <item row="8" column="1"> + <widget class="QLineEdit" name="nearestCodec"/> + </item> + <item row="9" column="0"> + <widget class="QLabel" name="actualSampleSizeLabel"> + <property name="text"> + <string>SampleSize</string> + </property> + </widget> + </item> + <item row="9" column="1"> + <widget class="QLabel" name="nearestSampleSizeLabel"> + <property name="text"> + <string>SampleSize</string> + </property> + </widget> + </item> + <item row="10" column="0"> + <widget class="QComboBox" name="sampleSizesBox"/> + </item> + <item row="10" column="1"> + <widget class="QLineEdit" name="nearestSampleSize"/> + </item> + <item row="11" column="0"> + <widget class="QLabel" name="actualSampleTypeLabel"> + <property name="text"> + <string>SampleType</string> + </property> + </widget> + </item> + <item row="11" column="1"> + <widget class="QLabel" name="nearestSampleTypeLabel"> + <property name="text"> + <string>SampleType</string> + </property> + </widget> + </item> + <item row="12" column="0"> + <widget class="QComboBox" name="sampleTypesBox"/> + </item> + <item row="12" column="1"> + <widget class="QLineEdit" name="nearestSampleType"/> + </item> + <item row="13" column="0"> + <widget class="QLabel" name="actualEndianLabel"> + <property name="text"> + <string>Endianess</string> + </property> + </widget> + </item> + <item row="13" column="1"> + <widget class="QLabel" name="nearestEndianLabel"> + <property name="text"> + <string>Endianess</string> + </property> + </widget> + </item> + <item row="14" column="0"> + <widget class="QComboBox" name="endianBox"/> + </item> + <item row="14" column="1"> + <widget class="QLineEdit" name="nearestEndian"/> + </item> + <item row="15" column="0" colspan="2"> + <widget class="QTextEdit" name="logOutput"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>40</height> + </size> + </property> + </widget> + </item> + <item row="16" column="0" colspan="2"> + <widget class="QPushButton" name="testButton"> + <property name="text"> + <string>Test</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> </widget> - <widget class="QMenuBar" name="menubar" > - <property name="geometry" > + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>504</width> - <height>28</height> - </rect> - </property> - </widget> - <widget class="QStatusBar" name="statusbar" > - <property name="geometry" > - <rect> - <x>0</x> - <y>681</y> - <width>504</width> - <height>21</height> + <height>22</height> </rect> </property> </widget> + <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> <connections/> diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 094f675..f15aa01 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -299,10 +299,21 @@ bool QGLFramebufferObjectFormat::operator!=(const QGLFramebufferObjectFormat& ot return !(*this == other); } -void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f) +void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f, + QGLFramebufferObject::Attachment attachment) { fbo = f; m_thisFBO = fbo->d_func()->fbo; // This shouldn't be needed + + // The context that the fbo was created in may not have depth + // and stencil buffers, but the fbo itself might. + fboFormat = QGLContext::currentContext()->format(); + if (attachment == QGLFramebufferObject::CombinedDepthStencil) { + fboFormat.setDepth(true); + fboFormat.setStencil(true); + } else if (attachment == QGLFramebufferObject::Depth) { + fboFormat.setDepth(true); + } } void QGLFBOGLPaintDevice::ensureActiveTarget() @@ -395,7 +406,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbo); - glDevice.setFBO(q); + glDevice.setFBO(q, attachment); QT_CHECK_GLERROR(); // init texture diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index c11c496..f80209d 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -110,15 +110,18 @@ public: virtual QPaintEngine* paintEngine() const {return fbo->paintEngine();} virtual QSize size() const {return fbo->size();} virtual QGLContext* context() const {return const_cast<QGLContext *>(QGLContext::currentContext());} + virtual QGLFormat format() const {return fboFormat;} virtual void ensureActiveTarget(); virtual void beginPaint(); virtual void endPaint(); - void setFBO(QGLFramebufferObject* f); + void setFBO(QGLFramebufferObject* f, + QGLFramebufferObject::Attachment attachment); private: bool wasBound; QGLFramebufferObject* fbo; + QGLFormat fboFormat; }; class QGLFramebufferObjectPrivate diff --git a/src/opengl/qglpaintdevice_p.h b/src/opengl/qglpaintdevice_p.h index 66b24a9..1e7ba8d 100644 --- a/src/opengl/qglpaintdevice_p.h +++ b/src/opengl/qglpaintdevice_p.h @@ -73,7 +73,7 @@ public: virtual void endPaint(); virtual QGLContext* context() const = 0; - QGLFormat format() const; + virtual QGLFormat format() const; virtual QSize size() const = 0; // returns the QGLPaintDevice for the given QPaintDevice diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index e3a70e9..420962d 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -49,8 +49,8 @@ QT_USE_NAMESPACE // this test only works with // * GLIBC // * MSVC - only debug builds (we need the crtdbg.h helpers) -// * SYMBIAN - only when __UHEAP_BURSTFAILNEXT is available -#if (defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_CC_MSVC) && (!defined(Q_OS_SYMBIAN) || !defined(__UHEAP_BURSTFAILNEXT)))) && !defined(Q_MOC_RUN) +// * SYMBIAN +#if (defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_CC_MSVC) && !defined(Q_OS_SYMBIAN))) && !defined(Q_MOC_RUN) QTEST_NOOP_MAIN #else @@ -65,6 +65,7 @@ class tst_ExceptionSafetyObjects: public QObject public slots: void initTestCase(); + void cleanupTestCase(); private slots: void objects_data(); @@ -81,6 +82,10 @@ private slots: void linkedList_data(); void linkedList(); + +private: + static QtMsgHandler testMessageHandler; + static void safeMessageHandler(QtMsgType, const char *); }; // helper structs to create an arbitrary widget @@ -268,8 +273,22 @@ public: } }; +QtMsgHandler tst_ExceptionSafetyObjects::testMessageHandler; + +void tst_ExceptionSafetyObjects::safeMessageHandler(QtMsgType type, const char *msg) +{ + // this temporarily suspends OOM testing while handling a message + int currentIndex = mallocFailIndex; + AllocFailer allocFailer(0); + allocFailer.deactivate(); + (*testMessageHandler)(type, msg); + allocFailer.reactivateAt(currentIndex); +} + void tst_ExceptionSafetyObjects::initTestCase() { + testMessageHandler = qInstallMsgHandler(safeMessageHandler); + QVERIFY(AllocFailer::initialize()); // sanity check whether OOM simulation works @@ -307,6 +326,11 @@ void tst_ExceptionSafetyObjects::initTestCase() QCOMPARE(malloc2Failed, 1); } +void tst_ExceptionSafetyObjects::cleanupTestCase() +{ + qInstallMsgHandler(testMessageHandler); +} + void tst_ExceptionSafetyObjects::objects() { QFETCH(AbstractTester *, objectCreator); diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index 6505f90..38d23b6 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -1692,8 +1692,12 @@ void tst_QMainWindow::dockWidgetSize() mainWindow.show(); QTest::qWait(100); - QCOMPARE(widget.size(), widget.sizeHint()); - QCOMPARE(dock.widget()->size(), dock.widget()->sizeHint()); + if (mainWindow.size() == mainWindow.sizeHint()) { + QCOMPARE(widget.size(), widget.sizeHint()); + QCOMPARE(dock.widget()->size(), dock.widget()->sizeHint()); + } else { + //otherwise the screen is too small and the size are irrelevant + } } diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index dec25bd..64bdfd0 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -629,6 +629,12 @@ void noop(void*) { } typedef HANDLE ThreadHandle; #endif +#ifdef Q_OS_WIN +#define WIN_FIX_STDCALL __stdcall +#else +#define WIN_FIX_STDCALL +#endif + class NativeThreadWrapper { public: @@ -647,7 +653,7 @@ public: QWaitCondition stopCondition; protected: static void *runUnix(void *data); - static unsigned __stdcall runWin(void *data); + static unsigned WIN_FIX_STDCALL runWin(void *data); FunctionPointer functionPointer; void *data; @@ -711,7 +717,7 @@ void *NativeThreadWrapper::runUnix(void *that) return 0; } -unsigned __stdcall NativeThreadWrapper::runWin(void *data) +unsigned WIN_FIX_STDCALL NativeThreadWrapper::runWin(void *data) { runUnix(data); return 0; |