Fix tst_QVideoWidget.
Make sure the tested QVideoWidget has a valid size. Since 7b63c45d in qtbase, native widgets are required to have a valid size to be shown. This test relies on qWaitForWindowExposed() to work correctly, which means the widget must be shown and thus must have a valid size. Change-Id: I13bc1536d788d9ba56b4dcbf0c60851b5634be9e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This commit is contained in:
@@ -114,6 +114,17 @@ private:
|
||||
Q_DECLARE_METATYPE(Qt::AspectRatioMode)
|
||||
Q_DECLARE_METATYPE(const uchar *)
|
||||
|
||||
class QtTestVideoWidget : public QVideoWidget
|
||||
{
|
||||
public:
|
||||
QtTestVideoWidget(QWidget *parent = 0)
|
||||
: QVideoWidget(parent)
|
||||
{
|
||||
setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
resize(320, 240);
|
||||
}
|
||||
};
|
||||
|
||||
class QtTestWindowControl : public QVideoWindowControl
|
||||
{
|
||||
public:
|
||||
@@ -339,8 +350,7 @@ public:
|
||||
|
||||
void tst_QVideoWidget::nullObject()
|
||||
{
|
||||
QVideoWidget widget;
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
QtTestVideoWidget widget;
|
||||
|
||||
QVERIFY(widget.sizeHint().isEmpty());
|
||||
|
||||
@@ -425,11 +435,9 @@ void tst_QVideoWidget::nullService()
|
||||
{
|
||||
QtTestVideoObject object(0);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
QVERIFY(widget.sizeHint().isEmpty());
|
||||
|
||||
widget.show();
|
||||
@@ -459,9 +467,8 @@ void tst_QVideoWidget::noOutputs()
|
||||
{
|
||||
QtTestVideoObject object(0, 0, 0);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
QVERIFY(widget.sizeHint().isEmpty());
|
||||
|
||||
@@ -489,9 +496,8 @@ void tst_QVideoWidget::serviceDestroyed()
|
||||
|
||||
QtTestVideoObject object(new QtTestWindowControl, new QtTestWidgetControl, 0);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
@@ -526,16 +532,14 @@ void tst_QVideoWidget::objectDestroyed()
|
||||
new QtTestWidgetControl,
|
||||
0);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object->bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
QCOMPARE(object->testService->windowRef, 0);
|
||||
QCOMPARE(object->testService->widgetRef, 1);
|
||||
QCOMPARE(object->testService->rendererRef, 0);
|
||||
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
||||
widget.setBrightness(100);
|
||||
widget.setContrast(100);
|
||||
@@ -569,8 +573,7 @@ void tst_QVideoWidget::setMediaObject()
|
||||
QtTestVideoObject widgetObject(0, new QtTestWidgetControl, 0);
|
||||
QtTestVideoObject rendererObject(0, 0, new QtTestRendererControl);
|
||||
|
||||
QVideoWidget widget;
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
QtTestVideoWidget widget;
|
||||
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
@@ -622,9 +625,8 @@ void tst_QVideoWidget::showWindowControl()
|
||||
QtTestVideoObject object(new QtTestWindowControl, 0, 0);
|
||||
object.testService->windowControl->setNativeSize(QSize(240, 180));
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
@@ -648,9 +650,8 @@ void tst_QVideoWidget::showWidgetControl()
|
||||
#endif
|
||||
|
||||
QtTestVideoObject object(0, new QtTestWidgetControl, 0);
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
@@ -672,9 +673,8 @@ void tst_QVideoWidget::showRendererControl()
|
||||
#endif
|
||||
|
||||
QtTestVideoObject object(0, 0, new QtTestRendererControl);
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
@@ -693,9 +693,8 @@ void tst_QVideoWidget::aspectRatioWindowControl()
|
||||
QtTestVideoObject object(new QtTestWindowControl, 0, 0);
|
||||
object.testService->windowControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
// Test the aspect ratio defaults to keeping the aspect ratio.
|
||||
QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
|
||||
@@ -729,9 +728,8 @@ void tst_QVideoWidget::aspectRatioWidgetControl()
|
||||
QtTestVideoObject object(0, new QtTestWidgetControl, 0);
|
||||
object.testService->widgetControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
// Test the aspect ratio defaults to keeping the aspect ratio.
|
||||
QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
|
||||
@@ -764,9 +762,8 @@ void tst_QVideoWidget::aspectRatioRendererControl()
|
||||
|
||||
QtTestVideoObject object(0, 0, new QtTestRendererControl);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
// Test the aspect ratio defaults to keeping the aspect ratio.
|
||||
QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
|
||||
@@ -801,9 +798,8 @@ void tst_QVideoWidget::sizeHintWindowControl()
|
||||
QFETCH(QSize, size);
|
||||
|
||||
QtTestVideoObject object(new QtTestWindowControl, 0, 0);
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
||||
@@ -822,9 +818,8 @@ void tst_QVideoWidget::sizeHintWidgetControl()
|
||||
QFETCH(QSize, size);
|
||||
|
||||
QtTestVideoObject object(0, new QtTestWidgetControl, 0);
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
||||
@@ -877,9 +872,8 @@ void tst_QVideoWidget::sizeHintRendererControl()
|
||||
QFETCH(QSize, expectedSize);
|
||||
|
||||
QtTestVideoObject object(0, 0, new QtTestRendererControl);
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
@@ -897,7 +891,7 @@ void tst_QVideoWidget::sizeHintRendererControl()
|
||||
void tst_QVideoWidget::fullScreenWindowControl()
|
||||
{
|
||||
QtTestVideoObject object(new QtTestWindowControl, 0, 0);
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.showNormal();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
@@ -982,7 +976,7 @@ void tst_QVideoWidget::fullScreenWidgetControl()
|
||||
#endif
|
||||
|
||||
QtTestVideoObject object(0, new QtTestWidgetControl, 0);
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.showNormal();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
@@ -1068,7 +1062,7 @@ void tst_QVideoWidget::fullScreenRendererControl()
|
||||
#endif
|
||||
|
||||
QtTestVideoObject object(0, 0, new QtTestRendererControl);
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.showNormal();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
@@ -1164,9 +1158,8 @@ void tst_QVideoWidget::brightnessWindowControl()
|
||||
QtTestVideoObject object(new QtTestWindowControl, 0, 0);
|
||||
object.testService->windowControl->setBrightness(controlValue);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
||||
@@ -1209,9 +1202,8 @@ void tst_QVideoWidget::brightnessWidgetControl()
|
||||
QtTestVideoObject object(0, new QtTestWidgetControl, 0);
|
||||
object.testService->widgetControl->setBrightness(controlValue);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
QCOMPARE(widget.brightness(), 0);
|
||||
|
||||
@@ -1248,9 +1240,8 @@ void tst_QVideoWidget::brightnessRendererControl()
|
||||
|
||||
QtTestVideoObject object(0, 0, new QtTestRendererControl);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
||||
@@ -1275,9 +1266,8 @@ void tst_QVideoWidget::contrastWindowControl()
|
||||
QtTestVideoObject object(new QtTestWindowControl, 0, 0);
|
||||
object.testService->windowControl->setContrast(controlValue);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
QCOMPARE(widget.contrast(), 0);
|
||||
|
||||
@@ -1317,9 +1307,8 @@ void tst_QVideoWidget::contrastWidgetControl()
|
||||
QtTestVideoObject object(0, new QtTestWidgetControl, 0);
|
||||
object.testService->widgetControl->setContrast(controlValue);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
QCOMPARE(widget.contrast(), 0);
|
||||
|
||||
widget.show();
|
||||
@@ -1356,9 +1345,8 @@ void tst_QVideoWidget::contrastRendererControl()
|
||||
|
||||
QtTestVideoObject object(0, 0, new QtTestRendererControl);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
||||
@@ -1383,9 +1371,8 @@ void tst_QVideoWidget::hueWindowControl()
|
||||
QtTestVideoObject object(new QtTestWindowControl, 0, 0);
|
||||
object.testService->windowControl->setHue(controlValue);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
QCOMPARE(widget.hue(), 0);
|
||||
|
||||
widget.show();
|
||||
@@ -1424,9 +1411,8 @@ void tst_QVideoWidget::hueWidgetControl()
|
||||
QtTestVideoObject object(0, new QtTestWidgetControl, 0);
|
||||
object.testService->widgetControl->setHue(controlValue);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
QCOMPARE(widget.hue(), 0);
|
||||
|
||||
widget.show();
|
||||
@@ -1463,9 +1449,8 @@ void tst_QVideoWidget::hueRendererControl()
|
||||
|
||||
QtTestVideoObject object(0, 0, new QtTestRendererControl);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
||||
@@ -1490,9 +1475,8 @@ void tst_QVideoWidget::saturationWindowControl()
|
||||
QtTestVideoObject object(new QtTestWindowControl, 0, 0);
|
||||
object.testService->windowControl->setSaturation(controlValue);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
QCOMPARE(widget.saturation(), 0);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
@@ -1530,9 +1514,8 @@ void tst_QVideoWidget::saturationWidgetControl()
|
||||
QtTestVideoObject object(0, new QtTestWidgetControl, 0);
|
||||
object.testService->widgetControl->setSaturation(controlValue);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
|
||||
QCOMPARE(widget.saturation(), 0);
|
||||
widget.show();
|
||||
@@ -1570,9 +1553,8 @@ void tst_QVideoWidget::saturationRendererControl()
|
||||
|
||||
QtTestVideoObject object(0, 0, new QtTestRendererControl);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
QSignalSpy spy(&widget, SIGNAL(saturationChanged(int)));
|
||||
@@ -1597,9 +1579,8 @@ void tst_QVideoWidget::paintRendererControl()
|
||||
{
|
||||
QtTestVideoObject object(0, 0, new QtTestRendererControl);
|
||||
|
||||
QVideoWidget widget;
|
||||
QtTestVideoWidget widget;
|
||||
object.bind(&widget);
|
||||
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
widget.resize(640,480);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
||||
Reference in New Issue
Block a user