qtmobility/tests/auto/qvideowidget/tst_qvideowidget.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
--- a/qtmobility/tests/auto/qvideowidget/tst_qvideowidget.cpp	Fri Apr 16 15:51:22 2010 +0300
+++ b/qtmobility/tests/auto/qvideowidget/tst_qvideowidget.cpp	Mon May 03 13:18:40 2010 +0300
@@ -42,16 +42,16 @@
 #include <qmobilityglobal.h>
 #include <QtTest/QtTest>
 
-#include "qvideowidget.h"
+#include "../../../src/multimedia/qvideowidget.h"
 
-#include "qmediaobject.h"
-#include "qmediaservice.h"
-#include "qpaintervideosurface_p.h"
-#include "qvideooutputcontrol.h"
-#include "qvideowindowcontrol.h"
-#include "qvideowidgetcontrol.h"
+#include "../../../src/multimedia/qmediaobject.h"
+#include "../../../src/multimedia/qmediaservice.h"
+#include "../../../src/multimedia/qpaintervideosurface_p.h"
+#include "../../../src/multimedia/qvideooutputcontrol.h"
+#include "../../../src/multimedia/qvideowindowcontrol.h"
+#include "../../../src/multimedia/qvideowidgetcontrol.h"
 
-#include "qvideorenderercontrol.h"
+#include "../../../src/multimedia/qvideorenderercontrol.h"
 #include <QtMultimedia/qabstractvideosurface.h>
 #include <QtMultimedia/qvideosurfaceformat.h>
 
@@ -119,7 +119,7 @@
     void color_data();
 };
 
-Q_DECLARE_METATYPE(QVideoWidget::AspectRatioMode)
+Q_DECLARE_METATYPE(Qt::AspectRatioMode)
 Q_DECLARE_METATYPE(const uchar *)
 
 class QtTestOutputControl : public QVideoOutputControl
@@ -147,7 +147,7 @@
         , m_brightness(0)
         , m_contrast(0)
         , m_saturation(0)
-        , m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+        , m_aspectRatioMode(Qt::KeepAspectRatio)
         , m_fullScreen(0)
     {
     }
@@ -168,8 +168,8 @@
     QSize nativeSize() const { return m_nativeSize; }
     void setNativeSize(const QSize &size) { m_nativeSize = size; emit nativeSizeChanged(); }
 
-    QVideoWidget::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
-    void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) { m_aspectRatioMode = mode; }
+    Qt::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
+    void setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; }
 
     int brightness() const { return m_brightness; }
     void setBrightness(int brightness) { emit brightnessChanged(m_brightness = brightness); }
@@ -190,7 +190,7 @@
     int m_contrast;
     int m_hue;
     int m_saturation;
-    QVideoWidget::AspectRatioMode m_aspectRatioMode;
+    Qt::AspectRatioMode m_aspectRatioMode;
     QRect m_displayRect;
     QSize m_nativeSize;
     bool m_fullScreen;
@@ -204,7 +204,7 @@
         , m_contrast(1.0)
         , m_hue(1.0)
         , m_saturation(1.0)
-        , m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+        , m_aspectRatioMode(Qt::KeepAspectRatio)
         , m_fullScreen(false)
     {
     }
@@ -212,8 +212,8 @@
     bool isFullScreen() const { return m_fullScreen; }
     void setFullScreen(bool fullScreen) { emit fullScreenChanged(m_fullScreen = fullScreen); }
 
-    QVideoWidget::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
-    void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) { m_aspectRatioMode = mode; }
+    Qt::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
+    void setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; }
 
     int brightness() const { return m_brightness; }
     void setBrightness(int brightness) { emit brightnessChanged(m_brightness = brightness); }
@@ -244,7 +244,7 @@
     int m_contrast;
     int m_hue;
     int m_saturation;
-    QVideoWidget::AspectRatioMode m_aspectRatioMode;
+    Qt::AspectRatioMode m_aspectRatioMode;
     QSize m_sizeHint;
     bool m_fullScreen;
 };
@@ -357,8 +357,8 @@
     QTest::qWaitForWindowShown(&widget);
     QCOMPARE(widget.isFullScreen(), true);
 
