aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/gifs/gifrecorder.h
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2015-07-23 13:39:51 +0200
committerMitch Curtis <mitch.curtis@theqtcompany.com>2015-08-07 08:19:47 +0000
commitbc42a1e691927049e9691cc8403a993e23bc4a23 (patch)
treef212633555763234b80f5df1b587013fd0033997 /tests/manual/gifs/gifrecorder.h
parent293fc5e8f7df1b60a07d2e7e489e57059bb021bc (diff)
Add gifs manual test.
This is similar to the snippets auto test, in that it's more of a utility than a test. In this case, the testing provides a convenient way to run several recording "jobs" at once, as well as feed the app with generated input events. The test is different to the snippets auto test in that it: - Tests QML code that isn't shown to users; only the GIFs are displayed in the documentation. - Requires interaction to produce its output, which is achieved with mousePress(), etc. For this reason, it also can't just iterate over the list of QML files. - Requires byzanz to be installed in order to record the GIFs. The test also comes with EventCapturer, an event-filter based class that records mouse movements and generates compact C++ code for use with the GifRecorder. There is one known issue, which is a bug in byzanz-record: it sometimes decides to record the mouse cursor even if you didn't ask it to. Change-Id: Icaaa4f37c8d34a813e36901fd187d84e4f250d33 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests/manual/gifs/gifrecorder.h')
-rw-r--r--tests/manual/gifs/gifrecorder.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/tests/manual/gifs/gifrecorder.h b/tests/manual/gifs/gifrecorder.h
new file mode 100644
index 00000000..546c8669
--- /dev/null
+++ b/tests/manual/gifs/gifrecorder.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GIFRECORDER_H
+#define GIFRECORDER_H
+
+#include <QObject>
+#include <QProcess>
+#include <QQuickView>
+#include <QDir>
+#include <QString>
+
+class GifRecorder : public QObject
+{
+ Q_OBJECT
+
+public:
+ GifRecorder();
+
+ void setRecordingDuration(int duration);
+ void setRecordCursor(bool recordCursor);
+ void setDataDirPath(const QString &path);
+ void setOutputDir(const QDir &dir);
+ void setOutputFileName(const QString &fileName);
+ void setQmlFileName(const QString &fileName);
+ void setView(QQuickView *mView);
+
+ void start();
+ bool hasStarted() const;
+ void waitForFinish();
+
+private slots:
+ void onError();
+ void onFinished();
+
+private:
+ const QString mProcessName;
+ QProcess mProcess;
+ int mRecordingDuration;
+ bool mRecordCursor;
+ QString mDataDirPath;
+ QDir mOutputDir;
+ QString mOutputFileName;
+ QString mQmlInputFileName;
+ QQuickView *mView;
+ bool mStarted;
+ bool mFinished;
+};
+
+#endif // GIFRECORDER_H