summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/qanimation
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-02-08 13:01:08 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-02-08 15:03:39 (GMT)
commit020830966e08239854ac207ec28663a80c6e0647 (patch)
tree38cec073cf32745aefac3803d1e0859f32d3c74d /tests/benchmarks/qanimation
parent43a9c48554579d76e1f1267fbd70f488f22fd408 (diff)
downloadQt-020830966e08239854ac207ec28663a80c6e0647.zip
Qt-020830966e08239854ac207ec28663a80c6e0647.tar.gz
Qt-020830966e08239854ac207ec28663a80c6e0647.tar.bz2
Restructure tests/benchmarks directory.
We follow the same structure as used in the src directory. This makes it easier to navigate through the jungel, especially now that we are going to add functional tests etc.
Diffstat (limited to 'tests/benchmarks/qanimation')
-rw-r--r--tests/benchmarks/qanimation/dummyanimation.cpp61
-rw-r--r--tests/benchmarks/qanimation/dummyanimation.h60
-rw-r--r--tests/benchmarks/qanimation/dummyobject.cpp66
-rw-r--r--tests/benchmarks/qanimation/dummyobject.h64
-rw-r--r--tests/benchmarks/qanimation/main.cpp191
-rw-r--r--tests/benchmarks/qanimation/qanimation.pro18
-rw-r--r--tests/benchmarks/qanimation/rectanimation.cpp94
-rw-r--r--tests/benchmarks/qanimation/rectanimation.h70
8 files changed, 0 insertions, 624 deletions
diff --git a/tests/benchmarks/qanimation/dummyanimation.cpp b/tests/benchmarks/qanimation/dummyanimation.cpp
deleted file mode 100644
index f79cc5b..0000000
--- a/tests/benchmarks/qanimation/dummyanimation.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "dummyanimation.h"
-#include "dummyobject.h"
-
-
-DummyAnimation::DummyAnimation(DummyObject *d) : m_dummy(d)
-{
-}
-
-void DummyAnimation::updateCurrentValue(const QVariant &value)
-{
- if (state() == Stopped)
- return;
- if (m_dummy)
- m_dummy->setRect(value.toRect());
-}
-
-void DummyAnimation::updateState(State state)
-{
- Q_UNUSED(state);
-}
diff --git a/tests/benchmarks/qanimation/dummyanimation.h b/tests/benchmarks/qanimation/dummyanimation.h
deleted file mode 100644
index 1df76be..0000000
--- a/tests/benchmarks/qanimation/dummyanimation.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#ifndef _DUMMYANIMATION_H__
-
-class DummyObject;
-
-class DummyAnimation : public QVariantAnimation
-{
-public:
- DummyAnimation(DummyObject *d);
-
- void updateCurrentValue(const QVariant &value);
- void updateState(State state);
-
-private:
- DummyObject *m_dummy;
-};
-
-#endif
diff --git a/tests/benchmarks/qanimation/dummyobject.cpp b/tests/benchmarks/qanimation/dummyobject.cpp
deleted file mode 100644
index 2b66cda..0000000
--- a/tests/benchmarks/qanimation/dummyobject.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "dummyobject.h"
-
-DummyObject::DummyObject()
-{
-}
-
-QRect DummyObject::rect() const
-{
- return m_rect;
-}
-
-void DummyObject::setRect(const QRect &r)
-{
- m_rect = r;
-}
-
-float DummyObject::opacity() const
-{
- return m_opacity;
-}
-
-void DummyObject::setOpacity(float o)
-{
- m_opacity = o;
-}
diff --git a/tests/benchmarks/qanimation/dummyobject.h b/tests/benchmarks/qanimation/dummyobject.h
deleted file mode 100644
index 31614fd..0000000
--- a/tests/benchmarks/qanimation/dummyobject.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#ifndef _DUMMYOBJECT_H__
-
-class DummyObject : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QRect rect READ rect WRITE setRect)
- Q_PROPERTY(float opacity READ opacity WRITE setOpacity)
-public:
- DummyObject();
- QRect rect() const;
- void setRect(const QRect &r);
- float opacity() const;
- void setOpacity(float);
-
-private:
- QRect m_rect;
- float m_opacity;
-};
-
-
-#endif
diff --git a/tests/benchmarks/qanimation/main.cpp b/tests/benchmarks/qanimation/main.cpp
deleted file mode 100644
index 8b9884e..0000000
--- a/tests/benchmarks/qanimation/main.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <qtest.h>
-
-#include "dummyobject.h"
-#include "dummyanimation.h"
-#include "rectanimation.h"
-
-#define ITERATION_COUNT 10e3
-
-class tst_qanimation : public QObject
-{
- Q_OBJECT
-private slots:
- void itemPropertyAnimation();
- void itemPropertyAnimation_data() { data();}
- void dummyAnimation();
- void dummyAnimation_data() { data();}
- void dummyPropertyAnimation();
- void dummyPropertyAnimation_data() { data();}
- void rectAnimation();
- void rectAnimation_data() { data();}
-
- void floatAnimation_data() { data(); }
- void floatAnimation();
-
-private:
- void data();
-};
-
-
-void tst_qanimation::data()
-{
- QTest::addColumn<bool>("started");
- QTest::newRow("NotRunning") << false;
- QTest::newRow("Running") << true;
-}
-
-void tst_qanimation::itemPropertyAnimation()
-{
- QFETCH(bool, started);
- QGraphicsWidget item;
-
- //then the property animation
- {
- QPropertyAnimation anim(&item, "pos");
- anim.setDuration(ITERATION_COUNT);
- anim.setStartValue(QPointF(0,0));
- anim.setEndValue(QPointF(ITERATION_COUNT,ITERATION_COUNT));
- if (started)
- anim.start();
- QBENCHMARK {
- for(int i = 0; i < ITERATION_COUNT; ++i) {
- anim.setCurrentTime(i);
- }
- }
- }
-
-}
-
-void tst_qanimation::dummyAnimation()
-{
- QFETCH(bool, started);
- DummyObject dummy;
-
- //first the dummy animation
- {
- DummyAnimation anim(&dummy);
- anim.setDuration(ITERATION_COUNT);
- anim.setStartValue(QRect(0, 0, 0, 0));
- anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT));
- if (started)
- anim.start();
- QBENCHMARK {
- for(int i = 0; i < anim.duration(); ++i) {
- anim.setCurrentTime(i);
- }
- }
- }
-}
-
-void tst_qanimation::dummyPropertyAnimation()
-{
- QFETCH(bool, started);
- DummyObject dummy;
-
- //then the property animation
- {
- QPropertyAnimation anim(&dummy, "rect");
- anim.setDuration(ITERATION_COUNT);
- anim.setStartValue(QRect(0, 0, 0, 0));
- anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT));
- if (started)
- anim.start();
- QBENCHMARK {
- for(int i = 0; i < ITERATION_COUNT; ++i) {
- anim.setCurrentTime(i);
- }
- }
- }
-}
-
-void tst_qanimation::rectAnimation()
-{
- //this is the simplest animation you can do
- QFETCH(bool, started);
- DummyObject dummy;
-
- //then the property animation
- {
- RectAnimation anim(&dummy);
- anim.setDuration(ITERATION_COUNT);
- anim.setStartValue(QRect(0, 0, 0, 0));
- anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT));
- if (started)
- anim.start();
- QBENCHMARK {
- for(int i = 0; i < ITERATION_COUNT; ++i) {
- anim.setCurrentTime(i);
- }
- }
- }
-}
-
-void tst_qanimation::floatAnimation()
-{
- //this is the simplest animation you can do
- QFETCH(bool, started);
- DummyObject dummy;
-
- //then the property animation
- {
- QPropertyAnimation anim(&dummy, "opacity");
- anim.setDuration(ITERATION_COUNT);
- anim.setStartValue(0.f);
- anim.setEndValue(1.f);
- if (started)
- anim.start();
- QBENCHMARK {
- for(int i = 0; i < ITERATION_COUNT; ++i) {
- anim.setCurrentTime(i);
- }
- }
- }
-}
-
-
-
-QTEST_MAIN(tst_qanimation)
-
-#include "main.moc"
diff --git a/tests/benchmarks/qanimation/qanimation.pro b/tests/benchmarks/qanimation/qanimation.pro
deleted file mode 100644
index 55cd75e..0000000
--- a/tests/benchmarks/qanimation/qanimation.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-load(qttest_p4)
-TEMPLATE = app
-TARGET = tst_qanimation
-DEPENDPATH += .
-INCLUDEPATH += .
-
-CONFIG += release
-#CONFIG += debug
-
-
-SOURCES += main.cpp \
- dummyobject.cpp \
- dummyanimation.cpp \
- rectanimation.cpp
-
-HEADERS += dummyobject.h \
- dummyanimation.h \
- rectanimation.h
diff --git a/tests/benchmarks/qanimation/rectanimation.cpp b/tests/benchmarks/qanimation/rectanimation.cpp
deleted file mode 100644
index e6d7a7e..0000000
--- a/tests/benchmarks/qanimation/rectanimation.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "rectanimation.h"
-#include "dummyobject.h"
-
-static inline int interpolateInteger(int from, int to, qreal progress)
-{
- return from + (to - from) * progress;
-}
-
-
-RectAnimation::RectAnimation(DummyObject *obj) : m_object(obj), m_dura(250)
-{
-}
-
-void RectAnimation::setEndValue(const QRect &rect)
-{
- m_end = rect;
-}
-
-void RectAnimation::setStartValue(const QRect &rect)
-{
- m_start = rect;
-}
-
-void RectAnimation::setDuration(int d)
-{
- m_dura = d;
-}
-
-int RectAnimation::duration() const
-{
- return m_dura;
-}
-
-
-void RectAnimation::updateCurrentTime(int currentTime)
-{
- qreal progress = m_easing.valueForProgress( currentTime / qreal(m_dura) );
- QRect now;
- now.setCoords(interpolateInteger(m_start.left(), m_end.left(), progress),
- interpolateInteger(m_start.top(), m_end.top(), progress),
- interpolateInteger(m_start.right(), m_end.right(), progress),
- interpolateInteger(m_start.bottom(), m_end.bottom(), progress));
-
- bool changed = (now != m_current);
- if (changed)
- m_current = now;
-
- if (state() == Stopped)
- return;
-
- if (m_object)
- m_object->setRect(m_current);
-}
diff --git a/tests/benchmarks/qanimation/rectanimation.h b/tests/benchmarks/qanimation/rectanimation.h
deleted file mode 100644
index 42b9376..0000000
--- a/tests/benchmarks/qanimation/rectanimation.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#ifndef _RECTANIMATION_H__
-
-class DummyObject;
-
-//this class is even simpler than the dummy
-//and uses no QVariant at all
-class RectAnimation : public QAbstractAnimation
-{
-public:
- RectAnimation(DummyObject *obj);
-
- void setEndValue(const QRect &rect);
- void setStartValue(const QRect &rect);
-
- void setDuration(int d);
- int duration() const;
-
- virtual void updateCurrentTime(int currentTime);
-
-private:
- DummyObject *m_object;
- QEasingCurve m_easing;
- QRect m_start, m_end, m_current;
- int m_dura;
-};
-
-#endif