Guest User

Untitled

a guest
Jun 23rd, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.25 KB | None | 0 0
  1. From 40e8f57a9284d14ec09f8fd512c416e85a73860b Mon Sep 17 00:00:00 2001
  2. From: Gareth Stockwell <ext-gareth.stockwell@nokia.com>
  3. Date: Mon, 13 Feb 2012 14:30:49 +0000
  4. Subject: [PATCH] Fix tst_QGraphicsVideoItem_symbian
  5.  
  6. On versions of the platform which lack the EGL_NOK_image_endpoint2
  7. extension, video rendering is always done via the 'direct' path
  8. (i.e. QVideoWidgetControl, rather than QVideoRendererControl).  This
  9. patch adds a runtime check for the presence of that extension, and
  10. adjusts the expected rendering path used in subsequent checks.
  11.  
  12. Reviewed-by: ?
  13. ---
  14. .../qgraphicsvideoitem_symbian.pro                 |    5 ++
  15.  .../tst_qgraphicsvideoitem_symbian.cpp             |   54 +++++++++++++++----
  16.  2 files changed, 47 insertions(+), 12 deletions(-)
  17.  
  18. diff --git a/tests/auto/qgraphicsvideoitem_symbian/qgraphicsvideoitem_symbian.pro b/tests/auto/qgraphicsvideoitem_symbian/qgraphicsvideoitem_symbian.pro
  19. index 217fded..04d1ba0 100644
  20. --- a/tests/auto/qgraphicsvideoitem_symbian/qgraphicsvideoitem_symbian.pro
  21. +++ b/tests/auto/qgraphicsvideoitem_symbian/qgraphicsvideoitem_symbian.pro
  22. @@ -5,5 +5,10 @@ MOBILITY = multimedia
  23.  INCLUDEPATH += ../../../src/multimedia
  24.  SOURCES += tst_qgraphicsvideoitem_symbian.cpp
  25.  LIBS += -lcone -lavkon
  26. +contains(QT_CONFIG, egl) {
  27. +    LIBS *= -llibegl
  28. +} else {
  29. +    DEFINES += QT_NO_EGL
  30. +}
  31.  include (../../../common.pri)
  32.  
  33. diff --git a/tests/auto/qgraphicsvideoitem_symbian/tst_qgraphicsvideoitem_symbian.cpp b/tests/auto/qgraphicsvideoitem_symbian/tst_qgraphicsvideoitem_symbian.cpp
  34. index 8ba74ab..d9f592a 100644
  35. --- a/tests/auto/qgraphicsvideoitem_symbian/tst_qgraphicsvideoitem_symbian.cpp
  36. +++ b/tests/auto/qgraphicsvideoitem_symbian/tst_qgraphicsvideoitem_symbian.cpp
  37. @@ -55,6 +55,10 @@
  38.  #include <aknenv.h>
  39.  #include <aknappui.h>
  40.  
  41. +#ifndef QT_NO_EGL
  42. +#include <egl/egl.h>
  43. +#endif
  44. +
  45.  QT_USE_NAMESPACE
  46.  
  47.  static const QString FileName = "e:/test.mp4";
  48. @@ -69,7 +73,15 @@ enum PreferredRenderingPath
  49.      PreferredRenderingPathDirect
  50.  };
  51.  
  52. +enum ActualRenderingPath
  53. +{
  54. +    ActualRenderingPathNone,
  55. +    ActualRenderingPathRenderer = PreferredRenderingPathRenderer,
  56. +    ActualRenderingPathDirect = PreferredRenderingPathDirect
  57. +};
  58. +
  59.  Q_DECLARE_METATYPE(PreferredRenderingPath)
  60. +Q_DECLARE_METATYPE(ActualRenderingPath)
  61.  
  62.  #define WAIT_FOR_CONDITION(condition, ms) \
  63.  { \
  64. @@ -104,12 +116,6 @@ private:
  65.      void setPreferredRenderingPath(PreferredRenderingPath path);
  66.      void setFullScreen(bool enabled);
  67.  
  68. -    enum ActualRenderingPath
  69. -    {
  70. -        ActualRenderingPathNone,
  71. -        ActualRenderingPathRenderer = PreferredRenderingPathRenderer,
  72. -        ActualRenderingPathDirect = PreferredRenderingPathDirect
  73. -    };
  74.      ActualRenderingPath actualRenderingPath() const;
  75.  
  76.  private slots:
  77. @@ -123,6 +129,7 @@ private:
  78.      QtTestGraphicsView *m_view;
  79.      QGraphicsScene *m_scene;
  80.      QtTestGraphicsVideoItem *m_videoItem;
  81. +    bool m_eglEndpointSupport;
  82.  };
  83.  
  84.  class QtTestGraphicsView : public QGraphicsView
  85. @@ -198,7 +205,16 @@ void tst_QGraphicsVideoItemSymbian::initTestCase()
  86.      m_view = 0;
  87.      m_scene = 0;
  88.      m_videoItem = 0;
  89. +    m_eglEndpointSupport = false;
  90. +#ifndef QT_NO_EGL
  91. +    const EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
  92. +    if (display != EGL_NO_DISPLAY) {
  93. +        if (eglInitialize(display, 0, 0) == EGL_TRUE)
  94. +            m_eglEndpointSupport = (eglGetProcAddress("eglCreateEndpointNOK") != 0);
  95. +    }
  96. +#endif
  97.      qRegisterMetaType<PreferredRenderingPath>();
  98. +    qRegisterMetaType<ActualRenderingPath>();
  99.  }
  100.  
  101.  void tst_QGraphicsVideoItemSymbian::init()
  102. @@ -284,7 +300,7 @@ void tst_QGraphicsVideoItemSymbian::setFullScreen(bool enabled)
  103.      m_videoItem->setAspectRatioMode(mode);
  104.  }
  105.  
  106. -tst_QGraphicsVideoItemSymbian::ActualRenderingPath tst_QGraphicsVideoItemSymbian::actualRenderingPath() const
  107. +ActualRenderingPath tst_QGraphicsVideoItemSymbian::actualRenderingPath() const
  108.  {
  109.      ActualRenderingPath path = ActualRenderingPathNone;
  110.      static const QString property = "_q_currentVideoRenderingPath";
  111. @@ -320,23 +336,34 @@ void tst_QGraphicsVideoItemSymbian::resetInactivityTime()
  112.  void tst_QGraphicsVideoItemSymbian::specifyPreferredRenderingPath()
  113.  {
  114.      QFETCH(PreferredRenderingPath, preferredRenderingPath);
  115. +    QFETCH(ActualRenderingPath, actualRenderingPath);
  116.      setPreferredRenderingPath(preferredRenderingPath);
  117.      play();
  118. -    QVERIFY(actualRenderingPath() == preferredRenderingPath);
  119. +    QVERIFY(this->actualRenderingPath() == actualRenderingPath);
  120.  }
  121.  
  122.  void tst_QGraphicsVideoItemSymbian::specifyPreferredRenderingPath_data()
  123.  {
  124.      QTest::addColumn<PreferredRenderingPath>("preferredRenderingPath");
  125. -    QTest::newRow("direct") << PreferredRenderingPathDirect;
  126. -    QTest::newRow("renderer") << PreferredRenderingPathRenderer;
  127. +    QTest::addColumn<ActualRenderingPath>("actualRenderingPath");
  128. +        QTest::newRow("direct") << PreferredRenderingPathDirect
  129. +                                << ActualRenderingPathDirect;
  130. +    if (m_eglEndpointSupport)
  131. +        QTest::newRow("renderer") << PreferredRenderingPathRenderer
  132. +                                  << ActualRenderingPathRenderer;
  133. +    else
  134. +        QTest::newRow("renderer") << PreferredRenderingPathRenderer
  135. +                                  << ActualRenderingPathDirect;
  136.  }
  137.  
  138.  void tst_QGraphicsVideoItemSymbian::autoFullScreenIn()
  139.  {
  140.      setPreferredRenderingPath(PreferredRenderingPathAuto);
  141.      play();
  142. -    QVERIFY(actualRenderingPath() == ActualRenderingPathRenderer);
  143. +    if (m_eglEndpointSupport)
  144. +        QVERIFY(actualRenderingPath() == ActualRenderingPathRenderer);
  145. +    else
  146. +        QVERIFY(actualRenderingPath() == ActualRenderingPathDirect);
  147.      m_videoItem->savePaintCount();
  148.      setFullScreen(true);
  149.      m_videoItem->waitForPaint();
  150. @@ -353,7 +380,10 @@ void tst_QGraphicsVideoItemSymbian::autoFullScreenOut()
  151.      m_videoItem->savePaintCount();
  152.      setFullScreen(false);
  153.      m_videoItem->waitForPaint();
  154. -    QVERIFY(actualRenderingPath() == ActualRenderingPathRenderer);
  155. +    if (m_eglEndpointSupport)
  156. +        QVERIFY(actualRenderingPath() == ActualRenderingPathRenderer);
  157. +    else
  158. +        QVERIFY(actualRenderingPath() == ActualRenderingPathDirect);
  159.  }
  160.  
  161.  QTEST_MAIN(tst_QGraphicsVideoItemSymbian)
  162. --
  163. 1.7.4.msysgit.0
Add Comment
Please, Sign In to add comment