diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-12-04 15:51:00 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-12-09 12:52:41 +0000 |
commit | a64ace2171485156cd052d941dd34873b0a31520 (patch) | |
tree | 29eab980c74495e52f9e67d16dba1a571b3aa273 | |
parent | 9d8a6e06fc06ed0adfed84385ab6357245a46a37 (diff) |
Fix some issues with GifRecorder
- Try to ensure that the correct region is recorded. Sometimes, on
specific machines, I've seen the region being offset by a vertical
distance of 24 pixels (the size of the title bar).
- Try to ensure that the window has time to render before we start
recording with byzanz.
Change-Id: Ia4c354ba436ed21af0e83303a98faa616be63325
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r-- | tests/manual/gifs/data/qtlabscontrols-switch.qml | 4 | ||||
-rw-r--r-- | tests/manual/gifs/gifrecorder.cpp | 9 | ||||
-rw-r--r-- | tests/manual/gifs/tst_gifs.cpp | 4 |
3 files changed, 11 insertions, 6 deletions
diff --git a/tests/manual/gifs/data/qtlabscontrols-switch.qml b/tests/manual/gifs/data/qtlabscontrols-switch.qml index 3968b60f..f6067c1b 100644 --- a/tests/manual/gifs/data/qtlabscontrols-switch.qml +++ b/tests/manual/gifs/data/qtlabscontrols-switch.qml @@ -43,8 +43,8 @@ import QtQuick.Window 2.0 import Qt.labs.controls 1.0 Window { - width: theSwitch.width - height: theSwitch.height + width: 100 + height: 50 visible: true Switch { diff --git a/tests/manual/gifs/gifrecorder.cpp b/tests/manual/gifs/gifrecorder.cpp index 617ce506..3ba33552 100644 --- a/tests/manual/gifs/gifrecorder.cpp +++ b/tests/manual/gifs/gifrecorder.cpp @@ -183,6 +183,10 @@ void GifRecorder::start() mWindow->show(); mWindow->requestActivate(); QVERIFY(QTest::qWaitForWindowActive(mWindow, 500)); + QVERIFY(QTest::qWaitForWindowExposed(mWindow, 500)); + // For some reason, whatever is behind the window is sometimes + // in the recording, so add this delay to be extra sure that it isn't. + QTest::qWait(200); if (mOutputFileBaseName.isEmpty()) { mOutputFileBaseName = mOutputDir.absoluteFilePath(mQmlInputFileName); @@ -198,11 +202,12 @@ void GifRecorder::start() mByzanzOutputFileName.append(QLatin1String(".gif")); } + const QPoint globalWindowPos = mWindow->mapToGlobal(QPoint(0, 0)); QString args = QLatin1String("-d %1 -v %2 -x %3 -y %4 -w %5 -h %6 %7"); args = args.arg(QString::number(mRecordingDuration)) .arg(mRecordCursor ? QStringLiteral("-c") : QString()) - .arg(QString::number(mWindow->x())) - .arg(QString::number(mWindow->y())) + .arg(QString::number(globalWindowPos.x())) + .arg(QString::number(globalWindowPos.y())) .arg(QString::number(mWindow->width())) .arg(QString::number(mWindow->height())) .arg(mByzanzOutputFileName); diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp index bd0cc61f..7f2a985c 100644 --- a/tests/manual/gifs/tst_gifs.cpp +++ b/tests/manual/gifs/tst_gifs.cpp @@ -165,7 +165,7 @@ void tst_Gifs::slider() GifRecorder gifRecorder; gifRecorder.setDataDirPath(dataDirPath); gifRecorder.setOutputDir(outputDir); - gifRecorder.setRecordingDuration(4); + gifRecorder.setRecordingDuration(5); gifRecorder.setHighQuality(true); gifRecorder.setQmlFileName("qtlabscontrols-slider.qml"); @@ -202,7 +202,7 @@ void tst_Gifs::rangeSlider() GifRecorder gifRecorder; gifRecorder.setDataDirPath(dataDirPath); gifRecorder.setOutputDir(outputDir); - gifRecorder.setRecordingDuration(6); + gifRecorder.setRecordingDuration(7); gifRecorder.setHighQuality(true); gifRecorder.setQmlFileName("qtlabscontrols-rangeslider.qml"); |