-    widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
+    widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
 
     {
         QSignalSpy spy(&widget, SIGNAL(brightnessChanged(int)));
@@ -442,8 +442,8 @@
     QTest::qWaitForWindowShown(&widget);
     QCOMPARE(widget.isFullScreen(), true);
 
-    widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
+    widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
 
     widget.setBrightness(100);
     QCOMPARE(widget.brightness(), 100);
@@ -655,7 +655,7 @@
 
     widget.hide();
 
-    QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput);
+    QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::WindowOutput);
 }
 
 void tst_QVideoWidget::showWidgetControl()
@@ -679,7 +679,7 @@
 
     widget.hide();
 
-    QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput);
+    QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::WidgetOutput);
     QCOMPARE(object.testService->widgetControl->videoWidget()->isVisible(), false);
 }
 
@@ -704,71 +704,71 @@
 
     widget.hide();
 
-    QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput);
+    QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::RendererOutput);
 }
 
 void tst_QVideoWidget::aspectRatioWindowControl()
 {
     QtTestVideoObject object(new QtTestWindowControl, 0, 0);
-    object.testService->windowControl->setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
+    object.testService->windowControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
 
     QVideoWidget widget;
     widget.setMediaObject(&object);
     widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
 
     // Test the aspect ratio defaults to keeping the aspect ratio.
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
 
     // Test the control has been informed of the aspect ratio change, post show.
     widget.show();
     QTest::qWaitForWindowShown(&widget);
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
-    QCOMPARE(object.testService->windowControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
+    QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::KeepAspectRatio);
 
     // Test an aspect ratio change is enforced immediately while visible.
-    widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
-    QCOMPARE(object.testService->windowControl->aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
+    widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
+    QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::IgnoreAspectRatio);
 
     // Test an aspect ratio set while not visible is respected.
     widget.hide();
-    widget.setAspectRatioMode(QVideoWidget::KeepAspectRatio);
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    widget.setAspectRatioMode(Qt::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
     widget.show();
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
-    QCOMPARE(object.testService->windowControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
+    QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::KeepAspectRatio);
 }
 
 void tst_QVideoWidget::aspectRatioWidgetControl()
 {
     QtTestVideoObject object(0, new QtTestWidgetControl, 0);
-    object.testService->widgetControl->setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
+    object.testService->widgetControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
 
     QVideoWidget widget;
     widget.setMediaObject(&object);
     widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
 
     // Test the aspect ratio defaults to keeping the aspect ratio.
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
 
     // Test the control has been informed of the aspect ratio change, post show.
     widget.show();
     QTest::qWaitForWindowShown(&widget);
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
-    QCOMPARE(object.testService->widgetControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
+    QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::KeepAspectRatio);
 
     // Test an aspect ratio change is enforced immediately while visible.
-    widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
-    QCOMPARE(object.testService->widgetControl->aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
+    widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
+    QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::IgnoreAspectRatio);
 
     // Test an aspect ratio set while not visible is respected.
     widget.hide();
-    widget.setAspectRatioMode(QVideoWidget::KeepAspectRatio);
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    widget.setAspectRatioMode(Qt::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
     widget.show();
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
-    QCOMPARE(object.testService->widgetControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
+    QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::KeepAspectRatio);
 }
 
 void tst_QVideoWidget::aspectRatioRendererControl()
@@ -780,23 +780,23 @@
     widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
 
     // Test the aspect ratio defaults to keeping the aspect ratio.
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
 
     // Test the control has been informed of the aspect ratio change, post show.
     widget.show();
     QTest::qWaitForWindowShown(&widget);
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
 
     // Test an aspect ratio change is enforced immediately while visible.
-    widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
+    widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
 
     // Test an aspect ratio set while not visible is respected.
     widget.hide();
-    widget.setAspectRatioMode(QVideoWidget::KeepAspectRatio);
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    widget.setAspectRatioMode(Qt::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
     widget.show();
-    QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+    QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
 }
 
 void tst_QVideoWidget::sizeHint_data()