diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2012-10-05 14:03:19 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-31 09:33:44 (GMT) |
commit | 524394e37c594807ed874f4926bf13af990358d1 (patch) | |
tree | afa93f597e96218ca023b6a213bf6598c126135b /tools | |
parent | e6b7178bc2e62a37b4737695bced1b46bced9215 (diff) | |
download | Qt-524394e37c594807ed874f4926bf13af990358d1.zip Qt-524394e37c594807ed874f4926bf13af990358d1.tar.gz Qt-524394e37c594807ed874f4926bf13af990358d1.tar.bz2 |
Make the examples test for QtDeclarative pass.
- Fix check to indicate immediate errors, skip the loading
state (using QTRY_VERIFY from shared/utils.h)
and check for errors after loading again.
- Exclude all broken examples.
- Exclude shaders if import path is missing or OpenGL is
not present.
- Exclude Mac .app folders
- Fix the DeclarativeViewer to check for the presence
of the ImageMagick and ffmpeg executables only once,
reducing test time.
- Do not check for ImageMagick by running its command
line tool 'convert' on Windows, since Windows
has a tool of the same name that converts file
systems (!).
- Fix doc snippets to load correctly.
Task-number: QTQAINFRA-428
Change-Id: Icc0a983bc42857b41ab1d9e93336f8265bfbec36
Reviewed-by: Janne Anttila <janne.anttila@digia.com>
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Reviewed-by: Christopher Adams <chris.adams@qinetic.com.au>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qml/qmlruntime.cpp | 49 | ||||
-rw-r--r-- | tools/qml/qmlruntime.h | 3 |
2 files changed, 37 insertions, 15 deletions
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 397e2ae..b0aa7b4 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -600,10 +600,30 @@ QString QDeclarativeViewer::getVideoFileName() return QFileDialog::getSaveFileName(this, title, QString(), types.join(QLatin1String(";; "))); } +// Check for presence of ImageMagick by launching its command line +// convert tool except on Windows, where convert.exe is a file system converter. +static bool senseImageMagick() +{ +#ifdef Q_OS_WIN + return false; +#else + static int imageMagickFound = -1; + if (imageMagickFound == -1) { + QProcess proc; + proc.start(QLatin1String("convert"), QStringList(QLatin1String("-h"))); + imageMagickFound = proc.waitForStarted() && proc.waitForFinished(2000) + && proc.readAllStandardOutput().contains("ImageMagick") ? + 1 : 0; + } + return imageMagickFound != 0; +#endif +} + QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags) , loggerWindow(new LoggerWidget(this)) , frame_stream(0) + , convertAvailable(senseImageMagick()) , rotateAction(0) , orientation(0) , showWarningsWindow(0) @@ -628,7 +648,6 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) recdlg = new RecordingDialog(this); connect(recdlg->pickfile, SIGNAL(clicked()), this, SLOT(pickRecordingFile())); senseFfmpeg(); - senseImageMagick(); if (!ffmpegAvailable) recdlg->showffmpegOptions(false); if (!ffmpegAvailable && !convertAvailable) @@ -1221,23 +1240,27 @@ bool QDeclarativeViewer::event(QEvent *event) return QWidget::event(event); } -void QDeclarativeViewer::senseImageMagick() +// Detect ffmpeg, return its help string. +static inline QString detectFfmpeg() { - QProcess proc; - proc.start(QLatin1String("convert"), QStringList() << QLatin1String("-h")); - proc.waitForFinished(2000); - QString help = QString::fromAscii(proc.readAllStandardOutput()); - convertAvailable = help.contains(QLatin1String("ImageMagick")); + static QString ffmpegHelp; + if (ffmpegHelp.isNull()) { + QProcess proc; + proc.start(QLatin1String("ffmpeg"), QStringList(QLatin1String("-h"))); + if (proc.waitForStarted() && proc.waitForFinished(2000)) { + ffmpegHelp = QString::fromLocal8Bit(proc.readAllStandardOutput()); + } else { + ffmpegHelp = QLatin1String(""); + } + } + return ffmpegHelp; } void QDeclarativeViewer::senseFfmpeg() { - QProcess proc; - proc.start(QLatin1String("ffmpeg"), QStringList() << QLatin1String("-h")); - proc.waitForFinished(2000); - QString ffmpegHelp = QString::fromAscii(proc.readAllStandardOutput()); + const QString ffmpegHelp = detectFfmpeg(); ffmpegAvailable = ffmpegHelp.contains(QLatin1String("-s ")); - ffmpegHelp = tr("Video recording uses ffmpeg:") + QLatin1String("\n\n") + ffmpegHelp; + const QString text = tr("Video recording uses ffmpeg:") + QLatin1String("\n\n") + ffmpegHelp; QDialog *d = new QDialog(recdlg); QVBoxLayout *l = new QVBoxLayout(d); @@ -1245,7 +1268,7 @@ void QDeclarativeViewer::senseFfmpeg() QFont f = b->font(); f.setFamily(QLatin1String("courier")); b->setFont(f); - b->setText(ffmpegHelp); + b->setText(text); l->addWidget(b); d->setLayout(l); ffmpegHelpWindow = d; diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index 2fd5f96..76674d0 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -174,11 +174,10 @@ private: QAction *recordAction; RecordingDialog *recdlg; - void senseImageMagick(); void senseFfmpeg(); QWidget *ffmpegHelpWindow; bool ffmpegAvailable; - bool convertAvailable; + const bool convertAvailable; QAction *rotateAction; QActionGroup *orientation; |