Split some of the autotests into widget and non widget parts.

Since the tests are mostly not widget based.

Change-Id: Ic3fa4224b19f2a5c710fd4763b5e645252975c1c
Reviewed-on: http://codereview.qt-project.org/4174
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
This commit is contained in:
Michael Goddard
2011-09-05 16:13:46 +10:00
committed by Qt by Nokia
parent 461a37b412
commit d690596868
30 changed files with 856 additions and 146 deletions

View File

@@ -55,7 +55,10 @@
#include "../qmultimedia_common/mockcameracontrol.h"
#include "../qmultimedia_common/mockvideosurface.h"
#include "../qmultimedia_common/mockvideorenderercontrol.h"
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
#include "../qmultimedia_common/mockvideowindowcontrol.h"
#endif
class MockSimpleCameraService : public QMediaService
{
@@ -102,7 +105,9 @@ public:
mockImageProcessingControl = new MockImageProcessingControl(this);
mockImageEncoderControl = new MockImageEncoderControl(this);
rendererControl = new MockVideoRendererControl(this);
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
windowControl = new MockVideoWindowControl(this);
#endif
rendererRef = 0;
windowRef = 0;
}
@@ -148,12 +153,15 @@ public:
rendererRef += 1;
return rendererControl;
}
} else if (qstrcmp(iid, QVideoWindowControl_iid) == 0) {
}
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
if (qstrcmp(iid, QVideoWindowControl_iid) == 0) {
if (windowRef == 0) {
windowRef += 1;
return windowControl;
}
}
#endif
return 0;
}
@@ -161,8 +169,10 @@ public:
{
if (control == rendererControl)
rendererRef -= 1;
else if (control == windowControl)
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
if (control == windowControl)
windowRef -= 1;
#endif
}
MockCameraControl *mockControl;
@@ -176,7 +186,9 @@ public:
MockImageProcessingControl *mockImageProcessingControl;
MockImageEncoderControl *mockImageEncoderControl;
MockVideoRendererControl *rendererControl;
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
MockVideoWindowControl *windowControl;
#endif
int rendererRef;
int windowRef;
};

View File

@@ -48,7 +48,9 @@
#include "mockmediastreamscontrol.h"
#include "mockmedianetworkaccesscontrol.h"
#include "mockvideorenderercontrol.h"
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
#include "mockvideowindowcontrol.h"
#endif
class MockMediaPlayerService : public QMediaService
{
@@ -61,9 +63,11 @@ public:
mockStreamsControl = new MockStreamsControl;
mockNetworkControl = new MockNetworkAccessControl;
rendererControl = new MockVideoRendererControl;
windowControl = new MockVideoWindowControl;
rendererRef = 0;
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
windowControl = new MockVideoWindowControl;
windowRef = 0;
#endif
}
~MockMediaPlayerService()
@@ -72,7 +76,9 @@ public:
delete mockStreamsControl;
delete mockNetworkControl;
delete rendererControl;
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
delete windowControl;
#endif
}
QMediaControl* requestControl(const char *iid)
@@ -84,13 +90,15 @@ public:
rendererRef += 1;
return rendererControl;
}
} else if (qstrcmp(iid, QVideoWindowControl_iid) == 0) {
}
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
if (qstrcmp(iid, QVideoWindowControl_iid) == 0) {
if (windowRef == 0) {
windowRef += 1;
return windowControl;
}
}
#endif
if (qstrcmp(iid, QMediaNetworkAccessControl_iid) == 0)
return mockNetworkControl;
@@ -101,8 +109,10 @@ public:
{
if (control == rendererControl)
rendererRef -= 1;
else if (control == windowControl)
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
if (control == windowControl)
windowRef -= 1;
#endif
}
void setState(QMediaPlayer::State state) { emit mockControl->stateChanged(mockControl->_state = state); }
@@ -154,9 +164,11 @@ public:
MockStreamsControl *mockStreamsControl;
MockNetworkAccessControl *mockNetworkControl;
MockVideoRendererControl *rendererControl;
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
MockVideoWindowControl *windowControl;
int rendererRef;
int windowRef;
#endif
int rendererRef;
};

View File

@@ -43,6 +43,7 @@
#define MOCKMEDIASERVICEPROVIDER_H
#include "qmediaserviceprovider.h"
#include "qmediaservice.h"
// Simple provider that lets you set the service
class MockMediaServiceProvider : public QMediaServiceProvider

View File

@@ -3,8 +3,12 @@ INCLUDEPATH += $$PWD \
../../../src/multimedia \
../../../src/multimedia/video
contains(QT,multimediakitwidgets)|contains(QT,multimediakitwidgets-private) {
HEADERS *= ../qmultimedia_common/mockvideowindowcontrol.h
DEFINES *= QT_MULTIMEDIAKIT_MOCK_WIDGETS
}
HEADERS *= \
../qmultimedia_common/mockvideosurface.h \
../qmultimedia_common/mockvideorenderercontrol.h \
../qmultimedia_common/mockvideowindowcontrol.h
../qmultimedia_common/mockvideorenderercontrol.h

View File

@@ -42,6 +42,8 @@
#ifndef MOCKVIDEOWINDOWCONTROL_H
#define MOCKVIDEOWINDOWCONTROL_H
#if defined(QT_MULTIMEDIAKIT_MOCK_WIDGETS)
#include "qvideowindowcontrol.h"
class MockVideoWindowControl : public QVideoWindowControl
@@ -68,4 +70,5 @@ public:
void setSaturation(int) {}
};
#endif // QT_MULTIMEDIAKIT_MOCK_WIDGETS
#endif // MOCKVIDEOWINDOWCONTROL_H