debugger: allow (most of) the manual test being run gui-less

Change-Id: Ib620b33ea477b154a1ec64af6f57e392a1827e4d
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2012-07-19 12:44:55 +02:00
parent c946b9e4bf
commit a4fcd8d3cb
2 changed files with 51 additions and 11 deletions

View File

@@ -123,6 +123,7 @@ void dummyStatement(...) {}
#undef __STRICT_ANSI__ // working around compile error with MinGW #undef __STRICT_ANSI__ // working around compile error with MinGW
#endif #endif
#include <QCoreApplication>
#include <QDebug> #include <QDebug>
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
@@ -146,16 +147,19 @@ void dummyStatement(...) {}
#include <QSharedPointer> #include <QSharedPointer>
#endif #endif
#if USE_GUILIB
#include <QAction>
#include <QApplication> // QWidgets: Separate module as of Qt 5
#include <QColor> #include <QColor>
#include <QFont> #include <QFont>
#include <QLabel>
//#include <QtGui/private/qfixed_p.h>
#include <QPainter> #include <QPainter>
#include <QPainterPath> #include <QPainterPath>
#include <QRegion> #include <QRegion>
#include <QStandardItemModel>
#include <QTextCursor> #include <QTextCursor>
#include <QTextDocument> #include <QTextDocument>
#endif
#if USE_SCRIPTLIB #if USE_SCRIPTLIB
#include <QScriptEngine> #include <QScriptEngine>
@@ -171,11 +175,6 @@ void dummyStatement(...) {}
#include <QHostAddress> #include <QHostAddress>
#include <QNetworkRequest> #include <QNetworkRequest>
#include <QApplication> // QWidgets: Separate module as of Qt 5
#include <QAction>
#include <QStandardItemModel>
#include <QLabel>
#if USE_CXX11 #if USE_CXX11
#include <array> #include <array>
#endif #endif
@@ -442,6 +441,7 @@ namespace peekandpoke {
void testQImageDisplay() void testQImageDisplay()
{ {
#if USE_GUILIB
QImage im(QSize(200, 200), QImage::Format_RGB32); QImage im(QSize(200, 200), QImage::Format_RGB32);
im.fill(QColor(200, 10, 30).rgba()); im.fill(QColor(200, 10, 30).rgba());
QPainter pain; QPainter pain;
@@ -478,6 +478,7 @@ namespace peekandpoke {
pain.end(); pain.end();
dummyStatement(&pain); dummyStatement(&pain);
#endif
} }
void testPeekAndPoke3() void testPeekAndPoke3()
@@ -983,6 +984,7 @@ namespace painting {
void testQImage() void testQImage()
{ {
#if USE_GUILIB
// only works with Python dumper // only works with Python dumper
QImage im(QSize(200, 200), QImage::Format_RGB32); QImage im(QSize(200, 200), QImage::Format_RGB32);
im.fill(QColor(200, 100, 130).rgba()); im.fill(QColor(200, 100, 130).rgba());
@@ -998,10 +1000,12 @@ namespace painting {
pain.drawRect(30, 30, 80, 80); pain.drawRect(30, 30, 80, 80);
pain.end(); pain.end();
dummyStatement(&pain, &im); dummyStatement(&pain, &im);
#endif
} }
void testQPixmap() void testQPixmap()
{ {
#if USE_GUILIB
QImage im(QSize(200, 200), QImage::Format_RGB32); QImage im(QSize(200, 200), QImage::Format_RGB32);
im.fill(QColor(200, 100, 130).rgba()); im.fill(QColor(200, 100, 130).rgba());
QPainter pain; QPainter pain;
@@ -1015,6 +1019,7 @@ namespace painting {
// Check pm (200x200) QPixmap. // Check pm (200x200) QPixmap.
// Continue. // Continue.
dummyStatement(&im, &pm); dummyStatement(&im, &pm);
#endif
} }
void testPainting() void testPainting()
@@ -1630,8 +1635,16 @@ namespace qobject {
{ {
Q_OBJECT Q_OBJECT
public: public:
TestObject(QObject *parent = 0) : QObject(parent) TestObject(QObject *parent = 0)
{ m_ui = new Ui; m_ui->w = new QWidget; } : QObject(parent)
{
m_ui = new Ui;
#if USE_GUILIB
m_ui->w = new QWidget;
#else
m_ui->w = 0;
#endif
}
Q_PROPERTY(QString myProp1 READ myProp1 WRITE setMyProp1) Q_PROPERTY(QString myProp1 READ myProp1 WRITE setMyProp1)
QString myProp1() const { return m_myProp1; } QString myProp1() const { return m_myProp1; }
@@ -1677,6 +1690,7 @@ namespace qobject {
#endif #endif
#if 1 #if 1
#if USE_GUILIB
QWidget ob; QWidget ob;
ob.setObjectName("An Object"); ob.setObjectName("An Object");
ob.setProperty("USER DEFINED 1", 44); ob.setProperty("USER DEFINED 1", 44);
@@ -1687,6 +1701,7 @@ namespace qobject {
QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater())); QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater()));
QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater())); QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater()));
//QObject::connect(&app, SIGNAL(lastWindowClosed()), &ob, SLOT(deleteLater())); //QObject::connect(&app, SIGNAL(lastWindowClosed()), &ob, SLOT(deleteLater()));
#endif
#endif #endif
#if 0 #if 0
@@ -1876,9 +1891,9 @@ namespace qregexp {
} // namespace qregexp } // namespace qregexp
namespace qrect { namespace qrect {
#if USE_GUILIB
void testQPoint() void testQPoint()
{ {
QPoint s; QPoint s;
@@ -1960,15 +1975,18 @@ namespace qrect {
// Continue. // Continue.
dummyStatement(&s); dummyStatement(&s);
} }
#endif
void testGeometry() void testGeometry()
{ {
#if USE_GUILIB
testQPoint(); testQPoint();
testQPointF(); testQPointF();
testQRect(); testQRect();
testQRectF(); testQRectF();
testQSize(); testQSize();
testQSizeF(); testQSizeF();
#endif
} }
} // namespace qrect } // namespace qrect
@@ -1978,6 +1996,7 @@ namespace qregion {
void testQRegion() void testQRegion()
{ {
#if USE_GUILIB
// Works with Python dumpers only. // Works with Python dumpers only.
QRegion region; QRegion region;
BREAK_HERE; BREAK_HERE;
@@ -2027,6 +2046,7 @@ namespace qregion {
// Check region <4 items> QRegion. // Check region <4 items> QRegion.
// Continue. // Continue.
dummyStatement(&region); dummyStatement(&region);
#endif
} }
} // namespace qregion } // namespace qregion
@@ -2141,10 +2161,12 @@ namespace final {
void testApplicationStart(QCoreApplication *app) void testApplicationStart(QCoreApplication *app)
{ {
#if USE_GUILIB
QString str = QString::fromUtf8("XXXXXXXXXXXXXXyyXXX ö"); QString str = QString::fromUtf8("XXXXXXXXXXXXXXyyXXX ö");
QLabel l(str); QLabel l(str);
l.setObjectName("Some Label"); l.setObjectName("Some Label");
l.show(); l.show();
#endif
// Jump over next line. // Jump over next line.
return; return;
app->exec(); app->exec();
@@ -3376,6 +3398,7 @@ namespace itemmodel {
void testItemModel() void testItemModel()
{ {
#if USE_GUILIB
//char buf[100]; //char buf[100];
//QString *s = static_cast<QString *>(static_cast<void *>(&(v.data_ptr().data.c))); //QString *s = static_cast<QString *>(static_cast<void *>(&(v.data_ptr().data.c)));
//QString *t = (QString *)&(v.data_ptr()); //QString *t = (QString *)&(v.data_ptr());
@@ -3397,6 +3420,7 @@ namespace itemmodel {
// Check mi "1" QModelIndex. // Check mi "1" QModelIndex.
// Continue. // Continue.
dummyStatement(&i1, &mi, &m, &i2, &i11); dummyStatement(&i1, &mi, &m, &i2, &i11);
#endif
} }
} // namespace itemmodel } // namespace itemmodel
@@ -3702,6 +3726,7 @@ namespace text {
void testText() void testText()
{ {
#if USE_GUILIB
//char *argv[] = { "xxx", 0 }; //char *argv[] = { "xxx", 0 };
QTextDocument doc; QTextDocument doc;
doc.setPlainText("Hallo\nWorld"); doc.setPlainText("Hallo\nWorld");
@@ -3722,6 +3747,7 @@ namespace text {
// Check anc 1 int. // Check anc 1 int.
// Continue. // Continue.
dummyStatement(&pos, &anc); dummyStatement(&pos, &anc);
#endif
} }
} // namespace text } // namespace text
@@ -3853,6 +3879,8 @@ namespace qvariant {
BREAK_HERE; BREAK_HERE;
// Check var "Hello 10" QVariant (QString). // Check var "Hello 10" QVariant (QString).
// Continue. // Continue.
#if USE_GUILIB
var.setValue(QRect(100, 200, 300, 400)); // 19 QRect var.setValue(QRect(100, 200, 300, 400)); // 19 QRect
BREAK_HERE; BREAK_HERE;
// Check var 300x400+100+200 QVariant (QRect). // Check var 300x400+100+200 QVariant (QRect).
@@ -3861,6 +3889,7 @@ namespace qvariant {
BREAK_HERE; BREAK_HERE;
// Check var 300x400+100+200 QVariant (QRectF). // Check var 300x400+100+200 QVariant (QRectF).
// Continue. // Continue.
#endif
/* /*
"QStringList", # 11 "QStringList", # 11
@@ -6390,7 +6419,11 @@ namespace sanity {
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#if USE_GUILIB
QApplication app(argc, argv); QApplication app(argc, argv);
#else
QCoreApplication app(argc, argv);
#endif
QChar c(0x1E9E); QChar c(0x1E9E);
bool b = c.isPrint(); bool b = c.isPrint();

View File

@@ -18,6 +18,13 @@ greaterThan(QT_MAJOR_VERSION, 4) {
QT += core-private QT += core-private
QT *= widgets QT *= widgets
} }
false {
QT -= gui webkit widgets
} else {
DEFINES += USE_GUILIB
}
#unix: QMAKE_CXXFLAGS += -msse2 #unix: QMAKE_CXXFLAGS += -msse2
#DEFINES += USE_BOOST=1 #DEFINES += USE_BOOST=1