diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2009-12-18 18:08:06 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2009-12-18 18:08:06 (GMT) |
commit | ac3a1e3180b10948f919645d683d967e513f8273 (patch) | |
tree | 38911f801d94a9ca908496a554aae5a0d8bfa8fd /tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp | |
parent | 99e1dc904eab4b38c90803f13d73f90b9c048920 (diff) | |
parent | f708b248aec810a1dcad1f13e1c16390244c9834 (diff) | |
download | Qt-ac3a1e3180b10948f919645d683d967e513f8273.zip Qt-ac3a1e3180b10948f919645d683d967e513f8273.tar.gz Qt-ac3a1e3180b10948f919645d683d967e513f8273.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fixed QPixmap::load() to not modify referenced copies.
Fixes bug when using AnchorUnderMouse for GraphicsView transformation.
Make the layout{,AboutToBe}Changed signals in the QSortFilterProxyModel match its source.
Make sure mappings are created for columns when indexes newly become parents.
NEON configure detection and initial blend function implementations.
Optimize QThreadStorage with QVector
Add Q_OBJECT to QBalloonTip so it can be intreospected by styles.
Diffstat (limited to 'tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp')
-rw-r--r-- | tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp b/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp new file mode 100644 index 0000000..c00bf5a --- /dev/null +++ b/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2009 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 <qtest.h> +#include <QtCore> + +//TESTED_FILES= + +QThreadStorage<int *> dummy[8]; + +QThreadStorage<QString *> tls1; + +class tst_QThreadStorage : public QObject +{ + Q_OBJECT + +public: + tst_QThreadStorage(); + virtual ~tst_QThreadStorage(); + +public slots: + void init(); + void cleanup(); + +private slots: + void construct(); + void get(); + void set(); +}; + +tst_QThreadStorage::tst_QThreadStorage() +{ +} + +tst_QThreadStorage::~tst_QThreadStorage() +{ +} + +void tst_QThreadStorage::init() +{ + dummy[1].setLocalData(new int(5)); + dummy[2].setLocalData(new int(4)); + dummy[3].setLocalData(new int(3)); + tls1.setLocalData(new QString()); +} + +void tst_QThreadStorage::cleanup() +{ +} + +void tst_QThreadStorage::construct() +{ + QBENCHMARK { + QThreadStorage<int *> ts; + } +} + + +void tst_QThreadStorage::get() +{ + QThreadStorage<int *> ts; + ts.setLocalData(new int(45)); + + int count = 0; + QBENCHMARK { + int *i = ts.localData(); + count += *i; + } + ts.setLocalData(0); +} + +void tst_QThreadStorage::set() +{ + QThreadStorage<int *> ts; + + int count = 0; + QBENCHMARK { + ts.setLocalData(new int(count)); + count++; + } + ts.setLocalData(0); +} + + +QTEST_MAIN(tst_QThreadStorage) +#include "tst_qthreadstorage.moc" |