| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | /**************************************************************************
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							|  |  |  | ** This file is part of Qt Creator | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-01-11 16:28:15 +01:00
										 |  |  | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** Contact: Nokia Corporation (info@qt.nokia.com) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2008-12-02 14:17:16 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | ** GNU Lesser General Public License Usage | 
					
						
							| 
									
										
										
										
											2008-12-02 14:17:16 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** 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.
 | 
					
						
							| 
									
										
										
										
											2008-12-02 14:17:16 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** In addition, as a special exception, Nokia gives you certain additional | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** rights. These rights are described in the Nokia Qt LGPL Exception | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** Other Usage | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Alternatively, this file may be used in accordance with the terms and | 
					
						
							|  |  |  | ** conditions contained in a signed written agreement between you and Nokia. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** If you have questions regarding the use of this file, please contact | 
					
						
							| 
									
										
										
										
											2011-07-05 18:26:01 +02:00
										 |  |  | ** Nokia at info@qt.nokia.com. | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | **************************************************************************/ | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-04 13:16:10 +01:00
										 |  |  | //#include <complex>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //template <typename T> class B;  B foo() {}
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-07 09:10:37 +02:00
										 |  |  | #include "../simple/deep/deep/simple_gdbtest_app.h"
 | 
					
						
							| 
									
										
										
										
											2011-03-28 15:34:37 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <QtCore/QDebug>
 | 
					
						
							| 
									
										
										
										
											2009-09-03 09:15:24 +02:00
										 |  |  | #include <QtCore/QDateTime>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <QtCore/QDir>
 | 
					
						
							|  |  |  | #include <QtCore/QHash>
 | 
					
						
							|  |  |  | #include <QtCore/QLibrary>
 | 
					
						
							| 
									
										
										
										
											2009-01-08 11:02:04 +01:00
										 |  |  | #include <QtCore/QLinkedList>
 | 
					
						
							|  |  |  | #include <QtCore/QList>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <QtCore/QMap>
 | 
					
						
							|  |  |  | #include <QtCore/QPointer>
 | 
					
						
							| 
									
										
										
										
											2011-03-04 19:26:11 +01:00
										 |  |  | #include <QtCore/QProcess>
 | 
					
						
							| 
									
										
										
										
											2011-03-29 09:32:36 +02:00
										 |  |  | #include <QtCore/QRegExp>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <QtCore/QString>
 | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  | #include <QtCore/QStringList>
 | 
					
						
							| 
									
										
										
										
											2010-05-27 18:23:51 +02:00
										 |  |  | #include <QtCore/QSettings>
 | 
					
						
							| 
									
										
										
										
											2009-08-28 09:44:11 +02:00
										 |  |  | #include <QtCore/QStack>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <QtCore/QThread>
 | 
					
						
							|  |  |  | #include <QtCore/QVariant>
 | 
					
						
							|  |  |  | #include <QtCore/QVector>
 | 
					
						
							| 
									
										
										
										
											2010-04-21 19:25:09 +02:00
										 |  |  | #include <QtCore/QUrl>
 | 
					
						
							| 
									
										
										
										
											2009-06-25 15:00:57 +02:00
										 |  |  | #if QT_VERSION >= 0x040500
 | 
					
						
							| 
									
										
										
										
											2009-04-07 13:50:21 +02:00
										 |  |  | #include <QtCore/QSharedPointer>
 | 
					
						
							| 
									
										
										
										
											2009-06-25 15:00:57 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <QtGui/QApplication>
 | 
					
						
							|  |  |  | #include <QtGui/QAction>
 | 
					
						
							|  |  |  | #include <QtGui/QColor>
 | 
					
						
							|  |  |  | #include <QtGui/QFont>
 | 
					
						
							|  |  |  | #include <QtGui/QLabel>
 | 
					
						
							| 
									
										
										
										
											2010-10-08 14:26:44 +02:00
										 |  |  | //#include <QtGui/private/qfixed_p.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <QtGui/QPainter>
 | 
					
						
							|  |  |  | #include <QtGui/QPainterPath>
 | 
					
						
							| 
									
										
										
										
											2010-06-30 15:20:16 +02:00
										 |  |  | #include <QtGui/QRegion>
 | 
					
						
							| 
									
										
										
										
											2009-06-03 12:46:55 +02:00
										 |  |  | #include <QtGui/QStandardItemModel>
 | 
					
						
							| 
									
										
										
										
											2010-09-28 09:35:59 +02:00
										 |  |  | #include <QtGui/QTextCursor>
 | 
					
						
							|  |  |  | #include <QtGui/QTextDocument>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-10 15:17:55 +01:00
										 |  |  | #include <QtScript/QScriptEngine>
 | 
					
						
							|  |  |  | #include <QtScript/QScriptValue>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-29 14:57:15 +02:00
										 |  |  | #include <QtXml/QXmlAttributes>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <QtNetwork/QHostAddress>
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  | #include <QtNetwork/QNetworkRequest>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-16 11:17:00 +01:00
										 |  |  | #include <deque>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <iostream>
 | 
					
						
							| 
									
										
										
										
											2008-12-11 16:10:47 +01:00
										 |  |  | #include <map>
 | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  | #include <list>
 | 
					
						
							| 
									
										
										
										
											2009-03-11 13:31:38 +01:00
										 |  |  | #include <set>
 | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  | #include <stack>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <string>
 | 
					
						
							|  |  |  | #include <vector>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-04 17:14:22 +02:00
										 |  |  | #include <stdarg.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | #define USE_PRIVATE 1
 | 
					
						
							| 
									
										
										
										
											2011-03-07 12:59:26 +01:00
										 |  |  | //#define USE_BOOST 1
 | 
					
						
							| 
									
										
										
										
											2011-05-16 20:04:17 +02:00
										 |  |  | //#define USE_EIGEN 1
 | 
					
						
							| 
									
										
										
										
											2011-03-04 16:49:25 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #if USE_BOOST
 | 
					
						
							| 
									
										
										
										
											2011-03-04 17:22:58 +01:00
										 |  |  | #include <boost/optional.hpp>
 | 
					
						
							| 
									
										
										
										
											2011-03-04 16:49:25 +01:00
										 |  |  | #include <boost/shared_ptr.hpp>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-16 20:04:17 +02:00
										 |  |  | #if USE_EIGEN
 | 
					
						
							|  |  |  | #include <eigen2/Eigen/Core>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | #if USE_PRIVATE
 | 
					
						
							|  |  |  | #include <QtCore/private/qobject_p.h>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-18 10:56:42 +02:00
										 |  |  | #if defined(__GNUC__) && !defined(__llvm__) && !defined(Q_OS_MAC)
 | 
					
						
							| 
									
										
										
										
											2010-04-20 12:06:48 +02:00
										 |  |  | #    define USE_GCC_EXT 1
 | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  | #    undef __DEPRECATED
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:56:55 +01:00
										 |  |  | #    include <ext/hash_set>
 | 
					
						
							| 
									
										
										
										
											2010-04-15 18:28:58 +02:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #ifdef Q_OS_WIN
 | 
					
						
							|  |  |  | #include <windows.h>
 | 
					
						
							| 
									
										
										
										
											2010-04-07 15:23:37 +02:00
										 |  |  | #undef min
 | 
					
						
							|  |  |  | #undef max
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-03 17:34:41 +01:00
										 |  |  | #ifdef __SSE__
 | 
					
						
							| 
									
										
										
										
											2010-10-26 10:40:31 +02:00
										 |  |  | #include <xmmintrin.h>
 | 
					
						
							|  |  |  | #include <stddef.h>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | void dummyStatement(const void *x = 0, const void *y = 0, const void *z = 0) | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Q_UNUSED(x); | 
					
						
							|  |  |  |     Q_UNUSED(y); | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     Q_UNUSED(z); | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2010-01-04 13:16:10 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-21 16:45:23 +02:00
										 |  |  | namespace multibp { | 
					
						
							| 
									
										
										
										
											2010-01-04 13:16:10 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-21 13:00:42 +02:00
										 |  |  |     template <typename T> class Vector | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     public: | 
					
						
							|  |  |  |         explicit Vector(int size) | 
					
						
							|  |  |  |             : m_size(size), m_data(new T[size]) | 
					
						
							| 
									
										
										
										
											2011-06-22 13:16:29 +02:00
										 |  |  |         {} // <=== break here
 | 
					
						
							| 
									
										
										
										
											2011-06-21 13:00:42 +02:00
										 |  |  |         ~Vector() { delete [] m_data; } | 
					
						
							|  |  |  |         int size() const { return m_size; } | 
					
						
							|  |  |  |     private: | 
					
						
							|  |  |  |         int m_size; | 
					
						
							|  |  |  |         T *m_data; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |     int testMultiBp() | 
					
						
							| 
									
										
										
										
											2011-06-21 13:00:42 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |         // Tests multiple breakpoints
 | 
					
						
							| 
									
										
										
										
											2011-06-21 13:00:42 +02:00
										 |  |  |         Vector<int> vi(10); | 
					
						
							|  |  |  |         Vector<float> vf(10); | 
					
						
							|  |  |  |         Vector<double> vd(10); | 
					
						
							|  |  |  |         Vector<char> vc(10); | 
					
						
							|  |  |  |         return vi.size() + vf.size() + vd.size() + vc.size(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-06-21 16:45:23 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | } // namespace multibp
 | 
					
						
							| 
									
										
										
										
											2010-01-18 15:11:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-16 20:04:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | #if USE_PRIVATE
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DerivedObjectPrivate : public QObjectPrivate | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-03-01 15:44:22 +01:00
										 |  |  |     DerivedObjectPrivate() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         m_extraX = 43; | 
					
						
							|  |  |  |         m_extraY.append("xxx"); | 
					
						
							| 
									
										
										
										
											2011-03-01 16:17:17 +01:00
										 |  |  |         m_extraZ = 1; | 
					
						
							| 
									
										
										
										
											2011-03-01 15:44:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     int m_extraX; | 
					
						
							| 
									
										
										
										
											2011-03-01 15:44:22 +01:00
										 |  |  |     QStringList m_extraY; | 
					
						
							| 
									
										
										
										
											2011-03-01 16:17:17 +01:00
										 |  |  |     uint m_extraZ : 1; | 
					
						
							| 
									
										
										
										
											2011-03-01 18:38:30 +01:00
										 |  |  |     bool m_extraA : 1; | 
					
						
							| 
									
										
										
										
											2011-03-01 16:49:41 +01:00
										 |  |  |     bool m_extraB; | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DerivedObject : public QObject | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-03-01 13:25:51 +01:00
										 |  |  |     DerivedObject() | 
					
						
							|  |  |  |        : QObject(*new DerivedObjectPrivate, 0) | 
					
						
							|  |  |  |     {} | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     Q_PROPERTY(int x READ x WRITE setX) | 
					
						
							| 
									
										
										
										
											2011-03-01 15:44:22 +01:00
										 |  |  |     Q_PROPERTY(QStringList y READ y WRITE setY) | 
					
						
							| 
									
										
										
										
											2011-03-01 16:17:17 +01:00
										 |  |  |     Q_PROPERTY(uint z READ z WRITE setZ) | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     int x() const; | 
					
						
							|  |  |  |     void setX(int x); | 
					
						
							| 
									
										
										
										
											2011-03-01 15:44:22 +01:00
										 |  |  |     QStringList y() const; | 
					
						
							|  |  |  |     void setY(QStringList y); | 
					
						
							| 
									
										
										
										
											2011-03-01 16:17:17 +01:00
										 |  |  |     uint z() const; | 
					
						
							|  |  |  |     void setZ(uint z); | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     Q_DECLARE_PRIVATE(DerivedObject) | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DerivedObject::x() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_D(const DerivedObject); | 
					
						
							|  |  |  |     return d->m_extraX; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DerivedObject::setX(int x) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_D(DerivedObject); | 
					
						
							|  |  |  |     d->m_extraX = x; | 
					
						
							| 
									
										
										
										
											2011-03-01 18:38:30 +01:00
										 |  |  |     d->m_extraA = !d->m_extraA; | 
					
						
							|  |  |  |     d->m_extraB = !d->m_extraB; | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-01 15:44:22 +01:00
										 |  |  | QStringList DerivedObject::y() const | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     Q_D(const DerivedObject); | 
					
						
							|  |  |  |     return d->m_extraY; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-01 15:44:22 +01:00
										 |  |  | void DerivedObject::setY(QStringList y) | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     Q_D(DerivedObject); | 
					
						
							|  |  |  |     d->m_extraY = y; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-01 16:17:17 +01:00
										 |  |  | uint DerivedObject::z() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_D(const DerivedObject); | 
					
						
							|  |  |  |     return d->m_extraZ; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DerivedObject::setZ(uint z) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_D(DerivedObject); | 
					
						
							|  |  |  |     d->m_extraZ = z; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-01 16:17:17 +01:00
										 |  |  | struct S | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     uint x : 1; | 
					
						
							|  |  |  |     uint y : 1; | 
					
						
							| 
									
										
										
										
											2011-03-01 18:38:30 +01:00
										 |  |  |     bool c : 1; | 
					
						
							| 
									
										
										
										
											2011-03-01 16:49:41 +01:00
										 |  |  |     bool b; | 
					
						
							|  |  |  |     float f; | 
					
						
							|  |  |  |     double d; | 
					
						
							| 
									
										
										
										
											2011-03-01 18:38:30 +01:00
										 |  |  |     qreal q; | 
					
						
							| 
									
										
										
										
											2011-03-01 16:49:41 +01:00
										 |  |  |     int i; | 
					
						
							| 
									
										
										
										
											2011-03-01 16:17:17 +01:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | void testPrivate() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-01 16:17:17 +01:00
										 |  |  |     S s; | 
					
						
							|  |  |  |     s.x = 1; | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  | #if USE_PRIVATE
 | 
					
						
							|  |  |  |     DerivedObject ob; | 
					
						
							|  |  |  |     ob.setX(23); | 
					
						
							|  |  |  |     ob.setX(25); | 
					
						
							|  |  |  |     ob.setX(26); | 
					
						
							|  |  |  |     ob.setX(63); | 
					
						
							|  |  |  |     ob.setX(32); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-21 13:00:42 +02:00
										 |  |  | namespace nsX { namespace nsY { int z; } } | 
					
						
							| 
									
										
										
										
											2010-01-18 15:11:54 +01:00
										 |  |  | namespace nsXY = nsX::nsY; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int qwert() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return nsXY::z; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | uint qHash(const QMap<int, int> &) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uint qHash(const double & f) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return int(f); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 16:48:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-05 08:46:24 +02:00
										 |  |  | class Foo | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2009-05-05 08:46:24 +02:00
										 |  |  |     Foo(int i = 0) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         : a(i), b(2) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         int s = 1; | 
					
						
							|  |  |  |         int t = 2; | 
					
						
							|  |  |  |         b = 2 + s + t; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							| 
									
										
										
										
											2009-08-31 09:14:04 +02:00
										 |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         a += 1; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-04-16 12:17:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-01 14:33:52 +02:00
										 |  |  |     virtual ~Foo() | 
					
						
							| 
									
										
										
										
											2009-04-16 12:17:01 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         a = 5; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     void doit() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         static QObject ob; | 
					
						
							|  |  |  |         m["1"] = "2"; | 
					
						
							|  |  |  |         h[&ob] = m.begin(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         a += 1; | 
					
						
							|  |  |  |         --b; | 
					
						
							|  |  |  |         //s += 'x';
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     struct Bar { | 
					
						
							|  |  |  |         Bar() : ob(0) {} | 
					
						
							|  |  |  |         QObject *ob; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     int a, b; | 
					
						
							|  |  |  |     char x[6]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     //QString s;
 | 
					
						
							|  |  |  |     typedef QMap<QString, QString> Map; | 
					
						
							|  |  |  |     Map m; | 
					
						
							|  |  |  |     QHash<QObject *, Map::iterator> h; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-29 10:58:09 +02:00
										 |  |  | class X : public Foo | 
					
						
							| 
									
										
										
										
											2009-06-17 16:00:03 +02:00
										 |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     X() { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-29 10:58:09 +02:00
										 |  |  | class XX : virtual public Foo | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     XX() { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-17 16:00:03 +02:00
										 |  |  | class Y : virtual public Foo | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     Y() { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-29 10:58:09 +02:00
										 |  |  | class D : public X, public Y | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int diamond; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | void testArray() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-06-29 10:58:09 +02:00
										 |  |  | #if 1
 | 
					
						
							|  |  |  |     X x; | 
					
						
							|  |  |  |     XX xx; | 
					
						
							|  |  |  |     D diamond; | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(diamond); | 
					
						
							| 
									
										
										
										
											2010-06-29 10:58:09 +02:00
										 |  |  |     Foo *f = &xx; | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(f); | 
					
						
							| 
									
										
										
										
											2010-06-29 10:58:09 +02:00
										 |  |  |     Foo ff; | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(ff); | 
					
						
							| 
									
										
										
										
											2009-11-04 09:21:49 +01:00
										 |  |  |     double d[3][3]; | 
					
						
							|  |  |  |     for (int i = 0; i != 3; ++i) | 
					
						
							|  |  |  |         for (int j = 0; j != 3; ++j) | 
					
						
							|  |  |  |             d[i][j] = i + j; | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(d); | 
					
						
							| 
									
										
										
										
											2010-06-29 10:58:09 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-11-04 09:21:49 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-29 11:10:05 +02:00
										 |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2009-04-03 13:39:14 +02:00
										 |  |  |     char c[20]; | 
					
						
							|  |  |  |     c[0] = 'a'; | 
					
						
							|  |  |  |     c[1] = 'b'; | 
					
						
							|  |  |  |     c[2] = 'c'; | 
					
						
							|  |  |  |     c[3] = 'd'; | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(c); | 
					
						
							| 
									
										
										
										
											2010-06-29 11:10:05 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-04-03 13:39:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-29 10:58:09 +02:00
										 |  |  | #if 1
 | 
					
						
							|  |  |  |     QString s[20]; | 
					
						
							|  |  |  |     s[0] = "a"; | 
					
						
							|  |  |  |     s[1] = "b"; | 
					
						
							|  |  |  |     s[2] = "c"; | 
					
						
							|  |  |  |     s[3] = "d"; | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(s); | 
					
						
							| 
									
										
										
										
											2010-06-29 11:10:05 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-29 11:10:05 +02:00
										 |  |  | #if 1
 | 
					
						
							|  |  |  |     QByteArray b[20]; | 
					
						
							|  |  |  |     b[0] = "a"; | 
					
						
							|  |  |  |     b[1] = "b"; | 
					
						
							|  |  |  |     b[2] = "c"; | 
					
						
							|  |  |  |     b[3] = "d"; | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(b); | 
					
						
							| 
									
										
										
										
											2010-06-29 11:10:05 +02:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     Foo foo[10]; | 
					
						
							|  |  |  |     //for (int i = 0; i != sizeof(foo)/sizeof(foo[0]); ++i) {
 | 
					
						
							|  |  |  |     for (int i = 0; i < 5; ++i) { | 
					
						
							|  |  |  |         foo[i].a = i; | 
					
						
							|  |  |  |         foo[i].doit(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-06-29 10:58:09 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  | #ifndef Q_CC_RVCT
 | 
					
						
							| 
									
										
										
										
											2010-02-15 16:59:00 +01:00
										 |  |  | struct TestAnonymous | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     union { | 
					
						
							|  |  |  |         struct { int i; int b; }; | 
					
						
							|  |  |  |         struct { float f; }; | 
					
						
							|  |  |  |         double d; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-03-16 18:39:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | void testPeekAndPoke3() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     // Anonymous structs
 | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  | #ifndef Q_CC_RVCT
 | 
					
						
							| 
									
										
										
										
											2010-03-16 18:39:06 +01:00
										 |  |  |         union { | 
					
						
							|  |  |  |             struct { int i; int b; }; | 
					
						
							|  |  |  |             struct { float f; }; | 
					
						
							|  |  |  |             double d; | 
					
						
							| 
									
										
										
										
											2010-05-19 14:18:41 +02:00
										 |  |  |         } a = { { 42, 43 } }; | 
					
						
							| 
									
										
										
										
											2010-03-16 18:39:06 +01:00
										 |  |  |         a.i = 1; // Break here. Expand a. Step.
 | 
					
						
							|  |  |  |         a.i = 2; // Change a.i in Locals view to 0. This changes f, d but expectedly not b. Step.
 | 
					
						
							|  |  |  |         a.i = 3; // Continue.
 | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |         Q_UNUSED(a); | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-03-16 18:39:06 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Complex watchers
 | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         struct S { int a; double b; } s[10]; | 
					
						
							|  |  |  |         for (int i = 0; i != 10; ++i) { | 
					
						
							|  |  |  |             s[i].a = i;  // Break here. Expand s and s[0]. Step.
 | 
					
						
							|  |  |  |             // Watcher Context: "Add New Watcher".
 | 
					
						
							|  |  |  |             // Type    ['s[%d].a' % i for i in range(5)]
 | 
					
						
							| 
									
										
										
										
											2010-10-12 10:47:07 +02:00
										 |  |  |             // Expand it, continue stepping. This should result in a list
 | 
					
						
							|  |  |  |             // of five items containing the .a fields of s[0]..s[4].
 | 
					
						
							| 
									
										
										
										
											2010-03-16 18:39:06 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |         Q_UNUSED(s); | 
					
						
							| 
									
										
										
										
											2010-03-16 18:39:06 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-03-17 11:44:04 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // QImage display
 | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QImage im(QSize(200, 200), QImage::Format_RGB32); | 
					
						
							|  |  |  |         im.fill(QColor(200, 10, 30).rgba()); | 
					
						
							|  |  |  |         QPainter pain; | 
					
						
							|  |  |  |         pain.begin(&im); | 
					
						
							|  |  |  |         pain.setPen(QPen(Qt::black, 5.0, Qt::SolidLine, Qt::RoundCap)); | 
					
						
							|  |  |  |         pain.drawEllipse(20, 20, 160, 160); // Break here. Step.
 | 
					
						
							|  |  |  |         // Toggle between "Normal" and "Displayed" in L&W Context Menu, entry "Display of Type QImage". Step.
 | 
					
						
							|  |  |  |         pain.drawArc(70, 115, 60, 30, 200 * 16, 140 * 16); | 
					
						
							|  |  |  |         pain.setBrush(Qt::black); | 
					
						
							|  |  |  |         pain.drawEllipse(65, 70, 15, 15); // Step.
 | 
					
						
							|  |  |  |         pain.drawEllipse(120, 70, 15, 15); // Step.
 | 
					
						
							|  |  |  |         pain.end(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-16 18:39:06 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2010-02-15 16:59:00 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef Q_CC_RVCT
 | 
					
						
							| 
									
										
										
										
											2010-03-18 18:10:00 +01:00
										 |  |  | namespace { // anon
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct Something | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Something() { a = b = 1; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void foo() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         a = 42; | 
					
						
							|  |  |  |         b = 43; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int a, b; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // anon
 | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-18 18:10:00 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-15 16:59:00 +01:00
										 |  |  | void testAnonymous() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  | #ifndef Q_CC_RVCT
 | 
					
						
							| 
									
										
										
										
											2010-02-15 16:59:00 +01:00
										 |  |  |     TestAnonymous a; | 
					
						
							|  |  |  |     a.i = 1; | 
					
						
							|  |  |  |     a.i = 2; | 
					
						
							|  |  |  |     a.i = 3; | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(a); | 
					
						
							| 
									
										
										
										
											2010-03-18 18:10:00 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     Something s; | 
					
						
							|  |  |  |     s.foo(); | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(s); | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-02-15 16:59:00 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | typedef void (*func_t)(); | 
					
						
							|  |  |  | func_t testFunctionPointer() | 
					
						
							| 
									
										
										
										
											2010-02-26 14:25:36 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     func_t f1 = testAnonymous; | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  |     func_t f2 = testPeekAndPoke3; | 
					
						
							|  |  |  |     func_t f3 = testPeekAndPoke3; | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  |     Q_UNUSED(f1); | 
					
						
							|  |  |  |     Q_UNUSED(f2); | 
					
						
							|  |  |  |     Q_UNUSED(f3); | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  |     return f1; | 
					
						
							| 
									
										
										
										
											2010-02-26 14:25:36 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-27 17:52:04 +02:00
										 |  |  | void testQByteArray() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QByteArray ba = "Hello"; | 
					
						
							|  |  |  |     ba += '"'; | 
					
						
							|  |  |  |     ba += "World"; | 
					
						
							| 
									
										
										
										
											2009-04-03 11:54:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const char *str1 = "\356"; | 
					
						
							|  |  |  |     const char *str2 = "\xee"; | 
					
						
							|  |  |  |     const char *str3 = "\\ee"; | 
					
						
							|  |  |  |     QByteArray buf1( str1 ); | 
					
						
							|  |  |  |     QByteArray buf2( str2 ); | 
					
						
							|  |  |  |     QByteArray buf3( str3 ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     ba += char(0); | 
					
						
							|  |  |  |     ba += 1; | 
					
						
							|  |  |  |     ba += 2; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-02 19:03:06 +01:00
										 |  |  | int testQByteArray2() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QByteArray ba; | 
					
						
							|  |  |  |     for (int i = 256; --i >= 0; ) | 
					
						
							|  |  |  |         ba.append(char(i)); | 
					
						
							| 
									
										
										
										
											2011-05-16 15:14:30 +02:00
										 |  |  |     QString s(10000, 'x'); | 
					
						
							|  |  |  |     std::string ss(10000, 'c'); | 
					
						
							| 
									
										
										
										
											2011-02-02 19:03:06 +01:00
										 |  |  |     return ba.size(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-11 17:29:10 +01:00
										 |  |  | static void throwit1() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     throw 14; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void throwit() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     throwit1(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int testCatchThrow() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-11-25 15:16:04 +01:00
										 |  |  |     // Set a breakpoint on "throw" in the BreakWindow context menu
 | 
					
						
							|  |  |  |     // before stepping further.
 | 
					
						
							| 
									
										
										
										
											2010-02-11 17:29:10 +01:00
										 |  |  |     int gotit = 0; | 
					
						
							|  |  |  |     try { | 
					
						
							|  |  |  |         throwit(); | 
					
						
							|  |  |  |     } catch (int what) { | 
					
						
							|  |  |  |         gotit = what; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return gotit; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-27 12:40:14 +02:00
										 |  |  | void testQDate() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QDate date; | 
					
						
							|  |  |  |     date = QDate::currentDate(); | 
					
						
							|  |  |  |     date = date.addDays(5); | 
					
						
							|  |  |  |     date = date.addDays(5); | 
					
						
							|  |  |  |     date = date.addDays(5); | 
					
						
							|  |  |  |     date = date.addDays(5); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testQTime() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QTime time; | 
					
						
							|  |  |  |     time = QTime::currentTime(); | 
					
						
							|  |  |  |     time = time.addSecs(5); | 
					
						
							|  |  |  |     time = time.addSecs(5); | 
					
						
							|  |  |  |     time = time.addSecs(5); | 
					
						
							|  |  |  |     time = time.addSecs(5); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testQDateTime() | 
					
						
							| 
									
										
										
										
											2009-09-03 09:15:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     QDateTime date; | 
					
						
							|  |  |  |     date = QDateTime::currentDateTime(); | 
					
						
							|  |  |  |     date = date.addSecs(5); | 
					
						
							|  |  |  |     date = date.addSecs(5); | 
					
						
							|  |  |  |     date = date.addSecs(5); | 
					
						
							|  |  |  |     date = date.addSecs(5); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | QFileInfo testQFileInfo() | 
					
						
							| 
									
										
										
										
											2009-07-14 18:14:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-28 15:34:37 +02:00
										 |  |  |     QFile file("/tmp/t"); | 
					
						
							| 
									
										
										
										
											2009-07-14 18:14:49 +02:00
										 |  |  |     QFileInfo fi("/tmp/t"); | 
					
						
							|  |  |  |     QString s = fi.absoluteFilePath(); | 
					
						
							| 
									
										
										
										
											2010-04-08 14:38:42 +02:00
										 |  |  |     s = fi.bundleName(); | 
					
						
							|  |  |  |     s = fi.bundleName(); | 
					
						
							|  |  |  |     s = fi.bundleName(); | 
					
						
							| 
									
										
										
										
											2010-10-07 16:36:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QFileInfo result("/tmp/t"); | 
					
						
							|  |  |  |     return result; | 
					
						
							| 
									
										
										
										
											2009-07-14 18:14:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-08 14:26:44 +02:00
										 |  |  | void testQFixed() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-10-08 14:56:17 +02:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2010-10-08 14:26:44 +02:00
										 |  |  |     QFixed f = QFixed::fromReal(4.2); | 
					
						
							|  |  |  |     f += 1; | 
					
						
							|  |  |  |     f += 1; | 
					
						
							|  |  |  |     f *= -1; | 
					
						
							|  |  |  |     f += 1; | 
					
						
							|  |  |  |     f += 1; | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2009-07-14 18:14:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-05 15:06:14 +02:00
										 |  |  | namespace qhostaddress { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testQHostAddress() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QHostAddress ha1(129 * 256 * 256 * 256 + 130); | 
					
						
							|  |  |  |         QHostAddress ha2("127.0.0.1"); | 
					
						
							|  |  |  |         // <== break here
 | 
					
						
							|  |  |  |         // Check ha1 and ha2 look correct.
 | 
					
						
							|  |  |  |         dummyStatement(&ha1, &ha2); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace qhostaddress
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | QHash<int, float> testQHash() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-27 17:41:31 +01:00
										 |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QHash<int, float> hgg0; | 
					
						
							|  |  |  |     hgg0[11] = 11.0; | 
					
						
							|  |  |  |     hgg0[22] = 22.0; | 
					
						
							| 
									
										
										
										
											2009-01-27 17:15:51 +01:00
										 |  |  |     hgg0[22] = 22.0; | 
					
						
							|  |  |  |     hgg0[22] = 22.0; | 
					
						
							|  |  |  |     hgg0[22] = 22.0; | 
					
						
							|  |  |  |     hgg0[22] = 22.0; | 
					
						
							|  |  |  |     hgg0[22] = 22.0; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-27 17:15:51 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-28 16:55:09 +01:00
										 |  |  |     QHash<QString, int> hgg1; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     hgg1["22.0"] = 22.0; | 
					
						
							| 
									
										
										
										
											2009-01-28 16:55:09 +01:00
										 |  |  |     hgg1["123.0"] = 22.0; | 
					
						
							|  |  |  |     hgg1["111111ss111128.0"] = 28.0; | 
					
						
							|  |  |  |     hgg1["11124.0"] = 22.0; | 
					
						
							|  |  |  |     hgg1["1111125.0"] = 22.0; | 
					
						
							|  |  |  |     hgg1["11111126.0"] = 22.0; | 
					
						
							|  |  |  |     hgg1["111111127.0"] = 27.0; | 
					
						
							|  |  |  |     hgg1["111111111128.0"] = 28.0; | 
					
						
							|  |  |  |     hgg1["111111111111111111129.0"] = 29.0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QHash<QByteArray, float> hgx1; | 
					
						
							|  |  |  |     hgx1["22.0"] = 22.0; | 
					
						
							|  |  |  |     hgx1["123.0"] = 22.0; | 
					
						
							|  |  |  |     hgx1["111111ss111128.0"] = 28.0; | 
					
						
							|  |  |  |     hgx1["11124.0"] = 22.0; | 
					
						
							|  |  |  |     hgx1["1111125.0"] = 22.0; | 
					
						
							|  |  |  |     hgx1["11111126.0"] = 22.0; | 
					
						
							|  |  |  |     hgx1["111111127.0"] = 27.0; | 
					
						
							|  |  |  |     hgx1["111111111128.0"] = 28.0; | 
					
						
							|  |  |  |     hgx1["111111111111111111129.0"] = 29.0; | 
					
						
							| 
									
										
										
										
											2009-01-27 17:15:51 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-03-05 11:06:25 +01:00
										 |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2009-03-05 13:52:52 +01:00
										 |  |  |     QHash<int, QString> hgg2; | 
					
						
							|  |  |  |     hgg2[22] = "22.0"; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QHash<QString, Foo> hgg3; | 
					
						
							|  |  |  |     hgg3["22.0"] = Foo(22); | 
					
						
							|  |  |  |     hgg3["33.0"] = Foo(33); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QObject ob; | 
					
						
							|  |  |  |     QHash<QString, QPointer<QObject> > hash; | 
					
						
							|  |  |  |     hash.insert("Hallo", QPointer<QObject>(&ob)); | 
					
						
							|  |  |  |     hash.insert("Welt", QPointer<QObject>(&ob)); | 
					
						
							|  |  |  |     hash.insert(".", QPointer<QObject>(&ob)); | 
					
						
							| 
									
										
										
										
											2009-01-27 17:15:51 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-10-07 16:36:25 +02:00
										 |  |  |     QHash<int, float> result; | 
					
						
							|  |  |  |     return result; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  | void testQImage() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-08-18 10:56:42 +02:00
										 |  |  |     // only works with Python dumper
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QImage im(QSize(200, 200), QImage::Format_RGB32); | 
					
						
							|  |  |  |     im.fill(QColor(200, 100, 130).rgba()); | 
					
						
							|  |  |  |     QPainter pain; | 
					
						
							|  |  |  |     pain.begin(&im); | 
					
						
							|  |  |  |     pain.drawLine(2, 2, 130, 130); | 
					
						
							|  |  |  |     pain.drawLine(4, 2, 130, 140); | 
					
						
							|  |  |  |     pain.drawRect(30, 30, 80, 80); | 
					
						
							|  |  |  |     pain.end(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-15 17:44:56 +01:00
										 |  |  | struct Function | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Function(QByteArray var, QByteArray f, double min, double max) | 
					
						
							|  |  |  |       : var(var), f(f), min(min), max(max) {} | 
					
						
							|  |  |  |     QByteArray var; | 
					
						
							|  |  |  |     QByteArray f; | 
					
						
							|  |  |  |     double min; | 
					
						
							|  |  |  |     double max; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testFunction() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-06-28 18:00:38 +02:00
										 |  |  |     // In order to use this, switch on the 'qDump__Function' in dumper.py
 | 
					
						
							| 
									
										
										
										
											2010-03-15 17:44:56 +01:00
										 |  |  |     Function func("x", "sin(x)", 0, 1); | 
					
						
							|  |  |  |     func.max = 10; | 
					
						
							|  |  |  |     func.f = "cos(x)"; | 
					
						
							|  |  |  |     func.max = 4; | 
					
						
							|  |  |  |     func.max = 5; | 
					
						
							|  |  |  |     func.max = 6; | 
					
						
							|  |  |  |     func.max = 7; | 
					
						
							|  |  |  |     func.max = 8; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 17:46:52 +02:00
										 |  |  | void testOutput() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     qDebug() << "qDebug() 1"; | 
					
						
							|  |  |  |     qDebug() << "qDebug() 2"; | 
					
						
							|  |  |  |     qDebug() << "qDebug() 3"; | 
					
						
							| 
									
										
										
										
											2009-02-23 21:15:32 +01:00
										 |  |  |     qDebug() << "qDebug <foo & bar>"; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     std::cout << "std::cout @@ 1" << std::endl; | 
					
						
							|  |  |  |     std::cout << "std::cout @@ 2\n"; | 
					
						
							|  |  |  |     std::cout << "std::cout @@ 3" << std::endl; | 
					
						
							| 
									
										
										
										
											2009-02-23 21:15:32 +01:00
										 |  |  |     std::cout << "std::cout <foo & bar>\n"; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     std::cerr << "std::cerr 1\n"; | 
					
						
							|  |  |  |     std::cerr << "std::cerr 2\n"; | 
					
						
							|  |  |  |     std::cerr << "std::cerr 3\n"; | 
					
						
							| 
									
										
										
										
											2009-02-23 21:15:32 +01:00
										 |  |  |     std::cerr << "std::cerr <foo & bar>\n"; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 17:46:52 +02:00
										 |  |  | void testInput() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | #if 0
 | 
					
						
							|  |  |  |     // This works only when "Run in terminal" is selected
 | 
					
						
							|  |  |  |     // in the Run Configuration.
 | 
					
						
							|  |  |  |     int i; | 
					
						
							|  |  |  |     std::cin >> i; | 
					
						
							|  |  |  |     int j; | 
					
						
							|  |  |  |     std::cin >> j; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-08 11:02:04 +01:00
										 |  |  | void testQLinkedList() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | #if 1
 | 
					
						
							|  |  |  |     QLinkedList<int> li; | 
					
						
							|  |  |  |     QLinkedList<uint> lu; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i != 3; ++i) | 
					
						
							|  |  |  |         li.append(i); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     lu.append(102); | 
					
						
							|  |  |  |     lu.append(102); | 
					
						
							|  |  |  |     lu.append(102); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-08 11:50:20 +01:00
										 |  |  |     QLinkedList<Foo *> lpi; | 
					
						
							|  |  |  |     lpi.append(new Foo(1)); | 
					
						
							|  |  |  |     lpi.append(0); | 
					
						
							|  |  |  |     lpi.append(new Foo(3)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-08 11:02:04 +01:00
										 |  |  |     QLinkedList<qulonglong> l; | 
					
						
							|  |  |  |     l.append(42); | 
					
						
							|  |  |  |     l.append(43); | 
					
						
							|  |  |  |     l.append(44); | 
					
						
							|  |  |  |     l.append(45); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QLinkedList<Foo> f; | 
					
						
							|  |  |  |     f.append(Foo(1)); | 
					
						
							|  |  |  |     f.append(Foo(2)); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  |     QLinkedList<std::string> v; | 
					
						
							|  |  |  |     v.push_back("aa"); | 
					
						
							|  |  |  |     v.push_back("bb"); | 
					
						
							|  |  |  |     v.push_back("cc"); | 
					
						
							|  |  |  |     v.push_back("dd"); | 
					
						
							|  |  |  |  } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-12 12:39:14 +02:00
										 |  |  | void testQLocale() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QLocale loc = QLocale::system(); | 
					
						
							| 
									
										
										
										
											2010-08-12 15:26:56 +02:00
										 |  |  |     //QString s = loc.name();
 | 
					
						
							| 
									
										
										
										
											2010-08-12 12:39:14 +02:00
										 |  |  |     //QVariant v = loc;
 | 
					
						
							| 
									
										
										
										
											2010-08-12 15:26:56 +02:00
										 |  |  |     QLocale::MeasurementSystem m = loc.measurementSystem(); | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(m); | 
					
						
							| 
									
										
										
										
											2010-08-12 12:39:14 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  | void testQList() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-07-14 10:07:15 +02:00
										 |  |  |     QList<int> big; | 
					
						
							|  |  |  |     for (int i = 0; i < 10000; ++i) | 
					
						
							|  |  |  |         big.push_back(i); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QList<Foo> flist; | 
					
						
							|  |  |  |     for (int i = 0; i < 100; ++i) | 
					
						
							|  |  |  |         flist.push_back(i + 15); | 
					
						
							|  |  |  |     flist.push_back(1000); | 
					
						
							|  |  |  |     flist.push_back(1001); | 
					
						
							|  |  |  |     flist.push_back(1002); | 
					
						
							| 
									
										
										
										
											2010-03-08 13:14:23 +01:00
										 |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QList<int> li; | 
					
						
							|  |  |  |     QList<uint> lu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-28 12:15:40 +01:00
										 |  |  |     for (int i = 0; i != 30; ++i) { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         li.append(i); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     li.append(101); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  |     li.append(102); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-11 15:09:33 +01:00
										 |  |  |     QList<int *> lpi; | 
					
						
							|  |  |  |     lpi.append(new int(1)); | 
					
						
							|  |  |  |     lpi.append(new int(2)); | 
					
						
							|  |  |  |     lpi.append(new int(3)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i != 3; ++i) { | 
					
						
							|  |  |  |         lu.append(i); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     lu.append(101); | 
					
						
							|  |  |  |     lu.append(102); | 
					
						
							|  |  |  |     lu.append(102); | 
					
						
							|  |  |  |     lu.append(102); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QList<uint> i; | 
					
						
							|  |  |  |     i.append(42); | 
					
						
							|  |  |  |     i.append(43); | 
					
						
							|  |  |  |     i.append(44); | 
					
						
							|  |  |  |     i.append(45); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-24 12:31:09 +02:00
										 |  |  |     QList<ushort> ls; | 
					
						
							|  |  |  |     ls.append(42); | 
					
						
							|  |  |  |     ls.append(43); | 
					
						
							|  |  |  |     ls.append(44); | 
					
						
							|  |  |  |     ls.append(45); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QList<QChar> lc; | 
					
						
							|  |  |  |     lc.append(QChar('a')); | 
					
						
							|  |  |  |     lc.append(QChar('b')); | 
					
						
							|  |  |  |     lc.append(QChar('c')); | 
					
						
							|  |  |  |     lc.append(QChar('d')); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QList<qulonglong> l; | 
					
						
							|  |  |  |     l.append(42); | 
					
						
							|  |  |  |     l.append(43); | 
					
						
							|  |  |  |     l.append(44); | 
					
						
							|  |  |  |     l.append(45); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QList<Foo> f; | 
					
						
							|  |  |  |     f.append(Foo(1)); | 
					
						
							|  |  |  |     f.append(Foo(2)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-14 10:07:15 +02:00
										 |  |  |     QList<std::string> v; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     v.push_back("aa"); | 
					
						
							|  |  |  |     v.push_back("bb"); | 
					
						
							|  |  |  |     v.push_back("cc"); | 
					
						
							|  |  |  |     v.push_back("dd"); | 
					
						
							| 
									
										
										
										
											2009-07-14 10:07:15 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |  } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-10 12:13:12 +01:00
										 |  |  | namespace nsA { | 
					
						
							|  |  |  | namespace nsB { | 
					
						
							| 
									
										
										
										
											2011-01-19 10:48:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct SomeType | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     SomeType(int a) : a(a) {} | 
					
						
							|  |  |  |     int a; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-10 12:13:12 +01:00
										 |  |  | } // namespace nsB
 | 
					
						
							|  |  |  | } // namespace nsA
 | 
					
						
							| 
									
										
										
										
											2011-01-19 10:48:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  | void testQMap() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 10:48:39 +01:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QMap<uint, QStringList> ggl; | 
					
						
							|  |  |  |     ggl[11] = QStringList() << "11"; | 
					
						
							|  |  |  |     ggl[22] = QStringList() << "22"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     typedef QMap<uint, QStringList> T; | 
					
						
							|  |  |  |     T ggt; | 
					
						
							|  |  |  |     ggt[11] = QStringList() << "11"; | 
					
						
							|  |  |  |     ggt[22] = QStringList() << "22"; | 
					
						
							| 
									
										
										
										
											2011-01-19 10:48:39 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 10:48:39 +01:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QMap<uint, float> gg0; | 
					
						
							|  |  |  |     gg0[11] = 11.0; | 
					
						
							|  |  |  |     gg0[22] = 22.0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QMap<QString, float> gg1; | 
					
						
							|  |  |  |     gg1["22.0"] = 22.0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QMap<int, QString> gg2; | 
					
						
							|  |  |  |     gg2[22] = "22.0"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QMap<QString, Foo> gg3; | 
					
						
							|  |  |  |     gg3["22.0"] = Foo(22); | 
					
						
							|  |  |  |     gg3["33.0"] = Foo(33); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QObject ob; | 
					
						
							|  |  |  |     QMap<QString, QPointer<QObject> > map; | 
					
						
							|  |  |  |     map.insert("Hallo", QPointer<QObject>(&ob)); | 
					
						
							|  |  |  |     map.insert("Welt", QPointer<QObject>(&ob)); | 
					
						
							|  |  |  |     map.insert(".", QPointer<QObject>(&ob)); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2011-01-19 10:48:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2011-03-10 12:13:12 +01:00
										 |  |  |     QList<nsA::nsB::SomeType *> x; | 
					
						
							|  |  |  |     x.append(new nsA::nsB::SomeType(1)); | 
					
						
							|  |  |  |     x.append(new nsA::nsB::SomeType(2)); | 
					
						
							|  |  |  |     x.append(new nsA::nsB::SomeType(3)); | 
					
						
							|  |  |  |     QMap<QString, QList<nsA::nsB::SomeType *> > mlt; | 
					
						
							| 
									
										
										
										
											2011-01-19 10:48:39 +01:00
										 |  |  |     mlt["foo"] = x; | 
					
						
							|  |  |  |     mlt["bar"] = x; | 
					
						
							|  |  |  |     mlt["1"] = x; | 
					
						
							|  |  |  |     mlt["2"] = x; | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-07 15:31:58 +01:00
										 |  |  | void testQMultiMap() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QMultiMap<uint, float> gg0; | 
					
						
							|  |  |  |     gg0.insert(11, 11.0); | 
					
						
							|  |  |  |     gg0.insert(22, 22.0); | 
					
						
							|  |  |  |     gg0.insert(22, 33.0); | 
					
						
							| 
									
										
										
										
											2009-01-07 16:29:14 +01:00
										 |  |  |     gg0.insert(22, 34.0); | 
					
						
							|  |  |  |     gg0.insert(22, 35.0); | 
					
						
							|  |  |  |     gg0.insert(22, 36.0); | 
					
						
							|  |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2009-01-07 15:31:58 +01:00
										 |  |  |     QMultiMap<QString, float> gg1; | 
					
						
							|  |  |  |     gg1.insert("22.0", 22.0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QMultiMap<int, QString> gg2; | 
					
						
							|  |  |  |     gg2.insert(22, "22.0"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QMultiMap<QString, Foo> gg3; | 
					
						
							|  |  |  |     gg3.insert("22.0", Foo(22)); | 
					
						
							|  |  |  |     gg3.insert("33.0", Foo(33)); | 
					
						
							|  |  |  |     gg3.insert("22.0", Foo(22)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QObject ob; | 
					
						
							|  |  |  |     QMultiMap<QString, QPointer<QObject> > map; | 
					
						
							|  |  |  |     map.insert("Hallo", QPointer<QObject>(&ob)); | 
					
						
							|  |  |  |     map.insert("Welt", QPointer<QObject>(&ob)); | 
					
						
							|  |  |  |     map.insert(".", QPointer<QObject>(&ob)); | 
					
						
							|  |  |  |     map.insert(".", QPointer<QObject>(&ob)); | 
					
						
							| 
									
										
										
										
											2009-01-07 16:29:14 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-01-07 15:31:58 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-27 14:47:03 +01:00
										 |  |  | namespace Names { | 
					
						
							|  |  |  | namespace Bar { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct Ui { | 
					
						
							|  |  |  |     Ui() { w = 0; } | 
					
						
							|  |  |  |     QWidget *w; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestObject : public QObject | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     TestObject(QObject *parent = 0) | 
					
						
							|  |  |  |       : QObject(parent) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         m_ui = new Ui; | 
					
						
							| 
									
										
										
										
											2010-08-12 15:26:56 +02:00
										 |  |  |         m_ui->w = new QWidget; | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |         Q_UNUSED(parent); | 
					
						
							| 
									
										
										
										
											2009-11-27 14:47:03 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-13 09:27:22 +02:00
										 |  |  |     Q_PROPERTY(QString myProp1 READ myProp1 WRITE setMyProp1) | 
					
						
							|  |  |  |     QString myProp1() const { return m_myProp1; } | 
					
						
							|  |  |  |     Q_SLOT void setMyProp1(const QString &mt) { m_myProp1 = mt; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Q_PROPERTY(QString myProp2 READ myProp2 WRITE setMyProp2) | 
					
						
							|  |  |  |     QString myProp2() const { return m_myProp2; } | 
					
						
							|  |  |  |     Q_SLOT void setMyProp2(const QString &mt) { m_myProp2 = mt; } | 
					
						
							| 
									
										
										
										
											2010-08-12 15:26:56 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2009-11-27 14:47:03 +01:00
										 |  |  |     Ui *m_ui; | 
					
						
							| 
									
										
										
										
											2010-08-13 09:27:22 +02:00
										 |  |  |     QString m_myProp1; | 
					
						
							|  |  |  |     QString m_myProp2; | 
					
						
							| 
									
										
										
										
											2009-11-27 14:47:03 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace Bar
 | 
					
						
							|  |  |  | } // namespace Names
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  | void testQObject(int &argc, char *argv[]) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QApplication app(argc, argv); | 
					
						
							| 
									
										
										
										
											2011-01-27 15:03:08 +01:00
										 |  |  |     //QString longString = QString(10000, QLatin1Char('A'));
 | 
					
						
							| 
									
										
										
										
											2010-04-08 14:38:42 +02:00
										 |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2009-11-27 14:47:03 +01:00
										 |  |  |     Names::Bar::TestObject test; | 
					
						
							| 
									
										
										
										
											2010-08-13 09:27:22 +02:00
										 |  |  |     test.setMyProp1("HELLO"); | 
					
						
							|  |  |  |     test.setMyProp2("WORLD"); | 
					
						
							|  |  |  |     QString s = test.myProp1(); | 
					
						
							|  |  |  |     s += test.myProp2(); | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(s); | 
					
						
							| 
									
										
										
										
											2010-08-12 15:26:56 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-11-27 14:47:03 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-12 15:26:56 +02:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QAction act("xxx", &app); | 
					
						
							|  |  |  |     QString t = act.text(); | 
					
						
							|  |  |  |     t += "y"; | 
					
						
							| 
									
										
										
										
											2009-04-03 13:39:14 +02:00
										 |  |  |     t += "y"; | 
					
						
							|  |  |  |     t += "y"; | 
					
						
							|  |  |  |     t += "y"; | 
					
						
							|  |  |  |     t += "y"; | 
					
						
							| 
									
										
										
										
											2010-04-08 14:38:42 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-27 15:03:08 +01:00
										 |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2010-06-09 12:03:57 +02:00
										 |  |  |     QWidget ob; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     ob.setObjectName("An Object"); | 
					
						
							| 
									
										
										
										
											2010-06-09 12:03:57 +02:00
										 |  |  |     ob.setProperty("USER DEFINED 1", 44); | 
					
						
							|  |  |  |     ob.setProperty("USER DEFINED 2", QStringList() << "FOO" << "BAR"); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QObject ob1; | 
					
						
							|  |  |  |     ob1.setObjectName("Another Object"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-27 15:03:08 +01:00
										 |  |  |     QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater())); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater())); | 
					
						
							| 
									
										
										
										
											2010-06-09 12:03:57 +02:00
										 |  |  |     //QObject::connect(&app, SIGNAL(lastWindowClosed()), &ob, SLOT(deleteLater()));
 | 
					
						
							| 
									
										
										
										
											2010-04-08 14:38:42 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-09 12:03:57 +02:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QList<QObject *> obs; | 
					
						
							|  |  |  |     obs.append(&ob); | 
					
						
							|  |  |  |     obs.append(&ob1); | 
					
						
							|  |  |  |     obs.append(0); | 
					
						
							|  |  |  |     obs.append(&app); | 
					
						
							|  |  |  |     ob1.setObjectName("A Subobject"); | 
					
						
							| 
									
										
										
										
											2009-04-08 16:27:15 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-04-08 14:38:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-07 14:52:18 +01:00
										 |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2009-04-02 10:54:22 +02:00
										 |  |  |     QString str = QString::fromUtf8("XXXXXXXXXXXXXXyyXXX ö"); | 
					
						
							|  |  |  |     QLabel l(str); | 
					
						
							| 
									
										
										
										
											2009-07-01 14:15:10 +02:00
										 |  |  |     l.setObjectName("Some Label"); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     l.show(); | 
					
						
							|  |  |  |     app.exec(); | 
					
						
							| 
									
										
										
										
											2010-06-09 12:03:57 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 17:11:10 +02:00
										 |  |  | class Sender : public QObject | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     Sender() { setObjectName("Sender"); } | 
					
						
							|  |  |  |     void doEmit() { emit aSignal(); } | 
					
						
							|  |  |  | signals: | 
					
						
							|  |  |  |     void aSignal(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Receiver : public QObject | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     Receiver() { setObjectName("Receiver"); } | 
					
						
							|  |  |  | public slots: | 
					
						
							|  |  |  |     void aSlot() { | 
					
						
							|  |  |  |         QObject *s = sender(); | 
					
						
							|  |  |  |         if (s) { | 
					
						
							|  |  |  |             qDebug() << "SENDER: " << s; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             qDebug() << "NO SENDER"; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testSignalSlot(int &argc, char *argv[]) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QApplication app(argc, argv); | 
					
						
							|  |  |  |     Sender sender; | 
					
						
							|  |  |  |     Receiver receiver; | 
					
						
							|  |  |  |     QObject::connect(&sender, SIGNAL(aSignal()), &receiver, SLOT(aSlot())); | 
					
						
							|  |  |  |     sender.doEmit(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  | void testQPixmap() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QImage im(QSize(200, 200), QImage::Format_RGB32); | 
					
						
							|  |  |  |     im.fill(QColor(200, 100, 130).rgba()); | 
					
						
							|  |  |  |     QPainter pain; | 
					
						
							|  |  |  |     pain.begin(&im); | 
					
						
							|  |  |  |     pain.drawLine(2, 2, 130, 130); | 
					
						
							|  |  |  |     pain.end(); | 
					
						
							|  |  |  |     QPixmap pm = QPixmap::fromImage(im); | 
					
						
							|  |  |  |     int i = 1; | 
					
						
							|  |  |  |     Q_UNUSED(i); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-29 09:32:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | namespace qregexp { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testQRegExp() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // Works with Python dumpers only.
 | 
					
						
							|  |  |  |         QRegExp re(QString("a(.*)b(.*)c")); | 
					
						
							|  |  |  |         // <=== break here.
 | 
					
						
							|  |  |  |         // Step over until end, check display looks ok.
 | 
					
						
							|  |  |  |         QString str1 = "a1121b344c"; | 
					
						
							|  |  |  |         QString str2 = "Xa1121b344c"; | 
					
						
							|  |  |  |         int pos2 = re.indexIn(str2); | 
					
						
							|  |  |  |         int pos1 = re.indexIn(str1); | 
					
						
							|  |  |  |         dummyStatement(&pos1, &pos2); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace qregexp
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace qregion { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testQRegion() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // Works with Python dumpers only.
 | 
					
						
							|  |  |  |         QRegion region; | 
					
						
							|  |  |  |         // <=== break here
 | 
					
						
							|  |  |  |         // Step over until end, check display looks sane.
 | 
					
						
							|  |  |  |         region += QRect(100, 100, 200, 200); | 
					
						
							|  |  |  |         region += QRect(300, 300, 400, 500); | 
					
						
							|  |  |  |         region += QRect(500, 500, 600, 600); | 
					
						
							|  |  |  |         region += QRect(500, 500, 600, 600); | 
					
						
							|  |  |  |         region += QRect(500, 500, 600, 600); | 
					
						
							|  |  |  |         region += QRect(500, 500, 600, 600); | 
					
						
							|  |  |  |         dummyStatement(®ion); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace qregion
 | 
					
						
							| 
									
										
										
										
											2010-06-30 15:20:16 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | void testPlugin() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QString dir = QDir::currentPath(); | 
					
						
							|  |  |  | #ifdef Q_OS_LINUX
 | 
					
						
							| 
									
										
										
										
											2010-09-03 11:15:27 +02:00
										 |  |  |     QLibrary lib(dir + "/libsimple_gdbtest_plugin.so"); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef Q_OS_MAC
 | 
					
						
							|  |  |  |     dir = QFileInfo(dir + "/../..").canonicalPath(); | 
					
						
							| 
									
										
										
										
											2010-09-03 11:15:27 +02:00
										 |  |  |     QLibrary lib(dir + "/libsimple_gdbtest_plugin.dylib"); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef Q_OS_WIN
 | 
					
						
							| 
									
										
										
										
											2010-10-04 12:19:28 +02:00
										 |  |  |     QLibrary lib(dir + "/debug/simple_gdbtest_plugin.dll"); | 
					
						
							| 
									
										
										
										
											2010-01-11 15:42:03 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef Q_OS_SYMBIAN
 | 
					
						
							| 
									
										
										
										
											2010-09-03 11:15:27 +02:00
										 |  |  |     QLibrary lib(dir + "/libsimple_gdbtest_plugin.dll"); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  |     int (*foo)() = (int(*)()) lib.resolve("pluginTest"); | 
					
						
							| 
									
										
										
										
											2010-10-04 12:19:28 +02:00
										 |  |  |     qDebug() << "library resolve: " << foo << lib.fileName(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     if (foo) { | 
					
						
							|  |  |  |         int res = foo(); | 
					
						
							|  |  |  |         res += 1; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         qDebug() << lib.errorString(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  | void testQSet() | 
					
						
							| 
									
										
										
										
											2008-12-05 18:44:09 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QSet<int> hgg0; | 
					
						
							|  |  |  |     hgg0.insert(11); | 
					
						
							|  |  |  |     hgg0.insert(22); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QSet<QString> hgg1; | 
					
						
							|  |  |  |     hgg1.insert("22.0"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QObject ob; | 
					
						
							|  |  |  |     QSet<QPointer<QObject> > hash; | 
					
						
							|  |  |  |     QPointer<QObject> ptr(&ob); | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  |     Q_UNUSED(ptr); | 
					
						
							| 
									
										
										
										
											2008-12-05 18:44:09 +01:00
										 |  |  |     //hash.insert(ptr);
 | 
					
						
							|  |  |  |     //hash.insert(ptr);
 | 
					
						
							|  |  |  |     //hash.insert(ptr);
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-25 15:00:57 +02:00
										 |  |  | #if QT_VERSION >= 0x040500
 | 
					
						
							| 
									
										
										
										
											2009-04-17 15:34:46 +02:00
										 |  |  | class EmployeeData : public QSharedData | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     EmployeeData() : id(-1) { name.clear(); } | 
					
						
							|  |  |  |     EmployeeData(const EmployeeData &other) | 
					
						
							|  |  |  |         : QSharedData(other), id(other.id), name(other.name) { } | 
					
						
							|  |  |  |     ~EmployeeData() { } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int id; | 
					
						
							|  |  |  |     QString name; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Employee | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     Employee() { d = new EmployeeData; } | 
					
						
							|  |  |  |     Employee(int id, QString name) { | 
					
						
							|  |  |  |         d = new EmployeeData; | 
					
						
							|  |  |  |         setId(id); | 
					
						
							|  |  |  |         setName(name); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     Employee(const Employee &other) | 
					
						
							|  |  |  |           : d (other.d) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     void setId(int id) { d->id = id; } | 
					
						
							|  |  |  |     void setName(QString name) { d->name = name; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int id() const { return d->id; } | 
					
						
							|  |  |  |     QString name() const { return d->name; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    private: | 
					
						
							|  |  |  |      QSharedDataPointer<EmployeeData> d; | 
					
						
							| 
									
										
										
										
											2009-09-03 09:15:24 +02:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-04-07 13:50:21 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void testQSharedPointer() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | #    if QT_VERSION >= 0x040500
 | 
					
						
							| 
									
										
										
										
											2009-04-28 10:58:55 +02:00
										 |  |  |     //Employee e1(1, "Herbert");
 | 
					
						
							|  |  |  |     //Employee e2 = e1;
 | 
					
						
							| 
									
										
										
										
											2010-06-11 13:44:18 +02:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2009-04-28 10:58:55 +02:00
										 |  |  |     QSharedPointer<int> iptr(new int(43)); | 
					
						
							|  |  |  |     QSharedPointer<int> iptr2 = iptr; | 
					
						
							|  |  |  |     QSharedPointer<int> iptr3 = iptr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QSharedPointer<QString> ptr(new QString("hallo")); | 
					
						
							|  |  |  |     QSharedPointer<QString> ptr2 = ptr; | 
					
						
							|  |  |  |     QSharedPointer<QString> ptr3 = ptr; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-29 17:46:37 +02:00
										 |  |  |     QWeakPointer<int> wiptr(iptr); | 
					
						
							|  |  |  |     QWeakPointer<int> wiptr2 = wiptr; | 
					
						
							|  |  |  |     QWeakPointer<int> wiptr3 = wiptr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QWeakPointer<QString> wptr(ptr); | 
					
						
							|  |  |  |     QWeakPointer<QString> wptr2 = wptr; | 
					
						
							|  |  |  |     QWeakPointer<QString> wptr3 = wptr; | 
					
						
							| 
									
										
										
										
											2010-06-11 13:44:18 +02:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QSharedPointer<Foo> fptr(new Foo(1)); | 
					
						
							|  |  |  |     QWeakPointer<Foo> wfptr(fptr); | 
					
						
							|  |  |  |     QWeakPointer<Foo> wfptr2 = wfptr; | 
					
						
							|  |  |  |     QWeakPointer<Foo> wfptr3 = wfptr; | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | #    endif
 | 
					
						
							| 
									
										
										
										
											2009-04-07 13:50:21 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-29 14:57:15 +02:00
										 |  |  | void testQXmlAttributes() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QXmlAttributes atts; | 
					
						
							|  |  |  |     atts.append("name1", "uri1", "localPart1", "value1"); | 
					
						
							|  |  |  |     atts.append("name2", "uri2", "localPart2", "value2"); | 
					
						
							|  |  |  |     atts.append("name3", "uri3", "localPart3", "value3"); | 
					
						
							|  |  |  |     int n = atts.count(); | 
					
						
							|  |  |  |     ++n; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | void stringRefTest(const QString &refstring) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_UNUSED(refstring); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-16 11:17:00 +01:00
										 |  |  | void testStdDeque() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-11-25 15:08:18 +01:00
										 |  |  |     // This is not supposed to work with the compiled dumpers.
 | 
					
						
							| 
									
										
										
										
											2009-01-16 11:17:00 +01:00
										 |  |  |     std::deque<int *> plist1; | 
					
						
							|  |  |  |     plist1.push_back(new int(1)); | 
					
						
							|  |  |  |     plist1.push_back(0); | 
					
						
							|  |  |  |     plist1.push_back(new int(2)); | 
					
						
							|  |  |  |     plist1.pop_back(); | 
					
						
							|  |  |  |     plist1.pop_front(); | 
					
						
							|  |  |  |     plist1.pop_front(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::deque<int> flist2; | 
					
						
							|  |  |  |     flist2.push_back(1); | 
					
						
							|  |  |  |     flist2.push_back(2); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::deque<Foo *> plist; | 
					
						
							|  |  |  |     plist.push_back(new Foo(1)); | 
					
						
							|  |  |  |     plist.push_back(new Foo(2)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::deque<Foo> flist; | 
					
						
							|  |  |  |     flist.push_back(1); | 
					
						
							|  |  |  |     flist.push_front(2); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-15 18:28:58 +02:00
										 |  |  | void testStdHashSet() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-11-25 15:08:18 +01:00
										 |  |  |     // This is not supposed to work with the compiled dumpers.
 | 
					
						
							| 
									
										
										
										
											2010-04-15 18:28:58 +02:00
										 |  |  | #if USE_GCC_EXT
 | 
					
						
							|  |  |  |     using namespace __gnu_cxx; | 
					
						
							|  |  |  |     hash_set<int> h; | 
					
						
							|  |  |  |     h.insert(1); | 
					
						
							|  |  |  |     h.insert(194); | 
					
						
							|  |  |  |     h.insert(2); | 
					
						
							|  |  |  |     h.insert(3); | 
					
						
							|  |  |  |     h.insert(4); | 
					
						
							|  |  |  |     h.insert(5); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | std::list<int> testStdList() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-11-25 15:08:18 +01:00
										 |  |  |     // This is not supposed to work with the compiled dumpers.
 | 
					
						
							| 
									
										
										
										
											2009-07-10 09:48:51 +02:00
										 |  |  |     std::list<int> big; | 
					
						
							|  |  |  |     for (int i = 0; i < 10000; ++i) | 
					
						
							|  |  |  |         big.push_back(i); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-14 10:07:15 +02:00
										 |  |  |     std::list<Foo> flist; | 
					
						
							|  |  |  |     for (int i = 0; i < 100; ++i) | 
					
						
							|  |  |  |         flist.push_back(i + 15); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-08 14:38:42 +02:00
										 |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  |     std::list<int *> plist1; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     plist1.push_back(new int(1)); | 
					
						
							|  |  |  |     plist1.push_back(0); | 
					
						
							|  |  |  |     plist1.push_back(new int(2)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  |     std::list<int> flist2; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     flist2.push_back(1); | 
					
						
							|  |  |  |     flist2.push_back(2); | 
					
						
							|  |  |  |     flist2.push_back(3); | 
					
						
							|  |  |  |     flist2.push_back(4); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     flist2.push_back(1); | 
					
						
							|  |  |  |     flist2.push_back(2); | 
					
						
							|  |  |  |     flist2.push_back(3); | 
					
						
							|  |  |  |     flist2.push_back(4); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  |     std::list<Foo *> plist; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     plist.push_back(new Foo(1)); | 
					
						
							|  |  |  |     plist.push_back(0); | 
					
						
							|  |  |  |     plist.push_back(new Foo(2)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-04 14:47:45 +02:00
										 |  |  |     foreach (Foo f, flist) | 
					
						
							|  |  |  |     {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  |     std::list<bool> vec; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     vec.push_back(true); | 
					
						
							|  |  |  |     vec.push_back(false); | 
					
						
							| 
									
										
										
										
											2009-07-14 10:07:15 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-10-07 16:36:25 +02:00
										 |  |  |     std::list<int> result; | 
					
						
							|  |  |  |     return result; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-11 16:10:47 +01:00
										 |  |  | void testStdMap() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-11-25 15:08:18 +01:00
										 |  |  |     // This is not supposed to work with the compiled dumpers.
 | 
					
						
							| 
									
										
										
										
											2011-05-16 15:14:30 +02:00
										 |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2008-12-12 12:55:05 +01:00
										 |  |  |     std::map<QString, Foo> gg3; | 
					
						
							|  |  |  |     gg3["22.0"] = Foo(22); | 
					
						
							|  |  |  |     gg3["33.0"] = Foo(33); | 
					
						
							|  |  |  |     gg3["44.0"] = Foo(44); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-17 15:46:27 +01:00
										 |  |  |     std::map<const char *, Foo> m1; | 
					
						
							|  |  |  |     m1["22.0"] = Foo(22); | 
					
						
							|  |  |  |     m1["33.0"] = Foo(33); | 
					
						
							|  |  |  |     m1["44.0"] = Foo(44); | 
					
						
							| 
									
										
										
										
											2010-03-22 13:12:32 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-12 12:55:05 +01:00
										 |  |  |     std::map<uint, uint> gg; | 
					
						
							|  |  |  |     gg[11] = 1; | 
					
						
							|  |  |  |     gg[22] = 2; | 
					
						
							|  |  |  |     gg[33] = 3; | 
					
						
							|  |  |  |     gg[44] = 4; | 
					
						
							|  |  |  |     gg[55] = 5; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-22 13:12:32 +01:00
										 |  |  |     std::pair<uint, QStringList> p = std::make_pair(3, QStringList() << "11"); | 
					
						
							|  |  |  |     std::vector< std::pair<uint, QStringList> > v; | 
					
						
							|  |  |  |     v.push_back(p); | 
					
						
							|  |  |  |     v.push_back(p); | 
					
						
							| 
									
										
										
										
											2009-06-12 14:26:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-11 16:10:47 +01:00
										 |  |  |     std::map<uint, QStringList> ggl; | 
					
						
							|  |  |  |     ggl[11] = QStringList() << "11"; | 
					
						
							|  |  |  |     ggl[22] = QStringList() << "22"; | 
					
						
							| 
									
										
										
										
											2008-12-12 12:55:05 +01:00
										 |  |  |     ggl[33] = QStringList() << "33"; | 
					
						
							|  |  |  |     ggl[44] = QStringList() << "44"; | 
					
						
							|  |  |  |     ggl[55] = QStringList() << "55"; | 
					
						
							| 
									
										
										
										
											2008-12-11 16:10:47 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     typedef std::map<uint, QStringList> T; | 
					
						
							|  |  |  |     T ggt; | 
					
						
							|  |  |  |     ggt[11] = QStringList() << "11"; | 
					
						
							|  |  |  |     ggt[22] = QStringList() << "22"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::map<uint, float> gg0; | 
					
						
							|  |  |  |     gg0[11] = 11.0; | 
					
						
							|  |  |  |     gg0[22] = 22.0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::map<QString, float> gg1; | 
					
						
							|  |  |  |     gg1["22.0"] = 22.0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::map<int, QString> gg2; | 
					
						
							|  |  |  |     gg2[22] = "22.0"; | 
					
						
							| 
									
										
										
										
											2010-03-22 13:12:32 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-12-11 16:10:47 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-22 13:12:32 +01:00
										 |  |  | #if 1
 | 
					
						
							| 
									
										
										
										
											2008-12-11 16:10:47 +01:00
										 |  |  |     QObject ob; | 
					
						
							|  |  |  |     std::map<QString, QPointer<QObject> > map; | 
					
						
							| 
									
										
										
										
											2008-12-12 12:55:05 +01:00
										 |  |  |     map["Hallo"] = QPointer<QObject>(&ob); | 
					
						
							|  |  |  |     map["Welt"] = QPointer<QObject>(&ob); | 
					
						
							|  |  |  |     map["."] = QPointer<QObject>(&ob); | 
					
						
							| 
									
										
										
										
											2008-12-11 16:10:47 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | std::set<int> testStdSet() | 
					
						
							| 
									
										
										
										
											2009-03-11 13:31:38 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-11-25 15:08:18 +01:00
										 |  |  |     // This is not supposed to work with the compiled dumpers.
 | 
					
						
							| 
									
										
										
										
											2009-03-11 13:31:38 +01:00
										 |  |  |     std::set<int> hgg0; | 
					
						
							|  |  |  |     hgg0.insert(11); | 
					
						
							|  |  |  |     hgg0.insert(22); | 
					
						
							|  |  |  |     hgg0.insert(33); | 
					
						
							|  |  |  | #if 1
 | 
					
						
							|  |  |  |     std::set<QString> hgg1; | 
					
						
							|  |  |  |     hgg1.insert("22.0"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QObject ob; | 
					
						
							|  |  |  |     std::set<QPointer<QObject> > hash; | 
					
						
							|  |  |  |     QPointer<QObject> ptr(&ob); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-10-07 16:36:25 +02:00
										 |  |  |     std::set<int> result; | 
					
						
							|  |  |  |     return result; | 
					
						
							| 
									
										
										
										
											2009-03-11 13:31:38 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | std::stack<int> testStdStack() | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-11-25 15:08:18 +01:00
										 |  |  |     // This is not supposed to work with the compiled dumpers.
 | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  |     std::stack<int *> plist1; | 
					
						
							|  |  |  |     plist1.push(new int(1)); | 
					
						
							|  |  |  |     plist1.push(0); | 
					
						
							|  |  |  |     plist1.push(new int(2)); | 
					
						
							|  |  |  |     plist1.pop(); | 
					
						
							|  |  |  |     plist1.pop(); | 
					
						
							|  |  |  |     plist1.pop(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::stack<int> flist2; | 
					
						
							|  |  |  |     flist2.push(1); | 
					
						
							|  |  |  |     flist2.push(2); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::stack<Foo *> plist; | 
					
						
							|  |  |  |     plist.push(new Foo(1)); | 
					
						
							|  |  |  |     plist.push(new Foo(2)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::stack<Foo> flist; | 
					
						
							|  |  |  |     flist.push(1); | 
					
						
							|  |  |  |     flist.push(2); | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-07 16:36:25 +02:00
										 |  |  |     std::stack<int> result; | 
					
						
							|  |  |  |     return result; | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | std::string testStdString() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QString foo; | 
					
						
							|  |  |  |     std::string str; | 
					
						
							|  |  |  |     std::wstring wstr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::vector<std::string> v; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     foo += "a"; | 
					
						
							|  |  |  |     str += "b"; | 
					
						
							|  |  |  |     wstr += wchar_t('e'); | 
					
						
							|  |  |  |     foo += "c"; | 
					
						
							|  |  |  |     str += "d"; | 
					
						
							|  |  |  |     foo += "e"; | 
					
						
							|  |  |  |     wstr += wchar_t('e'); | 
					
						
							|  |  |  |     str += "e"; | 
					
						
							|  |  |  |     foo += "a"; | 
					
						
							|  |  |  |     str += "b"; | 
					
						
							|  |  |  |     foo += "c"; | 
					
						
							|  |  |  |     str += "d"; | 
					
						
							|  |  |  |     str += "e"; | 
					
						
							|  |  |  |     wstr += wchar_t('e'); | 
					
						
							|  |  |  |     wstr += wchar_t('e'); | 
					
						
							|  |  |  |     str += "e"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QList<std::string> l; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     l.push_back(str); | 
					
						
							|  |  |  |     l.push_back(str); | 
					
						
							|  |  |  |     l.push_back(str); | 
					
						
							|  |  |  |     l.push_back(str); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     v.push_back(str); | 
					
						
							|  |  |  |     v.push_back(str); | 
					
						
							|  |  |  |     v.push_back(str); | 
					
						
							|  |  |  |     v.push_back(str); | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-07 16:36:25 +02:00
										 |  |  |     std::string result = "hi"; | 
					
						
							|  |  |  |     return result; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-22 19:45:08 +02:00
										 |  |  | void testStdVector() | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     std::vector<int *> plist1; | 
					
						
							|  |  |  |     plist1.push_back(new int(1)); | 
					
						
							|  |  |  |     plist1.push_back(0); | 
					
						
							|  |  |  |     plist1.push_back(new int(2)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::vector<int> flist2; | 
					
						
							|  |  |  |     flist2.push_back(1); | 
					
						
							|  |  |  |     flist2.push_back(2); | 
					
						
							|  |  |  |     flist2.push_back(3); | 
					
						
							|  |  |  |     flist2.push_back(4); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     flist2.push_back(1); | 
					
						
							|  |  |  |     flist2.push_back(2); | 
					
						
							|  |  |  |     flist2.push_back(3); | 
					
						
							|  |  |  |     flist2.push_back(4); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::vector<Foo *> plist; | 
					
						
							|  |  |  |     plist.push_back(new Foo(1)); | 
					
						
							|  |  |  |     plist.push_back(0); | 
					
						
							|  |  |  |     plist.push_back(new Foo(2)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::vector<Foo> flist; | 
					
						
							|  |  |  |     flist.push_back(1); | 
					
						
							|  |  |  |     flist.push_back(2); | 
					
						
							|  |  |  |     flist.push_back(3); | 
					
						
							|  |  |  |     flist.push_back(4); | 
					
						
							|  |  |  |     //flist.takeFirst();
 | 
					
						
							|  |  |  |     //flist.takeFirst();
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::vector<bool> vec; | 
					
						
							|  |  |  |     vec.push_back(true); | 
					
						
							|  |  |  |     vec.push_back(false); | 
					
						
							| 
									
										
										
										
											2010-07-22 19:45:08 +02:00
										 |  |  |     vec.push_back(false); | 
					
						
							|  |  |  |     vec.push_back(true); | 
					
						
							|  |  |  |     vec.push_back(false); | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-03 12:46:55 +02:00
										 |  |  | void testQStandardItemModel() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-04-21 12:21:45 +02:00
										 |  |  |     //char buf[100];
 | 
					
						
							|  |  |  |     //QString *s = static_cast<QString *>(static_cast<void *>(&(v.data_ptr().data.c)));
 | 
					
						
							|  |  |  |     //QString *t = (QString *)&(v.data_ptr());
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-03 12:46:55 +02:00
										 |  |  |     QStandardItemModel m; | 
					
						
							|  |  |  |     QStandardItem *i1, *i2, *i11; | 
					
						
							|  |  |  |     m.appendRow(QList<QStandardItem *>() | 
					
						
							| 
									
										
										
										
											2010-04-21 12:21:45 +02:00
										 |  |  |          << (i1 = new QStandardItem("1")) << (new QStandardItem("a")) << (new QStandardItem("a2"))); | 
					
						
							| 
									
										
										
										
											2010-06-09 12:03:57 +02:00
										 |  |  |     QModelIndex mi = i1->index(); | 
					
						
							| 
									
										
										
										
											2009-06-03 12:46:55 +02:00
										 |  |  |     m.appendRow(QList<QStandardItem *>() | 
					
						
							|  |  |  |          << (i2 = new QStandardItem("2")) << (new QStandardItem("b"))); | 
					
						
							|  |  |  |     i1->appendRow(QList<QStandardItem *>() | 
					
						
							|  |  |  |          << (i11 = new QStandardItem("11")) << (new QStandardItem("aa"))); | 
					
						
							|  |  |  |     int i = 1; | 
					
						
							|  |  |  |     ++i; | 
					
						
							| 
									
										
										
										
											2010-03-30 17:38:57 +02:00
										 |  |  |     ++i; | 
					
						
							| 
									
										
										
										
											2009-06-03 12:46:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | QStack<int> testQStack() | 
					
						
							| 
									
										
										
										
											2009-08-28 09:44:11 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     QVector<int> bigv; | 
					
						
							|  |  |  |     for (int i = 0; i < 10; ++i) | 
					
						
							|  |  |  |         bigv.append(i); | 
					
						
							|  |  |  |     QStack<int> big; | 
					
						
							|  |  |  |     for (int i = 0; i < 10; ++i) | 
					
						
							|  |  |  |         big.append(i); | 
					
						
							|  |  |  |     QStack<Foo *> plist; | 
					
						
							|  |  |  |     plist.append(new Foo(1)); | 
					
						
							|  |  |  |     plist.append(0); | 
					
						
							|  |  |  |     plist.append(new Foo(2)); | 
					
						
							|  |  |  |     QStack<Foo> flist; | 
					
						
							|  |  |  |     flist.append(1); | 
					
						
							|  |  |  |     flist.append(2); | 
					
						
							|  |  |  |     flist.append(3); | 
					
						
							|  |  |  |     flist.append(4); | 
					
						
							|  |  |  |     //flist.takeFirst();
 | 
					
						
							|  |  |  |     //flist.takeFirst();
 | 
					
						
							|  |  |  |     QStack<bool> vec; | 
					
						
							|  |  |  |     vec.append(true); | 
					
						
							|  |  |  |     vec.append(false); | 
					
						
							| 
									
										
										
										
											2010-10-07 16:36:25 +02:00
										 |  |  |     QStack<int> result; | 
					
						
							|  |  |  |     return result; | 
					
						
							| 
									
										
										
										
											2009-08-28 09:44:11 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-26 10:40:31 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void testQUrl() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-04-21 19:25:09 +02:00
										 |  |  |     QUrl url(QString("http://www.nokia.com")); | 
					
						
							| 
									
										
										
										
											2010-10-26 10:40:31 +02:00
										 |  |  |     (void) url; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-28 13:24:25 +02:00
										 |  |  | void testLongEvaluation() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QDateTime time = QDateTime::currentDateTime(); | 
					
						
							|  |  |  |     QVector<QDateTime> bigv; | 
					
						
							|  |  |  |     for (int i = 0; i < 10000; ++i) | 
					
						
							|  |  |  |         bigv.append(time); | 
					
						
							|  |  |  |     int s = bigv.size(); | 
					
						
							|  |  |  |     ++s; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-26 10:40:31 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef FOP
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int xxxx() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-02 13:11:39 +01:00
										 |  |  | void xxxx() | 
					
						
							| 
									
										
										
										
											2010-10-26 10:40:31 +02:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testQString() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-08-03 17:04:32 +02:00
										 |  |  |     QString str1("Hello Qt"); // --> Value: "Hello Qt"
 | 
					
						
							|  |  |  |     QString str2("Hello\nQt"); // --> Value: ""Hello\nQt"" (double quote not expected)
 | 
					
						
							|  |  |  |     QString str3("Hello\rQt"); // --> Value: ""HelloQt"" (double quote and missing \r not expected)
 | 
					
						
							|  |  |  |     QString str4("Hello\tQt"); // --> Value: "Hello\9Qt" (expected \t instead of \9)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QString str = "Hello "; | 
					
						
							|  |  |  |     str += " big, "; | 
					
						
							| 
									
										
										
										
											2011-08-03 14:36:07 +02:00
										 |  |  |     str += "\t"; | 
					
						
							|  |  |  |     str += "\r"; | 
					
						
							|  |  |  |     str += "\n"; | 
					
						
							|  |  |  |     str += QLatin1Char(0); | 
					
						
							|  |  |  |     str += QLatin1Char(1); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     str += " fat "; | 
					
						
							|  |  |  |     str += " World "; | 
					
						
							|  |  |  |     str += " World "; | 
					
						
							|  |  |  |     str += " World "; | 
					
						
							|  |  |  |     str += " World "; | 
					
						
							|  |  |  |     str += " World "; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  | void testQString3() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QString str = "Hello "; | 
					
						
							|  |  |  |     str += " big, "; | 
					
						
							|  |  |  |     str += " fat "; | 
					
						
							|  |  |  |     str += " World "; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QString string("String Test"); | 
					
						
							|  |  |  |     QString *pstring = new QString("Pointer String Test"); | 
					
						
							|  |  |  |     stringRefTest(QString("Ref String Test")); | 
					
						
							|  |  |  |     string = "Hi"; | 
					
						
							|  |  |  |     string += "Du"; | 
					
						
							|  |  |  |     qDebug() << string; | 
					
						
							|  |  |  |     delete pstring; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | QStringList testQStringList() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QStringList l; | 
					
						
							|  |  |  |     l << "Hello "; | 
					
						
							|  |  |  |     l << " big, "; | 
					
						
							|  |  |  |     l << " fat "; | 
					
						
							| 
									
										
										
										
											2010-05-06 16:23:18 +02:00
										 |  |  |     l.takeFirst(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     l << " World "; | 
					
						
							| 
									
										
										
										
											2010-10-07 16:36:25 +02:00
										 |  |  |     QStringList result; | 
					
						
							|  |  |  |     return result; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | Foo testStruct() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     Foo f(2); | 
					
						
							|  |  |  |     f.doit(); | 
					
						
							|  |  |  |     f.doit(); | 
					
						
							|  |  |  |     f.doit(); | 
					
						
							| 
									
										
										
										
											2010-08-19 14:53:40 +02:00
										 |  |  |     Foo f1 = f; | 
					
						
							|  |  |  |     f1.doit(); | 
					
						
							|  |  |  |     return f1; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-12 11:52:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 18:31:31 +02:00
										 |  |  | namespace formats { | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 18:31:31 +02:00
										 |  |  |     void testString() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         const wchar_t *w = L"aöa"; | 
					
						
							|  |  |  |         QString u; | 
					
						
							|  |  |  |         if (sizeof(wchar_t) == 4) | 
					
						
							|  |  |  |             u = QString::fromUcs4((uint *)w); | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |             u = QString::fromUtf16((ushort *)w); | 
					
						
							|  |  |  |         // <== break here
 | 
					
						
							|  |  |  |         // All: Select UTF-8 in "Change Format for Type" in L&W context menu.
 | 
					
						
							|  |  |  |         // Windows: Select UTF-16 in "Change Format for Type" in L&W context menu.
 | 
					
						
							|  |  |  |         // Other: Select UCS-6 in "Change Format for Type" in L&W context menu.
 | 
					
						
							|  |  |  |         dummyStatement(&u, &w); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-10-12 11:52:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 18:31:31 +02:00
										 |  |  |     void testCharPointers() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // These tests should result in properly displayed umlauts in the
 | 
					
						
							|  |  |  |         // Locals&Watchers view. It is only support on gdb with Python.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const char *s = "aöa"; | 
					
						
							|  |  |  |         const char *t = "a\xc3\xb6"; | 
					
						
							|  |  |  |         const wchar_t *w = L"aöa"; | 
					
						
							|  |  |  |         // <== break here
 | 
					
						
							|  |  |  |         // All: Select UTF-8 in "Change Format for Type" in L&W context menu.
 | 
					
						
							|  |  |  |         // Windows: Select UTF-16 in "Change Format for Type" in L&W context menu.
 | 
					
						
							|  |  |  |         // Other: Select UCS-6 in "Change Format for Type" in L&W context menu.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Make sure to undo "Change Format".
 | 
					
						
							|  |  |  |         dummyStatement(&s, &w); | 
					
						
							|  |  |  |         dummyStatement(&t); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testCharArrays() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // These tests should result in properly displayed umlauts in the
 | 
					
						
							|  |  |  |         // Locals&Watchers view. It is only support on gdb with Python.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const char s[] = "aöa"; | 
					
						
							|  |  |  |         const wchar_t w[] = L"aöa"; | 
					
						
							|  |  |  |         // <== break here
 | 
					
						
							|  |  |  |         // All: Select UTF-8 in "Change Format for Type" in L&W context menu.
 | 
					
						
							|  |  |  |         // Windows: Select UTF-16 in "Change Format for Type" in L&W context menu.
 | 
					
						
							|  |  |  |         // Other: Select UCS-6 in "Change Format for Type" in L&W context menu.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Make sure to undo "Change Format".
 | 
					
						
							|  |  |  |         dummyStatement(&s, &w); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testFormats() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         testCharPointers(); | 
					
						
							|  |  |  |         testCharArrays(); | 
					
						
							|  |  |  |         testString(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace formats
 | 
					
						
							| 
									
										
										
										
											2010-10-12 11:52:11 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-28 09:35:59 +02:00
										 |  |  | void testQTextCursor() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     //int argc = 0;
 | 
					
						
							|  |  |  |     //char *argv[] = { "xxx", 0 };
 | 
					
						
							|  |  |  |     //QApplication app(argc, argv);
 | 
					
						
							|  |  |  |     QTextDocument doc; | 
					
						
							|  |  |  |     doc.setPlainText("Hallo\nWorld"); | 
					
						
							| 
									
										
										
										
											2010-10-13 10:14:42 +02:00
										 |  |  |     QTextCursor tc; | 
					
						
							|  |  |  |     tc = doc.find("all"); | 
					
						
							| 
									
										
										
										
											2010-09-28 09:35:59 +02:00
										 |  |  |     int pos = tc.position(); | 
					
						
							|  |  |  |     int anc = tc.anchor(); | 
					
						
							|  |  |  |     Q_UNUSED(pos); | 
					
						
							|  |  |  |     Q_UNUSED(anc); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  | namespace qthread { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |     class Thread : public QThread | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     public: | 
					
						
							|  |  |  |         Thread(int id) : m_id(id) {} | 
					
						
							| 
									
										
										
										
											2009-07-01 14:15:10 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |         void run() | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             int j = 2; | 
					
						
							|  |  |  |             ++j; | 
					
						
							|  |  |  |             for (int i = 0; i != 100000; ++i) { | 
					
						
							|  |  |  |                 //sleep(1);
 | 
					
						
							|  |  |  |                 std::cerr << m_id; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             if (m_id == 2) { | 
					
						
							|  |  |  |                 ++j; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             std::cerr << j; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     private: | 
					
						
							|  |  |  |         int m_id; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testQThread() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         Thread thread1(1); | 
					
						
							|  |  |  |         Thread thread2(2); | 
					
						
							|  |  |  |         thread1.setObjectName("This is the first thread"); | 
					
						
							|  |  |  |         thread2.setObjectName("This is another thread"); | 
					
						
							|  |  |  |         thread1.start(); | 
					
						
							|  |  |  |         thread2.start(); | 
					
						
							|  |  |  |         thread1.wait(); | 
					
						
							|  |  |  |         thread2.wait(); | 
					
						
							|  |  |  |         dummyStatement(&thread1); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-20 11:34:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  | Q_DECLARE_METATYPE(QHostAddress) | 
					
						
							|  |  |  | Q_DECLARE_METATYPE(QList<int>) | 
					
						
							|  |  |  | Q_DECLARE_METATYPE(QStringList) | 
					
						
							|  |  |  | #define COMMA ,
 | 
					
						
							|  |  |  | Q_DECLARE_METATYPE(QMap<uint COMMA QStringList>) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace qvariant { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testQVariant1() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QVariant value; | 
					
						
							|  |  |  |         QVariant::Type t = QVariant::String; | 
					
						
							|  |  |  |         value = QVariant(t, (void*)0); | 
					
						
							|  |  |  |         *(QString*)value.data() = QString("Some string"); | 
					
						
							|  |  |  |         int i = 1; // <=== break here
 | 
					
						
							|  |  |  |         // Check the variant contains a proper QString.
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |         dummyStatement(&i); | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testQVariant2() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QVariant var;                        // Type 0, invalid
 | 
					
						
							|  |  |  |         // <== break here
 | 
					
						
							|  |  |  |         // Step through with F10.
 | 
					
						
							|  |  |  |         // Check var contains objects of the types indicated.
 | 
					
						
							|  |  |  |         var.setValue(true);                  // 1, bool
 | 
					
						
							|  |  |  |         var.setValue(2);                     // 2, int
 | 
					
						
							|  |  |  |         var.setValue(3u);                    // 3, uint
 | 
					
						
							|  |  |  |         var.setValue(qlonglong(4));          // 4, qlonglong
 | 
					
						
							|  |  |  |         var.setValue(qulonglong(5));         // 5, qulonglong
 | 
					
						
							|  |  |  |         var.setValue(double(6));             // 6, double
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         var.setValue(QChar(7));              // 7, QChar
 | 
					
						
							|  |  |  |         //None,          # 8, QVariantMap
 | 
					
						
							|  |  |  |         // None,          # 9, QVariantList
 | 
					
						
							|  |  |  |         var.setValue(QString("Hello 10"));   // 10, QString
 | 
					
						
							|  |  |  |         var.setValue(QRect(100, 200, 300, 400)); // 19 QRect
 | 
					
						
							|  |  |  |         var.setValue(QRectF(100, 200, 300, 400)); // 19 QRectF
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         /*
 | 
					
						
							|  |  |  |          "QStringList", # 11 | 
					
						
							|  |  |  |          "QByteArray",  # 12 | 
					
						
							|  |  |  |          "QBitArray",   # 13 | 
					
						
							|  |  |  |          "QDate",       # 14 | 
					
						
							|  |  |  |          "QTime",       # 15 | 
					
						
							|  |  |  |          "QDateTime",   # 16 | 
					
						
							|  |  |  |          "QUrl",        # 17 | 
					
						
							|  |  |  |          "QLocale",     # 18 | 
					
						
							|  |  |  |          "QRect",       # 19 | 
					
						
							|  |  |  |          "QRectF",      # 20 | 
					
						
							|  |  |  |          "QSize",       # 21 | 
					
						
							|  |  |  |          "QSizeF",      # 22 | 
					
						
							|  |  |  |          "QLine",       # 23 | 
					
						
							|  |  |  |          "QLineF",      # 24 | 
					
						
							|  |  |  |          "QPoint",      # 25 | 
					
						
							|  |  |  |          "QPointF",     # 26 | 
					
						
							|  |  |  |          "QRegExp",     # 27 | 
					
						
							|  |  |  |          */ | 
					
						
							|  |  |  |         var.isValid(); // Dummy
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testQVariant3() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QVariant var; | 
					
						
							|  |  |  |         // <== break here.
 | 
					
						
							|  |  |  |         // Expand var.
 | 
					
						
							|  |  |  |         // Step with F10.
 | 
					
						
							|  |  |  |         // Check the list is updated properly.
 | 
					
						
							|  |  |  |         var.setValue(QStringList() << "World"); | 
					
						
							|  |  |  |         var.setValue(QStringList() << "World" << "Hello"); | 
					
						
							|  |  |  |         var.setValue(QStringList() << "Hello" << "Hello"); | 
					
						
							|  |  |  |         var.setValue(QStringList() << "World" << "Hello" << "Hello"); | 
					
						
							|  |  |  |         dummyStatement(&var); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testQVariant4() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QVariant var; | 
					
						
							|  |  |  |         QHostAddress ha("127.0.0.1"); | 
					
						
							|  |  |  |         var.setValue(ha); | 
					
						
							|  |  |  |         QHostAddress ha1 = var.value<QHostAddress>(); | 
					
						
							|  |  |  |         // <== break here
 | 
					
						
							|  |  |  |         // Check var and ha1 look correct.
 | 
					
						
							|  |  |  |         dummyStatement(&ha1); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testQVariant5() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // This checks user defined types in QVariants.
 | 
					
						
							|  |  |  |         typedef QMap<uint, QStringList> MyType; | 
					
						
							|  |  |  |         MyType my; | 
					
						
							|  |  |  |         my[1] = (QStringList() << "Hello"); | 
					
						
							|  |  |  |         my[3] = (QStringList() << "World"); | 
					
						
							|  |  |  |         QVariant var; | 
					
						
							|  |  |  |         var.setValue(my); | 
					
						
							|  |  |  |         // FIXME: Known to break
 | 
					
						
							|  |  |  |         //QString type = var.typeName();
 | 
					
						
							|  |  |  |         var.setValue(my); // <== break here
 | 
					
						
							|  |  |  |         var.setValue(my); | 
					
						
							|  |  |  |         var.setValue(my); | 
					
						
							|  |  |  |         var.setValue(my); | 
					
						
							|  |  |  |         dummyStatement(&var); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testQVariant6() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QVariantList vl; | 
					
						
							|  |  |  |         vl.append(QVariant(1)); | 
					
						
							|  |  |  |         vl.append(QVariant(2)); | 
					
						
							|  |  |  |         vl.append(QVariant("Some String")); | 
					
						
							|  |  |  |         vl.append(QVariant(21)); | 
					
						
							|  |  |  |         vl.append(QVariant(22)); | 
					
						
							|  |  |  |         vl.append(QVariant("2Some String")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         QList<int> list; | 
					
						
							|  |  |  |         list << 1 << 2 << 3; | 
					
						
							|  |  |  |         QVariant variant = qVariantFromValue(list); | 
					
						
							|  |  |  |         list.clear(); | 
					
						
							|  |  |  |         list = qVariantValue<QList<int> >(variant); | 
					
						
							|  |  |  |         dummyStatement(&list); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testQVariant() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         testQVariant1(); | 
					
						
							|  |  |  |         testQVariant2(); | 
					
						
							|  |  |  |         testQVariant3(); | 
					
						
							|  |  |  |         testQVariant4(); | 
					
						
							|  |  |  |         testQVariant5(); | 
					
						
							|  |  |  |         testQVariant6(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace qvariant
 | 
					
						
							| 
									
										
										
										
											2010-10-07 16:36:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | namespace qvector { | 
					
						
							| 
									
										
										
										
											2008-12-10 16:48:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     void testQVector1() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // This tests the display of a big vector.
 | 
					
						
							|  |  |  |         QVector<int> big(10000); | 
					
						
							|  |  |  |         // <=== break here
 | 
					
						
							|  |  |  |         // step over
 | 
					
						
							|  |  |  |         // check that the display updates in reasonable time
 | 
					
						
							|  |  |  |         big[1] = 1; | 
					
						
							|  |  |  |         big[2] = 2; | 
					
						
							|  |  |  |         big[3] = 3; | 
					
						
							|  |  |  |         big[4] = 4; | 
					
						
							|  |  |  |         big[5] = 5; | 
					
						
							|  |  |  |         big[9] = 9; | 
					
						
							|  |  |  |         big.append(1); | 
					
						
							|  |  |  |         big.append(1); | 
					
						
							|  |  |  |         big.append(1); | 
					
						
							|  |  |  |         big.append(1); | 
					
						
							|  |  |  |         dummyStatement(&big); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     void testQVector2() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // This tests the display of a vector of pointers to custom structs.
 | 
					
						
							|  |  |  |         QVector<Foo> flist; | 
					
						
							|  |  |  |         // <== break here
 | 
					
						
							|  |  |  |         // step over, check display.
 | 
					
						
							|  |  |  |         flist.append(1); | 
					
						
							|  |  |  |         flist.append(2); | 
					
						
							|  |  |  |         flist.append(3); | 
					
						
							|  |  |  |         flist.append(4); | 
					
						
							|  |  |  |         dummyStatement(&flist); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     void testQVector3() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // This tests the display of a vector of pointers to custom structs.
 | 
					
						
							|  |  |  |         QVector<Foo *> plist; | 
					
						
							|  |  |  |         // <=== break here
 | 
					
						
							|  |  |  |         // step over
 | 
					
						
							|  |  |  |         // check that the display is ok.
 | 
					
						
							|  |  |  |         plist.append(new Foo(1)); | 
					
						
							|  |  |  |         plist.append(0); | 
					
						
							|  |  |  |         plist.append(new Foo(2)); | 
					
						
							|  |  |  |         // switch "Auto derefencing pointers" in Locals context menu
 | 
					
						
							|  |  |  |         // off and on again, and check result looks sane.
 | 
					
						
							|  |  |  |         dummyStatement(&plist); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     void testQVector4() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // This tests the display of a vector of custom structs.
 | 
					
						
							|  |  |  |         QVector<bool> vec; | 
					
						
							|  |  |  |         // <== break here.
 | 
					
						
							|  |  |  |         // step over
 | 
					
						
							|  |  |  |         // check that the display is ok.
 | 
					
						
							|  |  |  |         vec.append(true); | 
					
						
							|  |  |  |         vec.append(false); | 
					
						
							|  |  |  |         dummyStatement(&vec); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     void testQVector5() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QVector<QList<int> > v; | 
					
						
							|  |  |  |         QVector<QList<int> > *pv = &v; | 
					
						
							|  |  |  |         // <=== break here
 | 
					
						
							|  |  |  |         v.append(QList<int>() << 1); | 
					
						
							|  |  |  |         v.append(QList<int>() << 2 << 3); | 
					
						
							|  |  |  |         dummyStatement(pv); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-25 17:19:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     void testQVector() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         testQVector1(); | 
					
						
							|  |  |  |         testQVector2(); | 
					
						
							|  |  |  |         testQVector3(); | 
					
						
							|  |  |  |         testQVector4(); | 
					
						
							|  |  |  |         testQVector5(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-07-08 17:27:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | } // namespace qvector
 | 
					
						
							| 
									
										
										
										
											2009-07-08 17:27:45 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | namespace noargs { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class Goo | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     public: | 
					
						
							|  |  |  |        Goo(const QString &str, const int n) : str_(str), n_(n) {} | 
					
						
							|  |  |  |     private: | 
					
						
							|  |  |  |        QString str_; | 
					
						
							|  |  |  |        int n_; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     typedef QList<Goo> GooList; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testNoArgumentName(int i, int, int k) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // This is not supposed to work with the compiled dumpers.
 | 
					
						
							|  |  |  |         GooList list; | 
					
						
							|  |  |  |         list.append(Goo("Hello", 1)); | 
					
						
							|  |  |  |         list.append(Goo("World", 2)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         QList<Goo> list2; | 
					
						
							|  |  |  |         list2.append(Goo("Hello", 1)); | 
					
						
							|  |  |  |         list2.append(Goo("World", 2)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // <=== break here.
 | 
					
						
							|  |  |  |         // check display is ok, especially for _i_ and _k_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         dummyStatement(&i, &k); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace noargs
 | 
					
						
							| 
									
										
										
										
											2009-07-08 17:27:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-25 17:19:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | void foo() {} | 
					
						
							|  |  |  | void foo(int) {} | 
					
						
							|  |  |  | void foo(QList<int>) {} | 
					
						
							|  |  |  | void foo(QList<QVector<int> >) {} | 
					
						
							|  |  |  | void foo(QList<QVector<int> *>) {} | 
					
						
							|  |  |  | void foo(QList<QVector<int *> *>) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template <class T> | 
					
						
							|  |  |  | void foo(QList<QVector<T> *>) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | namespace namespc { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     class MyBase : public QObject | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     public: | 
					
						
							|  |  |  |         MyBase() {} | 
					
						
							|  |  |  |         virtual void doit(int i) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |            n = i; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     protected: | 
					
						
							|  |  |  |         int n; | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     namespace nested { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |         class MyFoo : public MyBase | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |         public: | 
					
						
							|  |  |  |             MyFoo() {} | 
					
						
							|  |  |  |             virtual void doit(int i) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 // Note there's a local 'n' and one in the base class.
 | 
					
						
							|  |  |  |                 n = i; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         protected: | 
					
						
							|  |  |  |             int n; | 
					
						
							|  |  |  |         }; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |         class MyBar : public MyFoo | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |         public: | 
					
						
							|  |  |  |             virtual void doit(int i) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                n = i + 1; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |         namespace { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |             class MyAnon : public MyBar | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |             public: | 
					
						
							|  |  |  |                 virtual void doit(int i) | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                    n = i + 3; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |             namespace baz { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |                 class MyBaz : public MyAnon | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                 public: | 
					
						
							|  |  |  |                     virtual void doit(int i) | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                        n = i + 5; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 }; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |             } // namespace baz
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |         } // namespace anon
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     } // namespace nested
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testNamespace() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // This checks whether classes with "special" names are
 | 
					
						
							|  |  |  |         // properly displayed.
 | 
					
						
							|  |  |  |         using namespace nested; | 
					
						
							|  |  |  |         MyFoo foo; | 
					
						
							|  |  |  |         MyBar bar; | 
					
						
							|  |  |  |         MyAnon anon; | 
					
						
							|  |  |  |         baz::MyBaz baz; | 
					
						
							|  |  |  |         // <== break here
 | 
					
						
							|  |  |  |         // step into the doit() functions
 | 
					
						
							|  |  |  |         baz.doit(1); | 
					
						
							|  |  |  |         anon.doit(1); | 
					
						
							|  |  |  |         foo.doit(1); | 
					
						
							|  |  |  |         bar.doit(1); | 
					
						
							|  |  |  |         dummyStatement(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace namespc
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  | void testHidden() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     int  n = 1; | 
					
						
							|  |  |  |     n = 2; | 
					
						
							|  |  |  |     n = 3; | 
					
						
							| 
									
										
										
										
											2010-11-26 12:30:05 +01:00
										 |  |  |     n = 4; | 
					
						
							|  |  |  |     n = 4; | 
					
						
							|  |  |  |     n = 5; | 
					
						
							|  |  |  |     n = 6; | 
					
						
							|  |  |  |     n = 7; | 
					
						
							|  |  |  |     n = 8; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         QString n = "2"; | 
					
						
							|  |  |  |         n = "3"; | 
					
						
							|  |  |  |         n = "4"; | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             double n = 3.5; | 
					
						
							|  |  |  |             ++n; | 
					
						
							|  |  |  |             ++n; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         n = "3"; | 
					
						
							|  |  |  |         n = "4"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     ++n; | 
					
						
							|  |  |  |     ++n; | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-23 10:24:25 +02:00
										 |  |  | void testObject1() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QObject parent; | 
					
						
							|  |  |  |     parent.setObjectName("A Parent"); | 
					
						
							|  |  |  |     QObject child(&parent); | 
					
						
							|  |  |  |     child.setObjectName("A Child"); | 
					
						
							| 
									
										
										
										
											2009-06-25 15:00:57 +02:00
										 |  |  |     QObject::connect(&child, SIGNAL(destroyed()), qApp, SLOT(quit())); | 
					
						
							|  |  |  |     QObject::disconnect(&child, SIGNAL(destroyed()), qApp, SLOT(quit())); | 
					
						
							| 
									
										
										
										
											2009-06-23 10:24:25 +02:00
										 |  |  |     child.setObjectName("A renamed Child"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testVector1() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     std::vector<std::list<int> *> vector; | 
					
						
							|  |  |  |     std::list<int> list; | 
					
						
							|  |  |  |     vector.push_back(new std::list<int>(list)); | 
					
						
							|  |  |  |     vector.push_back(0); | 
					
						
							|  |  |  |     list.push_back(45); | 
					
						
							|  |  |  |     vector.push_back(new std::list<int>(list)); | 
					
						
							|  |  |  |     vector.push_back(0); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testQHash1() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QHash<QString, QList<int> > hash; | 
					
						
							|  |  |  |     hash.insert("Hallo", QList<int>()); | 
					
						
							|  |  |  |     hash.insert("Welt", QList<int>() << 1); | 
					
						
							|  |  |  |     hash.insert("!", QList<int>() << 1 << 2); | 
					
						
							|  |  |  |     hash.insert("!", QList<int>() << 1 << 2); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-23 12:34:49 +02:00
										 |  |  | void testPointer() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Foo *f = new Foo(); | 
					
						
							| 
									
										
										
										
											2010-05-19 14:18:41 +02:00
										 |  |  |     Q_UNUSED(f); | 
					
						
							| 
									
										
										
										
											2009-07-23 12:34:49 +02:00
										 |  |  |     int i = 0; | 
					
						
							|  |  |  |     ++i; | 
					
						
							|  |  |  |     ++i; | 
					
						
							|  |  |  |     ++i; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Z : public QObject | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     Z() { | 
					
						
							|  |  |  |         f = new Foo(); | 
					
						
							|  |  |  |         i = 0; | 
					
						
							|  |  |  |         i = 1; | 
					
						
							|  |  |  |         i = 2; | 
					
						
							|  |  |  |         i = 3; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     int i; | 
					
						
							|  |  |  |     Foo *f; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-08 14:08:35 +01:00
										 |  |  | void testMemoryView() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int a[20]; | 
					
						
							|  |  |  |     for (int i = 0; i != 20; ++i) | 
					
						
							|  |  |  |         a[i] = i; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-28 09:44:11 +02:00
										 |  |  | void testUninitialized() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QString s; | 
					
						
							|  |  |  |     QStringList sl; | 
					
						
							|  |  |  |     QMap<int, int> mii; | 
					
						
							|  |  |  |     QMap<QString, QString> mss; | 
					
						
							|  |  |  |     QHash<int, int> hii; | 
					
						
							|  |  |  |     QHash<QString, QString> hss; | 
					
						
							|  |  |  |     QList<int> li; | 
					
						
							|  |  |  |     QVector<int> vi; | 
					
						
							|  |  |  |     QStack<int> si; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::string ss; | 
					
						
							|  |  |  |     std::map<int, int> smii; | 
					
						
							|  |  |  |     std::map<std::string, std::string> smss; | 
					
						
							|  |  |  |     std::list<int> sli; | 
					
						
							|  |  |  |     std::list<std::string> ssl; | 
					
						
							|  |  |  |     std::vector<int> svi; | 
					
						
							|  |  |  |     std::stack<int> ssi; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-07-23 12:34:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-01 09:02:32 +02:00
										 |  |  | void testEndlessRecursion() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     testEndlessRecursion(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 09:19:36 +02:00
										 |  |  | int testEndlessLoop() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     qlonglong a = 1; | 
					
						
							| 
									
										
										
										
											2010-11-16 16:26:29 +01:00
										 |  |  |     // gdb:
 | 
					
						
							|  |  |  |     // Breakpoint at "while" will stop only once
 | 
					
						
							|  |  |  |     // Hitting "Pause" button might show backtrace of different thread
 | 
					
						
							| 
									
										
										
										
											2010-04-07 09:19:36 +02:00
										 |  |  |     while (a > 0) | 
					
						
							|  |  |  |         ++a; | 
					
						
							|  |  |  |     return a; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-04 13:16:10 +01:00
										 |  |  | QString fooxx() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return "bababa"; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int testReference() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QString a = "hello"; | 
					
						
							|  |  |  |     const QString &b = fooxx(); | 
					
						
							| 
									
										
										
										
											2010-03-22 13:12:32 +01:00
										 |  |  |     const QString c = "world"; | 
					
						
							| 
									
										
										
										
											2010-01-04 13:16:10 +01:00
										 |  |  |     return a.size() + b.size() + c.size(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-05 11:46:03 +02:00
										 |  |  | struct Color | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int r,g,b,a; | 
					
						
							|  |  |  |     Color() { r = 1, g = 2, b = 3, a = 4; } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-27 17:52:04 +02:00
										 |  |  | void testColor() | 
					
						
							| 
									
										
										
										
											2010-05-05 11:46:03 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Color c; | 
					
						
							|  |  |  |     c.r = 5; | 
					
						
							| 
									
										
										
										
											2010-05-19 12:00:01 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int fooii() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return 3; | 
					
						
							| 
									
										
										
										
											2010-05-05 11:46:03 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-01 14:29:15 +02:00
										 |  |  | typedef QVector<Foo> FooVector; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | FooVector fooVector() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     FooVector f; | 
					
						
							|  |  |  |     f.append(Foo(2)); | 
					
						
							|  |  |  |     fprintf(stderr, "xxx\n"); | 
					
						
							|  |  |  |     f.append(Foo(3)); | 
					
						
							|  |  |  |     f.append(Foo(4)); | 
					
						
							| 
									
										
										
										
											2010-06-10 14:52:41 +02:00
										 |  |  |     for (int i = 0; i < 1000; ++i) | 
					
						
							|  |  |  |         f.append(Foo(i)); | 
					
						
							| 
									
										
										
										
											2010-06-01 14:29:15 +02:00
										 |  |  |     return f; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-28 09:40:35 +02:00
										 |  |  | namespace ns { | 
					
						
							|  |  |  |     typedef unsigned long long vl; | 
					
						
							|  |  |  |     typedef vl verylong; | 
					
						
							| 
									
										
										
										
											2010-08-30 09:32:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testTypedef() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     typedef quint32 myType1; | 
					
						
							|  |  |  |     typedef unsigned int myType2; | 
					
						
							|  |  |  |     myType1 t1 = 0; | 
					
						
							|  |  |  |     myType2 t2 = 0; | 
					
						
							|  |  |  |     ns::vl j = 1000; | 
					
						
							|  |  |  |     ns::verylong k = 1000; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ++j; | 
					
						
							|  |  |  |     ++k; | 
					
						
							|  |  |  |     ++t1; | 
					
						
							|  |  |  |     ++t2; | 
					
						
							| 
									
										
										
										
											2011-02-02 11:52:39 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2010-06-28 09:40:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-08 12:18:04 +02:00
										 |  |  | void testConditional(const QString &str) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     //
 | 
					
						
							|  |  |  |     QString res = str; | 
					
						
							|  |  |  |     res += "x"; | 
					
						
							|  |  |  |     res += "x"; | 
					
						
							|  |  |  |     res += "x"; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-08 08:52:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace basic { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // This tests display of basic types.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-09 17:32:46 +02:00
										 |  |  |     // https://bugreports.qt.nokia.com/browse/QTCREATORBUG-5326
 | 
					
						
							| 
									
										
										
										
											2011-07-08 08:52:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void testChar() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         char s[5]; | 
					
						
							|  |  |  |         s[0] = 0; | 
					
						
							|  |  |  |         // <=== break here.
 | 
					
						
							|  |  |  |         // Expand 's' in Locals view.
 | 
					
						
							|  |  |  |         // Open pinnable tooltip.
 | 
					
						
							|  |  |  |         // Step over.
 | 
					
						
							|  |  |  |         // Check that display and tooltip look sane.
 | 
					
						
							|  |  |  |         strcat(s,"\""); | 
					
						
							|  |  |  |         strcat(s,"\""); | 
					
						
							|  |  |  |         strcat(s,"a"); | 
					
						
							|  |  |  |         strcat(s,"b"); | 
					
						
							|  |  |  |         strcat(s,"\""); | 
					
						
							|  |  |  |         // Close tooltip.
 | 
					
						
							|  |  |  |         dummyStatement(&s); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-12 09:29:06 +02:00
										 |  |  |     static char buf[20] = { 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testCharStar() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         char *s = buf; | 
					
						
							|  |  |  |         // <=== break here.
 | 
					
						
							|  |  |  |         // Expand 's' in Locals view.
 | 
					
						
							|  |  |  |         // Open pinnable tooltip.
 | 
					
						
							|  |  |  |         // Step over.
 | 
					
						
							|  |  |  |         // Check that display and tooltip look sane.
 | 
					
						
							|  |  |  |         s = strcat(s,"\""); | 
					
						
							|  |  |  |         s = strcat(s,"\""); | 
					
						
							|  |  |  |         s = strcat(s,"a"); | 
					
						
							|  |  |  |         s = strcat(s,"b"); | 
					
						
							|  |  |  |         s = strcat(s,"\""); | 
					
						
							|  |  |  |         // Close tooltip.
 | 
					
						
							|  |  |  |         dummyStatement(&s); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-08 08:52:53 +02:00
										 |  |  |     void testBasic() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         testChar(); | 
					
						
							| 
									
										
										
										
											2011-07-12 09:29:06 +02:00
										 |  |  |         testCharStar(); | 
					
						
							| 
									
										
										
										
											2011-07-08 08:52:53 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // basic
 | 
					
						
							| 
									
										
										
										
											2010-11-16 17:09:25 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-03 18:23:07 +01:00
										 |  |  | struct Tx | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Tx() { data = new char[20](); data[0] = '1'; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     char *GetStringPtr() const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return data; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     char *data; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct Ty | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     void doit() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         int i = 1; | 
					
						
							|  |  |  |         i = 2; | 
					
						
							|  |  |  |         i = 2; | 
					
						
							|  |  |  |         i = 2; | 
					
						
							|  |  |  |         i = 2; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Tx m_buffer; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-19 14:18:41 +02:00
										 |  |  | void testStuff() | 
					
						
							| 
									
										
										
										
											2011-02-15 18:47:36 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     using namespace std; | 
					
						
							|  |  |  |     typedef map<string, list<string> > map_t; | 
					
						
							|  |  |  |     map_t m; | 
					
						
							|  |  |  |     m["one"].push_back("a"); | 
					
						
							|  |  |  |     m["one"].push_back("b"); | 
					
						
							|  |  |  |     m["one"].push_back("c"); | 
					
						
							|  |  |  |     m["two"].push_back("1"); | 
					
						
							|  |  |  |     m["two"].push_back("2"); | 
					
						
							|  |  |  |     m["two"].push_back("3"); | 
					
						
							|  |  |  |     map_t::const_iterator i = m.begin(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     vector<int> vec; | 
					
						
							|  |  |  |     vec.push_back(1); | 
					
						
							|  |  |  |     vec.push_back(2); | 
					
						
							|  |  |  |     pair<vector<int>, vector<int> > a(pair<vector<int>,vector<int> >(vec, vec)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     i++; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testStuff4() | 
					
						
							| 
									
										
										
										
											2011-02-03 18:23:07 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     Ty x; | 
					
						
							|  |  |  |     x.doit(); | 
					
						
							|  |  |  |     char *s = x.m_buffer.GetStringPtr(); | 
					
						
							| 
									
										
										
										
											2011-02-10 15:17:55 +01:00
										 |  |  |     Q_UNUSED(s); | 
					
						
							| 
									
										
										
										
											2011-02-03 18:23:07 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  | void testStuff2() | 
					
						
							| 
									
										
										
										
											2010-05-19 14:18:41 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-08-11 13:51:43 +02:00
										 |  |  |     QList<QList<int> > list1; | 
					
						
							|  |  |  |     QList<QList<int> > list2; | 
					
						
							|  |  |  |     list1.append(QList<int>() << 1); | 
					
						
							|  |  |  |     list2.append(QList<int>() << 2); | 
					
						
							|  |  |  |     for (int i = 0; i < list1.size(); ++i) { | 
					
						
							|  |  |  |         for (int j = 0; j < list1.at(i).size(); ++j) { | 
					
						
							|  |  |  |             for (int k = i; k < list1.size(); ++k) { | 
					
						
							|  |  |  |                 for (int l = j; l < list1.at(k).size(); ++l) { | 
					
						
							|  |  |  |                     qDebug() << list1.at(i).at(j)+list2.at(k).at(l); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-18 11:17:52 +02:00
										 |  |  |     // special char* support only with Python.
 | 
					
						
							| 
									
										
										
										
											2010-07-09 17:07:59 +02:00
										 |  |  |     typedef unsigned short wchar; | 
					
						
							|  |  |  |     wchar *str = new wchar[10]; | 
					
						
							|  |  |  |     str[2] = 0; | 
					
						
							|  |  |  |     str[1] = 'B'; | 
					
						
							|  |  |  |     str[0] = 'A'; | 
					
						
							|  |  |  |     str[0] = 'A'; | 
					
						
							|  |  |  |     str[0] = 'A'; | 
					
						
							|  |  |  |     str[0] = 'A'; | 
					
						
							|  |  |  |     QString foo = "foo"; | 
					
						
							|  |  |  |     wchar *f = (wchar*)foo.utf16(); | 
					
						
							| 
									
										
										
										
											2010-09-01 11:58:23 +02:00
										 |  |  |     Q_UNUSED(f); | 
					
						
							| 
									
										
										
										
											2010-07-09 17:07:59 +02:00
										 |  |  |     str[0] = 'A'; | 
					
						
							|  |  |  |     str[0] = 'A'; | 
					
						
							|  |  |  |     str[0] = 'A'; | 
					
						
							| 
									
										
										
										
											2010-05-19 14:18:41 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-26 14:24:36 +02:00
										 |  |  | void testPassByReferenceHelper(Foo &f) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ++f.a; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testPassByReference() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Foo f(12); | 
					
						
							|  |  |  |     testPassByReferenceHelper(f); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-27 18:23:51 +02:00
										 |  |  | void testWCout() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     using namespace std; | 
					
						
							|  |  |  |     wstring x = L"xxxxx"; | 
					
						
							|  |  |  |     wstring::iterator i = x.begin(); | 
					
						
							|  |  |  |     while (i != x.end()) { | 
					
						
							|  |  |  |         wcout << *i; | 
					
						
							|  |  |  |         i++; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     wcout.flush(); | 
					
						
							|  |  |  |     string y = "yyyyy"; | 
					
						
							|  |  |  |     string::iterator j = y.begin(); | 
					
						
							|  |  |  |     while (j != y.end()) { | 
					
						
							|  |  |  |         cout << *j; | 
					
						
							|  |  |  |         j++; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     cout.flush(); | 
					
						
							| 
									
										
										
										
											2011-05-27 15:19:46 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2010-05-27 18:23:51 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void testWCout0() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     // Mixing cout and wcout does not work with gcc.
 | 
					
						
							|  |  |  |     // See http://gcc.gnu.org/ml/gcc-bugs/2006-05/msg01193.html
 | 
					
						
							|  |  |  |     // which also says "you can obtain something close to your
 | 
					
						
							|  |  |  |     // expectations by calling std::ios::sync_with_stdio(false);
 | 
					
						
							|  |  |  |     // at the beginning of your program."
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     using namespace std; | 
					
						
							|  |  |  |     //std::ios::sync_with_stdio(false);
 | 
					
						
							|  |  |  |     wcout << L"WWWWWW" << endl; | 
					
						
							|  |  |  |     wcerr << L"YYYYYY" << endl; | 
					
						
							|  |  |  |     cout << "CCCCCC" << endl; | 
					
						
							|  |  |  |     cerr << "EEEEEE" << endl; | 
					
						
							|  |  |  |     wcout << L"WWWWWW" << endl; | 
					
						
							|  |  |  |     wcerr << L"YYYYYY" << endl; | 
					
						
							|  |  |  |     cout << "CCCCCC" << endl; | 
					
						
							|  |  |  |     cerr << "EEEEEE" << endl; | 
					
						
							|  |  |  |     wcout << L"WWWWWW" << endl; | 
					
						
							|  |  |  |     wcerr << L"YYYYYY" << endl; | 
					
						
							|  |  |  |     cout << "CCCCCC" << endl; | 
					
						
							|  |  |  |     cerr << "EEEEEE" << endl; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-26 10:40:31 +02:00
										 |  |  | void testSSE() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-03 17:34:41 +01:00
										 |  |  | #ifdef __SSE__
 | 
					
						
							| 
									
										
										
										
											2010-10-26 10:40:31 +02:00
										 |  |  |     float a[4]; | 
					
						
							|  |  |  |     float b[4]; | 
					
						
							|  |  |  |     int i; | 
					
						
							|  |  |  |     for (i = 0; i < 4; i++) { | 
					
						
							|  |  |  |         a[i] = 2 * i; | 
					
						
							|  |  |  |         b[i] = 2 * i; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     __m128 sseA, sseB; | 
					
						
							|  |  |  |     sseA = _mm_loadu_ps(a); | 
					
						
							|  |  |  |     sseB = _mm_loadu_ps(b); | 
					
						
							|  |  |  |     ++i; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-27 18:23:51 +02:00
										 |  |  | void testQSettings() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-06-01 14:29:15 +02:00
										 |  |  |     // Note: Construct a QCoreApplication first.
 | 
					
						
							| 
									
										
										
										
											2010-05-27 18:23:51 +02:00
										 |  |  |     QSettings settings("/tmp/test.ini", QSettings::IniFormat); | 
					
						
							|  |  |  |     QVariant value = settings.value("item1","").toString(); | 
					
						
							|  |  |  |     int x = 1; | 
					
						
							| 
									
										
										
										
											2010-06-11 13:44:18 +02:00
										 |  |  |     Q_UNUSED(x); | 
					
						
							| 
									
										
										
										
											2010-05-27 18:23:51 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-10 15:17:55 +01:00
										 |  |  | void testQScriptValue(int argc, char *argv[]) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QCoreApplication app(argc, argv); | 
					
						
							|  |  |  |     QScriptEngine engine; | 
					
						
							|  |  |  |     QDateTime date = QDateTime::currentDateTime(); | 
					
						
							| 
									
										
										
										
											2011-02-15 18:47:36 +01:00
										 |  |  |     QScriptValue s; | 
					
						
							|  |  |  |     s = QScriptValue(33); | 
					
						
							|  |  |  |     int x = s.toInt32(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     s = QScriptValue(QString("34")); | 
					
						
							|  |  |  |     QString x1 = s.toString(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     s = engine.newVariant(QVariant(43)); | 
					
						
							|  |  |  |     QVariant v = s.toVariant(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     s = engine.newVariant(QVariant(43.0)); | 
					
						
							|  |  |  |     s = engine.newVariant(QVariant(QString("sss"))); | 
					
						
							|  |  |  |     s = engine.newDate(date); | 
					
						
							|  |  |  |     x = s.toInt32(); | 
					
						
							| 
									
										
										
										
											2011-02-16 18:43:42 +01:00
										 |  |  |     bool xx = s.isDate(); | 
					
						
							| 
									
										
										
										
											2011-03-04 17:22:58 +01:00
										 |  |  |     Q_UNUSED(xx); | 
					
						
							| 
									
										
										
										
											2011-02-15 18:47:36 +01:00
										 |  |  |     date = s.toDateTime(); | 
					
						
							| 
									
										
										
										
											2011-02-10 15:17:55 +01:00
										 |  |  |     s.setProperty("a", QScriptValue()); | 
					
						
							|  |  |  |     QScriptValue d = s.data(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-04 17:22:58 +01:00
										 |  |  | void testBoostOptional() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | #if USE_BOOST
 | 
					
						
							|  |  |  |     boost::optional<int> i; | 
					
						
							|  |  |  |     i = 1; | 
					
						
							|  |  |  |     boost::optional<QStringList> sl; | 
					
						
							|  |  |  |     sl = (QStringList() << "xxx" << "yyy"); | 
					
						
							|  |  |  |     sl.get().append("zzz"); | 
					
						
							|  |  |  |     i = 3; | 
					
						
							|  |  |  |     i = 4; | 
					
						
							|  |  |  |     i = 5; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-04 16:49:25 +01:00
										 |  |  | void testBoostSharedPtr() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | #if USE_BOOST
 | 
					
						
							|  |  |  |     QSharedPointer<int> qs; | 
					
						
							|  |  |  |     QSharedPointer<int> qi(new int(43)); | 
					
						
							|  |  |  |     QSharedPointer<int> qj = qi; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     boost::shared_ptr<int> s; | 
					
						
							|  |  |  |     boost::shared_ptr<int> i(new int(43)); | 
					
						
							|  |  |  |     boost::shared_ptr<int> j = i; | 
					
						
							| 
									
										
										
										
											2011-03-04 17:22:58 +01:00
										 |  |  |     boost::shared_ptr<QStringList> sl(new QStringList); | 
					
						
							| 
									
										
										
										
											2011-03-04 16:49:25 +01:00
										 |  |  |     int k = 2; | 
					
						
							|  |  |  |     ++k; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-04 19:26:11 +01:00
										 |  |  | void testFork() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QProcess proc; | 
					
						
							|  |  |  |     proc.start("/bin/ls"); | 
					
						
							|  |  |  |     proc.waitForFinished(); | 
					
						
							|  |  |  |     QByteArray ba = proc.readAllStandardError(); | 
					
						
							|  |  |  |     ba.append('x'); | 
					
						
							|  |  |  |     ba.append('x'); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-16 18:59:23 +01:00
										 |  |  | typedef void *VoidPtr; | 
					
						
							|  |  |  | typedef const void *CVoidPtr; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-10 12:13:12 +01:00
										 |  |  | class A | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-03-16 18:59:23 +01:00
										 |  |  |     A() : test(7) {} | 
					
						
							|  |  |  |     int test; | 
					
						
							|  |  |  |     void doSomething(CVoidPtr cp) const; | 
					
						
							| 
									
										
										
										
											2011-03-10 12:13:12 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-16 18:59:23 +01:00
										 |  |  | void A::doSomething(CVoidPtr cp) const | 
					
						
							| 
									
										
										
										
											2011-03-10 12:13:12 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-29 09:32:36 +02:00
										 |  |  |     Q_UNUSED(cp); | 
					
						
							| 
									
										
										
										
											2011-03-10 12:13:12 +01:00
										 |  |  |     std::cout << test << std::endl; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testStuffA() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     A a; | 
					
						
							| 
									
										
										
										
											2011-03-16 18:59:23 +01:00
										 |  |  |     VoidPtr p = &a; | 
					
						
							|  |  |  |     CVoidPtr cp = &a; | 
					
						
							| 
									
										
										
										
											2011-03-29 09:32:36 +02:00
										 |  |  |     Q_UNUSED(p); | 
					
						
							| 
									
										
										
										
											2011-03-16 18:59:23 +01:00
										 |  |  |     a.doSomething(cp); | 
					
						
							| 
									
										
										
										
											2011-03-10 12:13:12 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-15 11:23:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct structdata | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int ints[8]; | 
					
						
							|  |  |  |     char chars[32]; | 
					
						
							|  |  |  |     double doubles[5]; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum type_t { MPI_LB, MPI_INT, MPI_CHAR, MPI_DOUBLE, MPI_UB }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct tree_entry | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     tree_entry() {} | 
					
						
							|  |  |  |     tree_entry(int l, int o, type_t t) | 
					
						
							|  |  |  |         : blocklength(l), offset(o), type(t) | 
					
						
							|  |  |  |     {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int blocklength; | 
					
						
							|  |  |  |     int offset; | 
					
						
							|  |  |  |     type_t type; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct tree | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     enum kind_t { STRUCT }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void *base; | 
					
						
							|  |  |  |     kind_t kind; | 
					
						
							|  |  |  |     int count; | 
					
						
							|  |  |  |     tree_entry entries[20]; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testMPI() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     structdata buffer = { | 
					
						
							|  |  |  |         //{MPI_LB},
 | 
					
						
							|  |  |  |         {0, 1024, 2048, 3072, 4096, 5120, 6144 }, | 
					
						
							|  |  |  |         {"message to 1 of 2: hello"}, | 
					
						
							|  |  |  |         {0, 3.14, 6.2831853071795862, 9.4247779607693793, 13}, | 
					
						
							|  |  |  |         //{MPI_UB}
 | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     tree x; | 
					
						
							|  |  |  |     x.base = &buffer; | 
					
						
							|  |  |  |     x.kind = tree::STRUCT; | 
					
						
							|  |  |  |     x.count = 5; | 
					
						
							|  |  |  |     x.entries[0] = tree_entry(1, -4, MPI_LB); | 
					
						
							|  |  |  |     x.entries[1] = tree_entry(5,  0, MPI_INT); | 
					
						
							|  |  |  |     x.entries[2] = tree_entry(7, 47, MPI_CHAR); | 
					
						
							|  |  |  |     x.entries[3] = tree_entry(2, 76, MPI_DOUBLE); | 
					
						
							|  |  |  |     x.entries[4] = tree_entry(1, 100, MPI_UB); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int i = x.count; | 
					
						
							|  |  |  |     i = buffer.ints[0]; | 
					
						
							|  |  |  |     i = buffer.ints[1]; | 
					
						
							|  |  |  |     i = buffer.ints[2]; | 
					
						
							|  |  |  |     i = buffer.ints[3]; | 
					
						
							|  |  |  |     /*
 | 
					
						
							|  |  |  |             gdb) print datatype | 
					
						
							|  |  |  |             > $3 = { | 
					
						
							|  |  |  |             >   kind = STRUCT, | 
					
						
							|  |  |  |             >   count = 5, | 
					
						
							|  |  |  |             >   entries = {{ | 
					
						
							|  |  |  |             >       blocklength = 1, | 
					
						
							|  |  |  |             >       offset = -4, | 
					
						
							|  |  |  |             >       type = MPI_LB | 
					
						
							|  |  |  |             >     }, { | 
					
						
							|  |  |  |             >       blocklength = 5, | 
					
						
							|  |  |  |             >       offset = 0, | 
					
						
							|  |  |  |             >       type = MPI_INT | 
					
						
							|  |  |  |             >     }, { | 
					
						
							|  |  |  |             >       blocklength = 7, | 
					
						
							|  |  |  |             >       offset = 47, | 
					
						
							|  |  |  |             >       type = MPI_CHAR | 
					
						
							|  |  |  |             >     }, { | 
					
						
							|  |  |  |             >       blocklength = 2, | 
					
						
							|  |  |  |             >       offset = 76, | 
					
						
							|  |  |  |             >       type = MPI_DOUBLE | 
					
						
							|  |  |  |             >     }, { | 
					
						
							|  |  |  |             >       blocklength = 1, | 
					
						
							|  |  |  |             >       offset = 100, | 
					
						
							|  |  |  |             >       type = MPI_UB | 
					
						
							|  |  |  |             >     }} | 
					
						
							|  |  |  |             > } | 
					
						
							|  |  |  |     */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-12 20:03:58 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | //namespace kr {
 | 
					
						
							| 
									
										
										
										
											2011-05-12 20:03:58 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     // FIXME: put in namespace kr, adjust qdump__KRBase in dumpers/qttypes.py
 | 
					
						
							|  |  |  |     struct KRBase | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         enum Type { TYPE_A, TYPE_B } type; | 
					
						
							|  |  |  |         KRBase(Type _type) : type(_type) {} | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2011-05-12 20:03:58 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     struct KRA : KRBase { int x; int y; KRA():KRBase(TYPE_A), x(1), y(32) {} }; | 
					
						
							|  |  |  |     struct KRB : KRBase { KRB():KRBase(TYPE_B) {} }; | 
					
						
							| 
									
										
										
										
											2011-05-09 08:35:58 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | //} // namespace kr
 | 
					
						
							| 
									
										
										
										
											2011-05-12 20:03:58 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | namespace kr { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Only with python.
 | 
					
						
							|  |  |  |     // This tests qdump__KRBase in dumpers/qttypes.py which uses
 | 
					
						
							|  |  |  |     // a static typeflag to dispatch to subclasses.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testKR() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         KRBase *ptr1 = new KRA; | 
					
						
							|  |  |  |         KRBase *ptr2 = new KRB; | 
					
						
							|  |  |  |         ptr2 = new KRB; | 
					
						
							|  |  |  |         // <== break here.
 | 
					
						
							|  |  |  |         // check ptr1 is shown as KRA and ptr2 as KRB
 | 
					
						
							|  |  |  |         dummyStatement(&ptr1, &ptr2); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namspace kr
 | 
					
						
							| 
									
										
										
										
											2011-05-12 20:03:58 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 16:59:52 +02:00
										 |  |  | namespace eigen { | 
					
						
							| 
									
										
										
										
											2011-05-16 20:04:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 16:59:52 +02:00
										 |  |  |     void testEigen() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     #if USE_EIGEN
 | 
					
						
							|  |  |  |         using namespace Eigen; | 
					
						
							| 
									
										
										
										
											2011-05-17 11:30:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 16:59:52 +02:00
										 |  |  |         Vector3d test = Vector3d::Zero(); | 
					
						
							| 
									
										
										
										
											2011-05-16 20:04:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 16:59:52 +02:00
										 |  |  |         Matrix3d myMatrix = Matrix3d::Constant(5); | 
					
						
							|  |  |  |         MatrixXd myDynamicMatrix(30, 10); | 
					
						
							| 
									
										
										
										
											2011-05-16 20:04:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 16:59:52 +02:00
										 |  |  |         myDynamicMatrix(0, 0) = 0; | 
					
						
							|  |  |  |         myDynamicMatrix(1, 0) = 1; | 
					
						
							|  |  |  |         myDynamicMatrix(2, 0) = 2; | 
					
						
							| 
									
										
										
										
											2011-05-16 20:04:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 16:59:52 +02:00
										 |  |  |         Matrix<double, 12, 15, ColMajor> colMajorMatrix; | 
					
						
							|  |  |  |         Matrix<double, 12, 15, RowMajor> rowMajorMatrix; | 
					
						
							| 
									
										
										
										
											2011-05-16 20:04:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 16:59:52 +02:00
										 |  |  |         int k = 0; | 
					
						
							|  |  |  |         for (int i = 0; i != 12; ++i) { | 
					
						
							|  |  |  |             for (int j = 0; j != 15; ++j) { | 
					
						
							|  |  |  |                 colMajorMatrix(i, j) = k; | 
					
						
							|  |  |  |                 rowMajorMatrix(i, j) = k; | 
					
						
							|  |  |  |                 ++k; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // <=== break here
 | 
					
						
							|  |  |  |         // check that Locals and Expresssions view looks sane
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |         dummyStatement(&colMajorMatrix, &rowMajorMatrix, &test); | 
					
						
							| 
									
										
										
										
											2011-07-04 16:59:52 +02:00
										 |  |  |         dummyStatement(&myMatrix, &myDynamicMatrix); | 
					
						
							|  |  |  |     #endif
 | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-05-16 20:04:17 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 16:59:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  | namespace bug842 { | 
					
						
							| 
									
										
										
										
											2011-05-16 20:04:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-09 17:32:46 +02:00
										 |  |  |     // https://bugreports.qt.nokia.com/browse/QTCREATORBUG-842
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     void test842() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         qWarning("Test"); | 
					
						
							|  |  |  |         int x = 0; | 
					
						
							|  |  |  |         ++x; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace bug842
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace bug3611 { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-09 17:32:46 +02:00
										 |  |  |     // https://bugreports.qt.nokia.com/browse/QTCREATORBUG-3611
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     void test3611() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         typedef unsigned char byte; | 
					
						
							|  |  |  |         byte f = '2'; | 
					
						
							|  |  |  |         int *x = (int*)&f; | 
					
						
							|  |  |  |         f += 1; | 
					
						
							|  |  |  |         f += 1; | 
					
						
							|  |  |  |         f += 1; | 
					
						
							| 
									
										
										
										
											2011-08-04 17:14:22 +02:00
										 |  |  |         dummyStatement(&f, &x); | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace bug3611
 | 
					
						
							| 
									
										
										
										
											2011-06-06 14:08:13 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void testStuff3() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     testConditional("foo"); | 
					
						
							|  |  |  |     testConditional(fooxx()); | 
					
						
							|  |  |  |     testConditional("bar"); | 
					
						
							|  |  |  |     testConditional("zzz"); | 
					
						
							|  |  |  |     Foo *f1 = new Foo(1); | 
					
						
							|  |  |  |     X *x = new X(); | 
					
						
							|  |  |  |     Foo *f2 = x; | 
					
						
							|  |  |  |     XX *xx = new XX(); | 
					
						
							|  |  |  |     Foo *f3 = xx; | 
					
						
							|  |  |  |     Y *y = new Y(); | 
					
						
							|  |  |  |     Foo *f4 = y; | 
					
						
							|  |  |  |     //Foo *f5 = new D();
 | 
					
						
							|  |  |  |     qDebug() << f1 << f2 << f3 << f4; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace bug4019 { | 
					
						
							| 
									
										
										
										
											2011-05-23 10:56:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-09 17:32:46 +02:00
										 |  |  |     // https://bugreports.qt.nokia.com/browse/QTCREATORBUG-4019
 | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     class A4019 | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     public: | 
					
						
							|  |  |  |         A4019() : test(7) {} | 
					
						
							|  |  |  |         int test; | 
					
						
							|  |  |  |         void doSomething() const; | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2011-05-23 10:56:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     void A4019::doSomething() const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         std::cout << test << std::endl; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-05-23 10:56:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     void test4019() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         A4019 a; | 
					
						
							|  |  |  |         a.doSomething(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-05-23 10:56:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  | } // namespave bug4019
 | 
					
						
							| 
									
										
										
										
											2011-05-27 15:19:46 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 13:16:29 +02:00
										 |  |  | namespace bug4497 { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-09 17:32:46 +02:00
										 |  |  |     // https://bugreports.qt.nokia.com/browse/QTCREATORBUG-4497
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void test4497() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         using namespace std; | 
					
						
							|  |  |  |         //cin.get(); // if commented out, the debugger doesn't stop at the breakpoint in the next line.
 | 
					
						
							| 
									
										
										
										
											2011-06-22 13:16:29 +02:00
										 |  |  |         cout << "Hello, world!" << endl; // <=== break here
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         int sum = 0; | 
					
						
							|  |  |  |         for (int i = 1; i <= 10; i++) | 
					
						
							|  |  |  |             sum += i; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         cout << sum << endl; | 
					
						
							|  |  |  |         cout << "Enter a number: "; | 
					
						
							|  |  |  |         int n; | 
					
						
							|  |  |  |         cin >> n; | 
					
						
							|  |  |  |         cout << "You entered " << n << "!" << endl; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-05-27 15:19:46 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 14:57:20 +02:00
										 |  |  | namespace bug4904 { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-09 17:32:46 +02:00
										 |  |  |     // https://bugreports.qt.nokia.com/browse/QTCREATORBUG-4904
 | 
					
						
							| 
									
										
										
										
											2011-06-22 14:57:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     struct CustomStruct { | 
					
						
							|  |  |  |         int id; | 
					
						
							|  |  |  |         double dvalue; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int test4904() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QMap<int, CustomStruct> map; | 
					
						
							|  |  |  |         CustomStruct cs1; | 
					
						
							|  |  |  |         cs1.id = 1; | 
					
						
							|  |  |  |         cs1.dvalue = 3.14; | 
					
						
							|  |  |  |         CustomStruct cs2 = cs1; | 
					
						
							|  |  |  |         cs2.id = -1; | 
					
						
							|  |  |  |         map.insert(cs1.id, cs1); | 
					
						
							|  |  |  |         map.insert(cs2.id, cs2); | 
					
						
							| 
									
										
										
										
											2011-06-22 17:51:59 +02:00
										 |  |  |         QMap<int, CustomStruct>::iterator it = map.begin(); | 
					
						
							|  |  |  |         int n = map.size();   // <=== break here
 | 
					
						
							|  |  |  |         // - expand map/[0]/value
 | 
					
						
							|  |  |  |         // - verify  map[0].key == -1
 | 
					
						
							|  |  |  |         // - verify  map[0].value.id == -1
 | 
					
						
							|  |  |  |         return n; | 
					
						
							| 
									
										
										
										
											2011-06-22 14:57:20 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace bug4904
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-15 16:23:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 17:01:59 +02:00
										 |  |  | namespace bug5046 { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-09 17:32:46 +02:00
										 |  |  |     // https://bugreports.qt.nokia.com/browse/QTCREATORBUG-5046
 | 
					
						
							| 
									
										
										
										
											2011-06-22 17:01:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     struct Foo { int a, b, c; }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 17:51:59 +02:00
										 |  |  |     int test5046() | 
					
						
							| 
									
										
										
										
											2011-06-22 17:01:59 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         Foo f; | 
					
						
							|  |  |  |         f.a = 1; | 
					
						
							| 
									
										
										
										
											2011-06-22 17:51:59 +02:00
										 |  |  |         f.b = 2; | 
					
						
							|  |  |  |         f.c = 3; | 
					
						
							|  |  |  |         f.a = 4; // <= break here
 | 
					
						
							|  |  |  |         // - pop up main editor tooltip over 'f'
 | 
					
						
							|  |  |  |         // - verify that the entry is expandable, and expansion works
 | 
					
						
							|  |  |  |         return f.a; | 
					
						
							| 
									
										
										
										
											2011-06-22 17:01:59 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace bug5046
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  | namespace bug5106 { | 
					
						
							| 
									
										
										
										
											2011-06-15 16:23:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-09 17:32:46 +02:00
										 |  |  |     // https://bugreports.qt.nokia.com/browse/QTCREATORBUG-5106
 | 
					
						
							| 
									
										
										
										
											2011-06-15 16:23:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     class A5106 | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     public: | 
					
						
							|  |  |  |             A5106(int a, int b) : m_a(a), m_b(b) {} | 
					
						
							| 
									
										
										
										
											2011-06-15 16:23:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |             virtual int test() { return 5; } | 
					
						
							| 
									
										
										
										
											2011-06-15 16:23:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     private: | 
					
						
							|  |  |  |             int m_a, m_b; | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2011-06-15 16:23:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     class B5106 : public A5106 | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     public: | 
					
						
							|  |  |  |             B5106(int c, int a, int b) : A5106(a, b), m_c(c) {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 13:16:29 +02:00
										 |  |  |             virtual int test() { return 4; } // <=== break here
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     private: | 
					
						
							|  |  |  |             int m_c; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void test5106() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         B5106 b(1,2,3); | 
					
						
							|  |  |  |         b.test(); | 
					
						
							| 
									
										
										
										
											2011-06-22 13:16:29 +02:00
										 |  |  |         b.A5106::test(); | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace bug5106
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace bug5184 { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-09 17:32:46 +02:00
										 |  |  |     // https://bugreports.qt.nokia.com/browse/QTCREATORBUG-5184
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 13:16:29 +02:00
										 |  |  |     // Note: The report there shows type field "QUrl &" instead of QUrl.
 | 
					
						
							|  |  |  |     // It's unclear how this can happen. It should never have been like
 | 
					
						
							|  |  |  |     // that with a stock 7.2 and any version of Creator.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int helper(const QUrl &url) | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         QNetworkRequest request(url); | 
					
						
							|  |  |  |         QList<QByteArray> raw = request.rawHeaderList(); | 
					
						
							|  |  |  |         return raw.size();  // <=== break here
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 13:16:29 +02:00
										 |  |  |     void test5184() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QUrl url(QString("http://127.0.0.1/")); | 
					
						
							|  |  |  |         helper(url); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  | } // namespace bug5184
 | 
					
						
							| 
									
										
										
										
											2011-06-15 16:23:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-23 10:56:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-20 12:46:32 +02:00
										 |  |  | namespace qc42170 { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     // http://www.qtcentre.org/threads/42170-How-to-watch-data-of-actual-type-in-debugger
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-20 12:46:32 +02:00
										 |  |  |     struct Object | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         Object(int id_) : id(id_) {} | 
					
						
							|  |  |  |         virtual ~Object() {} | 
					
						
							|  |  |  |         int id; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |     struct Point : Object | 
					
						
							| 
									
										
										
										
											2011-06-20 12:46:32 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         Point(double x_, double y_, int id_) : Object(id_), x(x_), y(y_) {} | 
					
						
							|  |  |  |         double x, y; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     struct Circle : Point | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         Circle(double x_, double y_, double r_, int id_) | 
					
						
							|  |  |  |         : Point(x_, y_, id_), r(r_) {} | 
					
						
							|  |  |  |         double r; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |     void helper(Object *obj) | 
					
						
							| 
									
										
										
										
											2011-06-20 12:46:32 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |         // <== break here
 | 
					
						
							|  |  |  |         // Check that obj is shown as a 'Circle' object.
 | 
					
						
							|  |  |  |         dummyStatement(obj); | 
					
						
							| 
									
										
										
										
											2011-06-20 12:46:32 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     void test42170() | 
					
						
							| 
									
										
										
										
											2011-06-20 12:46:32 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-06-20 15:23:28 +02:00
										 |  |  |         Circle *circle = new Circle(1.5, -2.5, 3.0, 15); | 
					
						
							|  |  |  |         Object *obj = circle; | 
					
						
							|  |  |  |         helper(circle); | 
					
						
							|  |  |  |         helper(obj); | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |         dummyStatement(obj); | 
					
						
							| 
									
										
										
										
											2011-06-20 12:46:32 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace qc42170
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-20 17:53:59 +02:00
										 |  |  | namespace qc41700 { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     // http://www.qtcentre.org/threads/41700-How-to-watch-STL-containers-iterators-during-debugging
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void test41700() | 
					
						
							| 
									
										
										
										
											2011-06-20 17:53:59 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         using namespace std; | 
					
						
							|  |  |  |         typedef map<string, list<string> > map_t; | 
					
						
							|  |  |  |         map_t m; | 
					
						
							|  |  |  |         m["one"].push_back("a"); | 
					
						
							|  |  |  |         m["one"].push_back("b"); | 
					
						
							|  |  |  |         m["one"].push_back("c"); | 
					
						
							|  |  |  |         m["two"].push_back("1"); | 
					
						
							|  |  |  |         m["two"].push_back("2"); | 
					
						
							|  |  |  |         m["two"].push_back("3"); | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |         map_t::const_iterator it = m.begin(); | 
					
						
							|  |  |  |         // <=== break here
 | 
					
						
							|  |  |  |         // Check that m is displayed nicely.
 | 
					
						
							|  |  |  |         dummyStatement(&it); | 
					
						
							| 
									
										
										
										
											2011-06-20 17:53:59 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace qc41700
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-29 11:48:12 +02:00
										 |  |  | namespace cp42895 { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // http://codepaster.europe.nokia.com/?id=42895
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void g(int c, int d) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         qDebug() << c << d; | 
					
						
							|  |  |  |         // <== break here
 | 
					
						
							|  |  |  |         // Check there are frames for g and f in the stack view.
 | 
					
						
							|  |  |  |         dummyStatement(&c, &d); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void f(int a, int b) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         g(a, b); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void test42895() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         f(3, 4); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace cp
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-04 17:14:22 +02:00
										 |  |  | namespace varargs { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void test(const char *format, ...) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         va_list arg; | 
					
						
							|  |  |  |         va_start(arg, format); | 
					
						
							|  |  |  |         int i = va_arg(arg, int); | 
					
						
							|  |  |  |         double f = va_arg(arg, double); | 
					
						
							|  |  |  |         va_end(arg); | 
					
						
							|  |  |  |         dummyStatement(&i, &f); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void testVaList() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         test("abc", 1, 2.0); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace varargs
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  | int main(int argc, char *argv[]) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-08-05 15:06:14 +02:00
										 |  |  |     qhostaddress::testQHostAddress(); | 
					
						
							| 
									
										
										
										
											2011-08-04 17:14:22 +02:00
										 |  |  |     varargs::testVaList(); | 
					
						
							| 
									
										
										
										
											2011-06-29 11:48:12 +02:00
										 |  |  |     cp42895::test42895(); | 
					
						
							| 
									
										
										
										
											2011-06-22 17:01:59 +02:00
										 |  |  |     bug5046::test5046(); | 
					
						
							| 
									
										
										
										
											2011-06-22 14:57:20 +02:00
										 |  |  |     bug4904::test4904(); | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     qc41700::test41700(); | 
					
						
							|  |  |  |     qc42170::test42170(); | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |     multibp::testMultiBp(); | 
					
						
							| 
									
										
										
										
											2011-06-22 10:42:40 +02:00
										 |  |  |     bug842::test842(); | 
					
						
							|  |  |  |     bug3611::test3611(); | 
					
						
							|  |  |  |     bug4019::test4019(); | 
					
						
							|  |  |  |     bug5106::test5106(); | 
					
						
							|  |  |  |     bug5184::test5184(); | 
					
						
							|  |  |  |     //bug4497::test4497();
 | 
					
						
							| 
									
										
										
										
											2011-07-04 16:59:52 +02:00
										 |  |  |     eigen::testEigen(); | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     kr::testKR(); | 
					
						
							| 
									
										
										
										
											2011-04-06 18:39:56 +02:00
										 |  |  |     int *x = new int(32); | 
					
						
							| 
									
										
										
										
											2011-04-20 10:48:43 +02:00
										 |  |  |     Q_UNUSED(x); | 
					
						
							| 
									
										
										
										
											2011-05-10 18:58:06 +02:00
										 |  |  |     std::string s; | 
					
						
							|  |  |  |     s = "hallo"; | 
					
						
							|  |  |  |     s += "hallo"; | 
					
						
							| 
									
										
										
										
											2011-03-29 14:57:15 +02:00
										 |  |  |     testQXmlAttributes(); | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     qregexp::testQRegExp(); | 
					
						
							| 
									
										
										
										
											2011-03-28 15:34:37 +02:00
										 |  |  |     testInlineBreakpoints(); | 
					
						
							| 
									
										
										
										
											2011-03-28 13:24:25 +02:00
										 |  |  |     testLongEvaluation(); | 
					
						
							| 
									
										
										
										
											2011-03-15 11:23:06 +01:00
										 |  |  |     testMPI(); | 
					
						
							| 
									
										
										
										
											2011-03-10 12:13:12 +01:00
										 |  |  |     testStuffA(); | 
					
						
							| 
									
										
										
										
											2011-03-01 12:39:53 +01:00
										 |  |  |     testPrivate(); | 
					
						
							| 
									
										
										
										
											2010-12-08 14:08:35 +01:00
										 |  |  |     testMemoryView(); | 
					
						
							| 
									
										
										
										
											2010-06-01 14:29:15 +02:00
										 |  |  |     //testQSettings();
 | 
					
						
							| 
									
										
										
										
											2010-05-27 18:23:51 +02:00
										 |  |  |     //testWCout0();
 | 
					
						
							|  |  |  |     //testWCout();
 | 
					
						
							| 
									
										
										
										
											2010-10-26 10:40:31 +02:00
										 |  |  |     testSSE(); | 
					
						
							| 
									
										
										
										
											2010-08-12 12:39:14 +02:00
										 |  |  |     testQLocale(); | 
					
						
							| 
									
										
										
										
											2010-05-05 11:46:03 +02:00
										 |  |  |     testColor(); | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     qregion::testQRegion(); | 
					
						
							| 
									
										
										
										
											2010-08-30 09:32:55 +02:00
										 |  |  |     testTypedef(); | 
					
						
							| 
									
										
										
										
											2011-07-08 08:52:53 +02:00
										 |  |  |     basic::testBasic(); | 
					
						
							| 
									
										
										
										
											2010-05-19 14:18:41 +02:00
										 |  |  |     testStuff(); | 
					
						
							| 
									
										
										
										
											2010-03-16 18:39:06 +01:00
										 |  |  |     testPeekAndPoke3(); | 
					
						
							| 
									
										
										
										
											2010-02-26 14:25:36 +01:00
										 |  |  |     testFunctionPointer(); | 
					
						
							| 
									
										
										
										
											2010-02-15 16:59:00 +01:00
										 |  |  |     testAnonymous(); | 
					
						
							| 
									
										
										
										
											2010-01-04 13:16:10 +01:00
										 |  |  |     testReference(); | 
					
						
							| 
									
										
										
										
											2010-04-07 09:19:36 +02:00
										 |  |  |     //testEndlessLoop();
 | 
					
						
							| 
									
										
										
										
											2009-10-01 09:02:32 +02:00
										 |  |  |     //testEndlessRecursion();
 | 
					
						
							| 
									
										
										
										
											2009-08-28 09:44:11 +02:00
										 |  |  |     testQStack(); | 
					
						
							|  |  |  |     testUninitialized(); | 
					
						
							| 
									
										
										
										
											2009-07-23 12:34:49 +02:00
										 |  |  |     testPointer(); | 
					
						
							| 
									
										
										
										
											2010-09-27 12:40:14 +02:00
										 |  |  |     testQDate(); | 
					
						
							| 
									
										
										
										
											2009-09-03 09:15:24 +02:00
										 |  |  |     testQDateTime(); | 
					
						
							| 
									
										
										
										
											2010-09-27 12:40:14 +02:00
										 |  |  |     testQTime(); | 
					
						
							| 
									
										
										
										
											2009-07-14 18:14:49 +02:00
										 |  |  |     testQFileInfo(); | 
					
						
							| 
									
										
										
										
											2010-10-08 14:26:44 +02:00
										 |  |  |     testQFixed(); | 
					
						
							| 
									
										
										
										
											2009-06-23 10:24:25 +02:00
										 |  |  |     testObject1(); | 
					
						
							|  |  |  |     testVector1(); | 
					
						
							|  |  |  |     testQHash1(); | 
					
						
							| 
									
										
										
										
											2010-07-07 17:11:10 +02:00
										 |  |  |     testSignalSlot(argc, argv); | 
					
						
							| 
									
										
										
										
											2009-06-23 10:24:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-10 20:42:22 +02:00
										 |  |  |     QVector<int> qv; | 
					
						
							|  |  |  |     qv.push_back(2); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     std::vector<int> v; | 
					
						
							|  |  |  |     v.push_back(2); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-26 13:20:14 +02:00
										 |  |  |     QString hallo = "hallo\nwelt"; | 
					
						
							| 
									
										
										
										
											2009-03-03 17:27:25 +01:00
										 |  |  |     QStringList list; | 
					
						
							|  |  |  |     list << "aaa" << "bbb" << "cc"; | 
					
						
							| 
									
										
										
										
											2009-05-25 17:19:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-16 13:25:58 +02:00
										 |  |  |     QList<const char *> list2; | 
					
						
							|  |  |  |     list2 << "foo"; | 
					
						
							|  |  |  |     list2 << "bar"; | 
					
						
							|  |  |  |     list2 << 0; | 
					
						
							|  |  |  |     list2 << "baz"; | 
					
						
							|  |  |  |     list2 << 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-03 12:46:55 +02:00
										 |  |  |     testQStandardItemModel(); | 
					
						
							| 
									
										
										
										
											2010-03-15 17:44:56 +01:00
										 |  |  |     testFunction(); | 
					
						
							| 
									
										
										
										
											2009-05-29 16:24:46 +02:00
										 |  |  |     testQImage(); | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     noargs::testNoArgumentName(1, 2, 3); | 
					
						
							| 
									
										
										
										
											2010-09-28 09:35:59 +02:00
										 |  |  |     testQTextCursor(); | 
					
						
							| 
									
										
										
										
											2010-07-07 17:46:52 +02:00
										 |  |  |     testInput(); | 
					
						
							|  |  |  |     testOutput(); | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  |     testHidden(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     testArray(); | 
					
						
							| 
									
										
										
										
											2010-02-11 17:29:10 +01:00
										 |  |  |     testCatchThrow(); | 
					
						
							| 
									
										
										
										
											2009-04-02 10:54:22 +02:00
										 |  |  |     testQByteArray(); | 
					
						
							| 
									
										
										
										
											2011-02-02 19:03:06 +01:00
										 |  |  |     testQByteArray2(); | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-16 11:17:00 +01:00
										 |  |  |     testStdDeque(); | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  |     testStdList(); | 
					
						
							| 
									
										
										
										
											2010-04-15 18:28:58 +02:00
										 |  |  |     testStdHashSet(); | 
					
						
							| 
									
										
										
										
											2008-12-11 16:10:47 +01:00
										 |  |  |     testStdMap(); | 
					
						
							| 
									
										
										
										
											2009-03-11 13:31:38 +01:00
										 |  |  |     testStdSet(); | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  |     testStdStack(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     testStdString(); | 
					
						
							| 
									
										
										
										
											2008-12-10 14:37:15 +01:00
										 |  |  |     testStdVector(); | 
					
						
							| 
									
										
										
										
											2011-07-04 18:31:31 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     formats::testFormats(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-26 14:24:36 +02:00
										 |  |  |     testPassByReference(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     testPlugin(); | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  |     testQList(); | 
					
						
							| 
									
										
										
										
											2009-01-08 11:02:04 +01:00
										 |  |  |     testQLinkedList(); | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     namespc::testNamespace(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     //return 0;
 | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  |     testQHash(); | 
					
						
							|  |  |  |     testQImage(); | 
					
						
							|  |  |  |     testQMap(); | 
					
						
							| 
									
										
										
										
											2009-01-07 15:31:58 +01:00
										 |  |  |     testQMultiMap(); | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  |     testQString(); | 
					
						
							| 
									
										
										
										
											2010-10-26 10:40:31 +02:00
										 |  |  |     testQUrl(); | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  |     testQSet(); | 
					
						
							| 
									
										
										
										
											2009-04-17 15:34:46 +02:00
										 |  |  |     testQSharedPointer(); | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  |     testQStringList(); | 
					
						
							| 
									
										
										
										
											2011-02-10 15:17:55 +01:00
										 |  |  |     testQScriptValue(argc, argv); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     testStruct(); | 
					
						
							| 
									
										
										
										
											2011-06-28 16:31:31 +02:00
										 |  |  |     //qthread::testQThread();
 | 
					
						
							|  |  |  |     qvariant::testQVariant(); | 
					
						
							| 
									
										
										
										
											2011-07-07 12:02:40 +02:00
										 |  |  |     qvector::testQVector(); | 
					
						
							| 
									
										
										
										
											2008-12-08 11:58:36 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-04 17:22:58 +01:00
										 |  |  |     testBoostOptional(); | 
					
						
							| 
									
										
										
										
											2011-03-04 16:49:25 +01:00
										 |  |  |     testBoostSharedPtr(); | 
					
						
							| 
									
										
										
										
											2008-12-08 11:58:36 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-28 15:32:31 +02:00
										 |  |  |     //*(int *)0 = 0;
 | 
					
						
							| 
									
										
										
										
											2011-03-04 19:26:11 +01:00
										 |  |  |     testFork(); | 
					
						
							| 
									
										
										
										
											2008-12-08 11:58:36 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 16:31:50 +01:00
										 |  |  |     testQObject(argc, argv); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     //QColor color(255,128,10);
 | 
					
						
							|  |  |  |     //QFont font;
 | 
					
						
							| 
									
										
										
										
											2010-10-04 12:19:28 +02:00
										 |  |  |     return 0; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QT_BEGIN_NAMESPACE | 
					
						
							| 
									
										
										
										
											2009-07-06 11:37:21 +02:00
										 |  |  | QT_END_NAMESPACE | 
					
						
							| 
									
										
										
										
											2009-11-27 14:47:03 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-03 11:15:27 +02:00
										 |  |  | #include "simple_gdbtest_app.moc"
 |