diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-30 04:15:22 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-30 04:15:22 (GMT) |
commit | 45cc1ea534640cb492bd00405bf8fcd5dbfbcf5c (patch) | |
tree | 9bbf0cca7e26abfab486c658cc6d4005fd4e74b8 /tools/qmlviewer/qfxtester.cpp | |
parent | f37e9d787bd418d8f75997a8d46c1c42e842c673 (diff) | |
download | Qt-45cc1ea534640cb492bd00405bf8fcd5dbfbcf5c.zip Qt-45cc1ea534640cb492bd00405bf8fcd5dbfbcf5c.tar.gz Qt-45cc1ea534640cb492bd00405bf8fcd5dbfbcf5c.tar.bz2 |
Rename QFx classes to QmlGraphics
Diffstat (limited to 'tools/qmlviewer/qfxtester.cpp')
-rw-r--r-- | tools/qmlviewer/qfxtester.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/tools/qmlviewer/qfxtester.cpp b/tools/qmlviewer/qfxtester.cpp index 0ccc9c0..a105701 100644 --- a/tools/qmlviewer/qfxtester.cpp +++ b/tools/qmlviewer/qfxtester.cpp @@ -24,12 +24,12 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, VisualTest, QFxVisualTest); -QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Frame, QFxVisualTestFrame); -QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Mouse, QFxVisualTestMouse); -QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Key, QFxVisualTestKey); +QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, VisualTest, QmlGraphicsVisualTest); +QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Frame, QmlGraphicsVisualTestFrame); +QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Mouse, QmlGraphicsVisualTestMouse); +QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Key, QmlGraphicsVisualTestKey); -QFxTester::QFxTester(const QString &script, QmlViewer::ScriptOptions opts, +QmlGraphicsTester::QmlGraphicsTester(const QString &script, QmlViewer::ScriptOptions opts, QmlView *parent) : QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts), testscript(0), hasCompleted(false), hasFailed(false) @@ -42,7 +42,7 @@ QFxTester::QFxTester(const QString &script, QmlViewer::ScriptOptions opts, start(); } -QFxTester::~QFxTester() +QmlGraphicsTester::~QmlGraphicsTester() { if (!hasFailed && options & QmlViewer::Record && @@ -50,26 +50,26 @@ QFxTester::~QFxTester() save(); } -int QFxTester::duration() const +int QmlGraphicsTester::duration() const { return -1; } -void QFxTester::addMouseEvent(Destination dest, QMouseEvent *me) +void QmlGraphicsTester::addMouseEvent(Destination dest, QMouseEvent *me) { MouseEvent e(me); e.destination = dest; m_mouseEvents << e; } -void QFxTester::addKeyEvent(Destination dest, QKeyEvent *ke) +void QmlGraphicsTester::addKeyEvent(Destination dest, QKeyEvent *ke) { KeyEvent e(ke); e.destination = dest; m_keyEvents << e; } -bool QFxTester::eventFilter(QObject *o, QEvent *e) +bool QmlGraphicsTester::eventFilter(QObject *o, QEvent *e) { if (!filterEvents) return false; @@ -100,7 +100,7 @@ bool QFxTester::eventFilter(QObject *o, QEvent *e) return false; } -void QFxTester::executefailure() +void QmlGraphicsTester::executefailure() { hasFailed = true; @@ -108,7 +108,7 @@ void QFxTester::executefailure() exit(-1); } -void QFxTester::imagefailure() +void QmlGraphicsTester::imagefailure() { hasFailed = true; @@ -116,7 +116,7 @@ void QFxTester::imagefailure() exit(-1); } -void QFxTester::complete() +void QmlGraphicsTester::complete() { if (options & QmlViewer::ExitOnComplete) QApplication::exit(hasFailed?-1:0); @@ -129,17 +129,17 @@ void QFxTester::complete() qWarning("Script playback complete"); } -void QFxTester::run() +void QmlGraphicsTester::run() { QmlComponent c(m_view->engine(), m_script + QLatin1String(".qml")); - testscript = qobject_cast<QFxVisualTest *>(c.create()); + testscript = qobject_cast<QmlGraphicsVisualTest *>(c.create()); if (testscript) testscript->setParent(this); else executefailure(); testscriptidx = 0; } -void QFxTester::save() +void QmlGraphicsTester::save() { QString filename = m_script + QLatin1String(".qml"); QFileInfo filenameInfo(filename); @@ -206,9 +206,9 @@ void QFxTester::save() file.close(); } -void QFxTester::updateCurrentTime(int msec) +void QmlGraphicsTester::updateCurrentTime(int msec) { - QFxItemPrivate::setConsistentTime(msec); + QmlGraphicsItemPrivate::setConsistentTime(msec); QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32); @@ -268,17 +268,17 @@ void QFxTester::updateCurrentTime(int msec) QObject *event = testscript->event(testscriptidx); - if (QFxVisualTestFrame *frame = qobject_cast<QFxVisualTestFrame *>(event)) { + if (QmlGraphicsVisualTestFrame *frame = qobject_cast<QmlGraphicsVisualTestFrame *>(event)) { if (frame->msec() < msec) { if (options & QmlViewer::TestImages) { - qWarning() << "QFxTester: Extra frame. Seen:" + qWarning() << "QmlGraphicsTester: Extra frame. Seen:" << msec << "Expected:" << frame->msec(); imagefailure(); } } else if (frame->msec() == msec) { if (frame->hash().toUtf8() != fe.hash.toHex()) { if (options & QmlViewer::TestImages) { - qWarning() << "QFxTester: Mismatched frame hash. Seen:" + qWarning() << "QmlGraphicsTester: Mismatched frame hash. Seen:" << fe.hash.toHex() << "Expected:" << frame->hash().toUtf8(); imagefailure(); @@ -292,13 +292,13 @@ void QFxTester::updateCurrentTime(int msec) QImage goodImage(frame->image().toLocalFile()); if (goodImage != img) { QString reject(frame->image().toLocalFile() + ".reject.png"); - qWarning() << "QFxTester: Image mismatch. Reject saved to:" + qWarning() << "QmlGraphicsTester: Image mismatch. Reject saved to:" << reject; img.save(reject); imagefailure(); } } - } else if (QFxVisualTestMouse *mouse = qobject_cast<QFxVisualTestMouse *>(event)) { + } else if (QmlGraphicsVisualTestMouse *mouse = qobject_cast<QmlGraphicsVisualTestMouse *>(event)) { QPoint pos(mouse->x(), mouse->y()); QPoint globalPos = m_view->mapToGlobal(QPoint(0, 0)) + pos; QMouseEvent event((QEvent::Type)mouse->type(), pos, globalPos, (Qt::MouseButton)mouse->button(), (Qt::MouseButtons)mouse->buttons(), (Qt::KeyboardModifiers)mouse->modifiers()); @@ -313,7 +313,7 @@ void QFxTester::updateCurrentTime(int msec) me.destination = ViewPort; } m_savedMouseEvents.append(me); - } else if (QFxVisualTestKey *key = qobject_cast<QFxVisualTestKey *>(event)) { + } else if (QmlGraphicsVisualTestKey *key = qobject_cast<QmlGraphicsVisualTestKey *>(event)) { QKeyEvent event((QEvent::Type)key->type(), key->key(), (Qt::KeyboardModifiers)key->modifiers(), QString::fromUtf8(QByteArray::fromHex(key->text().toUtf8())), key->autorep(), key->count()); |