summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJustin McPherson <justin.mcpherson@nokia.com>2010-08-12 07:12:25 (GMT)
committerJustin McPherson <justin.mcpherson@nokia.com>2010-08-12 07:12:25 (GMT)
commit224d8f7619447a4784da533ac26760ea1e7b9087 (patch)
tree5407614135100025a375acf049ace2074e3e6f11 /tests
parente7a19af4430b45f371bb33120f0ed39a2c83b733 (diff)
parentadd9c43407a63c28f1107b9a77e74f6f62593246 (diff)
downloadQt-224d8f7619447a4784da533ac26760ea1e7b9087.zip
Qt-224d8f7619447a4784da533ac26760ea1e7b9087.tar.gz
Qt-224d8f7619447a4784da533ac26760ea1e7b9087.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/compilerwarnings/test_cpp.txt3
-rw-r--r--tests/auto/compilerwarnings/tst_compilerwarnings.cpp7
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/signalEmission.qml33
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp58
-rw-r--r--tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml15
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp12
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp7
-rw-r--r--tests/auto/qdom/qdom.pro4
-rw-r--r--tests/auto/qdom/tst_qdom.cpp1
-rw-r--r--tests/auto/qfile/qfile.pro2
-rw-r--r--tests/auto/qfileinfo/qfileinfo.pro1
-rw-r--r--tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp388
-rw-r--r--tests/auto/qlocale/test/test.pro2
-rw-r--r--tests/auto/qmetaobject/tst_qmetaobject.cpp6
-rw-r--r--tests/auto/qpluginloader/lib/lib.pro2
-rw-r--r--tests/auto/qpluginloader/tst/tst.pro2
-rw-r--r--tests/auto/qpluginloader/tst_qpluginloader.cpp2
-rw-r--r--tests/auto/qregexp/tst_qregexp.cpp18
-rw-r--r--tests/auto/qsslsocket/qsslsocket.pro1
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp2
-rw-r--r--tests/auto/qstatictext/tst_qstatictext.cpp106
-rw-r--r--tests/auto/qstring/tst_qstring.cpp12
-rw-r--r--tests/auto/qsvgrenderer/qsvgrenderer.pro4
-rw-r--r--tests/auto/qtextcodec/qtextcodec.pro2
-rw-r--r--tests/auto/qtextcodec/test/test.pro4
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp2
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp30
-rw-r--r--tests/auto/qtextstream/qtextstream.pro3
-rw-r--r--tests/auto/qtimer/tst_qtimer.cpp44
-rw-r--r--tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml1
-rw-r--r--tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd12
-rw-r--r--tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp6
-rw-r--r--tests/benchmarks/corelib/tools/qregexp/main.cpp304
-rw-r--r--tests/benchmarks/corelib/tools/qregexp/qregexp.pro11
-rw-r--r--tests/benchmarks/corelib/tools/qregexp/qregexp.qrc6
-rw-r--r--tests/manual/inputmethodhints/inputmethodhints.cpp99
-rw-r--r--tests/manual/inputmethodhints/inputmethodhints.h63
-rw-r--r--tests/manual/inputmethodhints/inputmethodhints.pro13
-rw-r--r--tests/manual/inputmethodhints/inputmethodhints.ui138
-rw-r--r--tests/manual/inputmethodhints/main.cpp53
41 files changed, 1446 insertions, 35 deletions
diff --git a/tests/auto/compilerwarnings/test_cpp.txt b/tests/auto/compilerwarnings/test_cpp.txt
index 62b35eb..1d317b8 100644
--- a/tests/auto/compilerwarnings/test_cpp.txt
+++ b/tests/auto/compilerwarnings/test_cpp.txt
@@ -58,6 +58,9 @@
#include <QtDBus/QtDBus>
#endif
+#include <QtDeclarative/QtDeclarative>
+
+
#ifndef Q_OS_MAC
int main(int, char **)
{
diff --git a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
index 82c327a..8d344d8 100644
--- a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
+++ b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
@@ -114,6 +114,9 @@ void tst_CompilerWarnings::warnings_data()
QTest::addColumn<QStringList>("cflags");
QTest::newRow("standard") << QStringList();
+ QTest::newRow("warn deprecated, fast plus, no debug") << (QStringList() << "-DQT_DEPRECATED_WARNINGS"
+ << "-DQT_USE_FAST_OPERATOR_PLUS" << "-DQT_NU_DEBUG" << "-DQT_NO_DEBUG_STREAM" << "-DQT_NO_WARNING_OUTPUT");
+ QTest::newRow("no deprecated, no keywords") << (QStringList() << "-DQT_NO_DEPRECATED" << "-DQT_NO_KEYWORDS");
#if 0
#ifdef Q_WS_QWS
@@ -136,14 +139,14 @@ void tst_CompilerWarnings::warnings()
QSKIP("gcc 3.x outputs too many bogus warnings", SkipAll);
#endif
- static QString tmpFile;
+ /*static*/ QString tmpFile;
if (tmpFile.isEmpty()) {
QTemporaryFile tmpQFile;
tmpQFile.open();
tmpFile = tmpQFile.fileName();
tmpQFile.close();
}
- static QString tmpSourceFile;
+ /*static*/ QString tmpSourceFile;
bool openResult = true;
const QString tmpBaseName("XXXXXX-test.cpp");
QString templatePath = QDir::temp().absoluteFilePath(tmpBaseName);
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/signalEmission.qml b/tests/auto/declarative/qdeclarativefocusscope/data/signalEmission.qml
new file mode 100644
index 0000000..07601c7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/signalEmission.qml
@@ -0,0 +1,33 @@
+import Qt 4.7
+
+Rectangle {
+ width: 200
+ height: 200
+
+ FocusScope {
+ focus: true
+ Rectangle {
+ objectName: "item1"
+ color: "blue"
+ onFocusChanged: focus ? color = "red" : color = "blue"
+ }
+ Rectangle {
+ objectName: "item2"
+ color: "blue"
+ onFocusChanged: focus ? color = "red" : color = "blue"
+ }
+ }
+
+ FocusScope {
+ Rectangle {
+ objectName: "item3"
+ color: "blue"
+ onFocusChanged: focus ? color = "red" : color = "blue"
+ }
+ Rectangle {
+ objectName: "item4"
+ color: "blue"
+ onFocusChanged: focus ? color = "red" : color = "blue"
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
index b0c9c03..ec8f048 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
+++ b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
@@ -69,6 +69,7 @@ private slots:
void textEdit();
void forceFocus();
void noParentFocus();
+ void signalEmission();
};
/*
@@ -335,7 +336,7 @@ void tst_qdeclarativefocusscope::noParentFocus()
view->setSource(QUrl::fromLocalFile(SRCDIR "/data/chain.qml"));
QVERIFY(view->rootObject());
- QVERIFY(view->rootObject()->property("focus1") == true);
+ QVERIFY(view->rootObject()->property("focus1") == false);
QVERIFY(view->rootObject()->property("focus2") == false);
QVERIFY(view->rootObject()->property("focus3") == true);
QVERIFY(view->rootObject()->property("focus4") == true);
@@ -344,6 +345,61 @@ void tst_qdeclarativefocusscope::noParentFocus()
delete view;
}
+void tst_qdeclarativefocusscope::signalEmission()
+{
+ QDeclarativeView *view = new QDeclarativeView;
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/signalEmission.qml"));
+
+ QDeclarativeRectangle *item1 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item1"));
+ QDeclarativeRectangle *item2 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item2"));
+ QDeclarativeRectangle *item3 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item3"));
+ QDeclarativeRectangle *item4 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item4"));
+ QVERIFY(item1 != 0);
+ QVERIFY(item2 != 0);
+ QVERIFY(item3 != 0);
+ QVERIFY(item4 != 0);
+
+ view->show();
+ qApp->setActiveWindow(view);
+ qApp->processEvents();
+
+#ifdef Q_WS_X11
+ // to be safe and avoid failing setFocus with window managers
+ qt_x11_wait_for_window_manager(view);
+#endif
+
+ QVariant blue(QColor("blue"));
+ QVariant red(QColor("red"));
+
+ QVERIFY(view->hasFocus());
+ QVERIFY(view->scene()->hasFocus());
+ item1->setFocus(true);
+ QCOMPARE(item1->property("color"), red);
+ QCOMPARE(item2->property("color"), blue);
+ QCOMPARE(item3->property("color"), blue);
+ QCOMPARE(item4->property("color"), blue);
+
+ item2->setFocus(true);
+ QCOMPARE(item1->property("color"), blue);
+ QCOMPARE(item2->property("color"), red);
+ QCOMPARE(item3->property("color"), blue);
+ QCOMPARE(item4->property("color"), blue);
+
+ item3->setFocus(true);
+ QCOMPARE(item1->property("color"), blue);
+ QCOMPARE(item2->property("color"), red);
+ QCOMPARE(item3->property("color"), red);
+ QCOMPARE(item4->property("color"), blue);
+
+ item4->setFocus(true);
+ QCOMPARE(item1->property("color"), blue);
+ QCOMPARE(item2->property("color"), red);
+ QCOMPARE(item3->property("color"), blue);
+ QCOMPARE(item4->property("color"), red);
+
+ delete view;
+}
+
QTEST_MAIN(tst_qdeclarativefocusscope)
#include "tst_qdeclarativefocusscope.moc"
diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
index d5a911a..db1f191 100644
--- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
+++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
@@ -585,7 +585,7 @@ void tst_qdeclarativeinstruction::dump()
<< "45\t\t48\tDEFER\t\t\t7"
<< "46\t\tNA\tDEFER\t\t\t7"
<< "47\t\t48\tSTORE_IMPORTED_SCRIPT\t2"
- << "48\t\t50\tXXX UNKOWN INSTRUCTION\t1234"
+ << "48\t\t50\tXXX UNKNOWN INSTRUCTION\t1234"
<< "49\t\t51\tSTORE_VARIANT_INTEGER\t\t32\t11"
<< "50\t\t52\tSTORE_VARIANT_DOUBLE\t\t19\t33.7"
<< "-------------------------------------------------------------------------------";
diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml
new file mode 100644
index 0000000..f19ab4f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml
@@ -0,0 +1,15 @@
+import Qt 4.7
+
+Rectangle {
+ width: 300
+ height: 300
+
+ Rectangle {
+ height: childrenRect.height
+
+ Repeater {
+ model: 1
+ Rectangle { }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index d76d360..25ca157 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -75,6 +75,7 @@ private slots:
void childrenRect();
void childrenRectBug();
void childrenRectBug2();
+ void childrenRectBug3();
void childrenProperty();
void resourcesProperty();
@@ -780,6 +781,17 @@ void tst_QDeclarativeItem::childrenRectBug2()
delete canvas;
}
+// QTBUG-12722
+void tst_QDeclarativeItem::childrenRectBug3()
+{
+ QDeclarativeView *canvas = new QDeclarativeView(0);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug3.qml"));
+ canvas->show();
+
+ //don't crash on delete
+ delete canvas;
+}
+
template<typename T>
T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName)
{
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index 858c26d..10805b4 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -271,6 +271,9 @@ void tst_qdeclarativelistmodel::dynamic_data()
QTest::newRow("nested-insert") << "{append({'foo':123});insert(0,{'bars':[{'a':1},{'b':2},{'c':3}]});get(0).bars.get(0).a}" << 1 << "";
QTest::newRow("nested-set") << "{append({'foo':123});set(0,{'foo':[{'x':123}]});get(0).foo.get(0).x}" << 123 << "";
+ QTest::newRow("nested-count") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]}); get(0).bars.count}" << 3 << "";
+ QTest::newRow("nested-clear") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]}); get(0).bars.clear(); get(0).bars.count}" << 0 << "";
+
// XXX
//QTest::newRow("nested-setprop") << "{append({'foo':123});setProperty(0,'foo',[{'x':123}]);get(0).foo.get(0).x}" << 123 << "";
}
@@ -344,9 +347,7 @@ void tst_qdeclarativelistmodel::dynamic_worker()
waitForWorker(item);
QDeclarativeExpression e(eng.rootContext(), &model, operations.last().toString());
- if (QByteArray(QTest::currentDataTag()).startsWith("nested"))
- QVERIFY(e.evaluate().toInt() != result);
- else
+ if (!QByteArray(QTest::currentDataTag()).startsWith("nested"))
QCOMPARE(e.evaluate().toInt(), result);
}
diff --git a/tests/auto/qdom/qdom.pro b/tests/auto/qdom/qdom.pro
index 5434ada..9040b91 100644
--- a/tests/auto/qdom/qdom.pro
+++ b/tests/auto/qdom/qdom.pro
@@ -9,7 +9,9 @@ wince*|symbian: {
addFiles.path = .
DEPLOYMENT += addFiles
- DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
+ wince*|qt_not_deployed {
+ DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
+ }
!symbian:DEFINES += SRCDIR=\\\"\\\"
}
else {
diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp
index 0f6cdaa..8bf7620 100644
--- a/tests/auto/qdom/tst_qdom.cpp
+++ b/tests/auto/qdom/tst_qdom.cpp
@@ -1776,6 +1776,7 @@ void tst_QDom::crashInSetContent() const
QDomImplementation::setInvalidDataPolicy(QDomImplementation::ReturnNullNode);
QDomDocument docImport;
+ QCOMPARE(docImport.setContent(QLatin1String("<a:>text</a:>"), true), false);
QVERIFY(docImport.setContent(QLatin1String("<?xml version=\"1.0\"?><e/>")));
}
diff --git a/tests/auto/qfile/qfile.pro b/tests/auto/qfile/qfile.pro
index 0383e30..727f660 100644
--- a/tests/auto/qfile/qfile.pro
+++ b/tests/auto/qfile/qfile.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
-wince*:{
+wince*|symbian:{
SUBDIRS = test
} else {
SUBDIRS = test stdinprocess
diff --git a/tests/auto/qfileinfo/qfileinfo.pro b/tests/auto/qfileinfo/qfileinfo.pro
index ef5ed22..30656e2 100644
--- a/tests/auto/qfileinfo/qfileinfo.pro
+++ b/tests/auto/qfileinfo/qfileinfo.pro
@@ -16,6 +16,7 @@ wince*:|symbian: {
symbian {
TARGET.CAPABILITY=AllFiles
LIBS *= -lefsrv
+ INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE # Needed for e32svr.h in S^3 envs
}
# support for running test from shadow build directory
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index d1d6860..03c1d5b 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -107,12 +107,13 @@ private slots:
void avoidRecursionInInsertItem();
void styleInfoLeak();
void task236367_maxSizeHint();
+ void heightForWidth();
};
class RectWidget : public QGraphicsWidget
{
public:
- RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){}
+ RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent), m_fnConstraint(0) {}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
@@ -125,9 +126,12 @@ public:
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
{
- if (m_sizeHints[which].isValid()) {
+ if (constraint.width() < 0 && constraint.height() < 0 && m_sizeHints[which].isValid()) {
return m_sizeHints[which];
}
+ if (m_fnConstraint) {
+ return m_fnConstraint(which, constraint);
+ }
return QGraphicsWidget::sizeHint(which, constraint);
}
@@ -136,7 +140,13 @@ public:
updateGeometry();
}
+ void setConstraintFunction(QSizeF (*fnConstraint)(Qt::SizeHint, const QSizeF &)) {
+ m_fnConstraint = fnConstraint;
+ }
+
QSizeF m_sizeHints[Qt::NSizeHints];
+ QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &);
+
};
struct ItemDesc
@@ -146,7 +156,8 @@ struct ItemDesc
m_rowSpan(1),
m_colSpan(1),
m_sizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)),
- m_align(0)
+ m_align(0),
+ m_fnConstraint(0)
{
}
@@ -213,8 +224,20 @@ struct ItemDesc
return (*this);
}
+ ItemDesc &heightForWidth(QSizeF (*fnConstraint)(Qt::SizeHint, const QSizeF &)) {
+ m_fnConstraint = fnConstraint;
+ m_constraintOrientation = Qt::Vertical;
+ return (*this);
+ }
+
void apply(QGraphicsGridLayout *layout, QGraphicsWidget *item) {
- item->setSizePolicy(m_sizePolicy);
+ QSizePolicy sp = m_sizePolicy;
+ if (m_fnConstraint) {
+ sp.setHeightForWidth(m_constraintOrientation == Qt::Vertical);
+ //sp.setWidthForHeight(m_constraintOrientation == Qt::Horizontal);
+ }
+
+ item->setSizePolicy(sp);
for (int i = 0; i < Qt::NSizeHints; ++i) {
if (!m_sizes[i].isValid())
continue;
@@ -233,6 +256,7 @@ struct ItemDesc
break;
}
}
+
layout->addItem(item, m_pos.first, m_pos.second, m_rowSpan, m_colSpan);
layout->setAlignment(item, m_align);
}
@@ -240,6 +264,7 @@ struct ItemDesc
void apply(QGraphicsGridLayout *layout, RectWidget *item) {
for (int i = 0; i < Qt::NSizeHints; ++i)
item->setSizeHint((Qt::SizeHint)i, m_sizeHints[i]);
+ item->setConstraintFunction(m_fnConstraint);
apply(layout, static_cast<QGraphicsWidget*>(item));
}
@@ -251,6 +276,9 @@ struct ItemDesc
QSizeF m_sizeHints[Qt::NSizeHints];
QSizeF m_sizes[Qt::NSizeHints];
Qt::Alignment m_align;
+
+ Qt::Orientation m_constraintOrientation;
+ QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &);
};
typedef QList<ItemDesc> ItemList;
@@ -485,12 +513,12 @@ void tst_QGraphicsGridLayout::alignment()
widget->resize(widget->effectiveSizeHint(Qt::MaximumSize));
QApplication::processEvents();
- QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(0, 0, 50, 25));
- QCOMPARE(layout->itemAt(1,0)->geometry(), QRectF(0, 25, 50, 25));
- QCOMPARE(layout->itemAt(0,1)->geometry(), QRectF(125, 0, 50, 25));
- QCOMPARE(layout->itemAt(1,1)->geometry(), QRectF(125, 25, 50, 25));
- QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(250, 0, 50, 25));
- QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(250, 25, 50, 25));
+ QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(0, 0, 50, 50));
+ QCOMPARE(layout->itemAt(1,0)->geometry(), QRectF(0, 50, 50, 50));
+ QCOMPARE(layout->itemAt(0,1)->geometry(), QRectF(125, 0, 50, 50));
+ QCOMPARE(layout->itemAt(1,1)->geometry(), QRectF(125, 50, 50, 50));
+ QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(250, 0, 50, 50));
+ QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(250, 50, 50, 50));
delete widget;
}
@@ -544,12 +572,12 @@ void tst_QGraphicsGridLayout::columnAlignment()
| HCenter | Right | Left |
+---------------------------------+
*/
- QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(0, 0, 50, 25));
- QCOMPARE(layout->itemAt(1,0)->geometry(), QRectF(25, 26, 50, 25)); // item is king
- QCOMPARE(layout->itemAt(0,1)->geometry(), QRectF(126, 0, 50, 25));
- QCOMPARE(layout->itemAt(1,1)->geometry(), QRectF(151, 26, 50, 25)); // item is king
- QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(252, 0, 50, 25));
- QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(202, 26, 50, 25)); // item is king
+ QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(0, 0, 50, 50));
+ QCOMPARE(layout->itemAt(1,0)->geometry(), QRectF(25, 51, 50, 50)); // item is king
+ QCOMPARE(layout->itemAt(0,1)->geometry(), QRectF(126, 0, 50, 50));
+ QCOMPARE(layout->itemAt(1,1)->geometry(), QRectF(151, 51, 50, 50)); // item is king
+ QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(252, 0, 50, 50));
+ QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(202, 51, 50, 50)); // item is king
delete widget;
}
@@ -2116,6 +2144,17 @@ void tst_QGraphicsGridLayout::alignment2()
delete widget;
}
+static QSizeF hfw1(Qt::SizeHint, const QSizeF &constraint)
+{
+ QSizeF result(constraint);
+ if (constraint.width() < 0 && constraint.height() < 0) {
+ return QSizeF(50, 400);
+ } else if (constraint.width() >= 0) {
+ result.setHeight(20000./constraint.width());
+ }
+ return result;
+}
+
void tst_QGraphicsGridLayout::geometries_data()
{
@@ -2145,6 +2184,186 @@ void tst_QGraphicsGridLayout::geometries_data()
<< QRectF(0, 0, 60,10) << QRectF(0, 10, 60,10)
);
+ // change layout height and verify
+ QTest::newRow("hfw-h401") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(500, 500))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(100, 401)
+ << (RectList()
+ << QRectF(0, 0, 50, 1) << QRectF(50, 0, 50, 1)
+ << QRectF(0, 1, 50,100) << QRectF(50, 1, 50,400)
+ );
+
+
+ QTest::newRow("hfw-h408") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(500, 500))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(100, 408)
+ << (RectList()
+ << QRectF(0, 0, 50, 8) << QRectF(50, 0, 50, 8)
+ << QRectF(0, 8, 50,100) << QRectF(50, 8, 50,400)
+ );
+
+ QTest::newRow("hfw-h410") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(500, 500))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(100, 410)
+ << (RectList()
+ << QRectF(0, 0, 50,10) << QRectF(50, 0, 50,10)
+ << QRectF(0, 10, 50,100) << QRectF(50, 10, 50,400)
+ );
+
+ QTest::newRow("hfw-h470") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(500, 500))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(100, 470)
+ << (RectList()
+ << QRectF(0, 0, 50,70) << QRectF(50, 0, 50,70)
+ << QRectF(0, 70, 50,100) << QRectF(50, 70, 50,400)
+ );
+
+
+ // change layout width and verify
+ QTest::newRow("hfw-w100") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(5000, 5000))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(100, 401)
+ << (RectList()
+ << QRectF( 0, 0, 50, 1) << QRectF( 50, 0, 50, 1)
+ << QRectF( 0, 1, 50, 100) << QRectF( 50, 1, 50, 400)
+ );
+
+ QTest::newRow("hfw-w160") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(5000, 5000))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(160, 401)
+ << (RectList()
+ << QRectF( 0, 0, 80, 100) << QRectF( 80, 0, 80, 100)
+ << QRectF( 0, 100, 80, 100) << QRectF( 80, 100, 80, 250)
+ );
+
+
+ QTest::newRow("hfw-w500") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(40,40))
+ .preferredSize(QSizeF(50,400))
+ .maxSize(QSizeF(5000, 5000))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(500, 401)
+ << (RectList()
+ << QRectF( 0, 0, 100, 100) << QRectF(100, 0, 100, 100)
+ << QRectF( 0, 100, 100, 100) << QRectF(100, 100, 400, 50)
+ );
+
}
void tst_QGraphicsGridLayout::geometries()
@@ -2215,6 +2434,143 @@ void tst_QGraphicsGridLayout::task236367_maxSizeHint()
QCOMPARE(widget->size(), QSizeF(w, h));
}
+/*
+static qreal hfw(qreal w)
+{
+ if (w == 0)
+ return 20000;
+ return 20000/w;
+}
+*/
+static QSizeF hfw(Qt::SizeHint /*which*/, const QSizeF &constraint)
+{
+ QSizeF result(constraint);
+ const qreal cw = constraint.width();
+ const qreal ch = constraint.height();
+ if (cw < 0 && ch < 0) {
+ return QSizeF(200, 100);
+ } else if (cw >= 0) {
+ result.setHeight(20000./cw);
+ } else if (cw == 0) {
+ result.setHeight(20000);
+ } else if (ch >= 0) {
+ result.setWidth(20000./ch);
+ } else if (ch == 0) {
+ result.setWidth(20000);
+ }
+
+ return result;
+}
+
+static qreal growthFactorBelowPreferredSize(qreal desired, qreal sumAvailable, qreal sumDesired)
+{
+ Q_ASSERT(sumDesired != 0.0);
+ return desired * qPow(sumAvailable / sumDesired, desired / sumDesired);
+}
+
+static void expectedWidth(qreal minSize1, qreal prefSize1,
+ qreal minSize2, qreal prefSize2,
+ qreal targetSize, qreal *width1, qreal *width2)
+{
+ qreal sumAvail,factor1,factor2;
+ // stretch behaviour is different below and above preferred size...
+ if (targetSize < prefSize1 + prefSize2) {
+ sumAvail = targetSize - minSize1 - minSize2;
+ const qreal desired1 = prefSize1 - minSize1;
+ const qreal desired2 = prefSize2 - minSize2;
+ const qreal sumDesired = desired1 + desired2;
+ factor1 = growthFactorBelowPreferredSize(desired1, sumAvail, sumDesired);
+ factor2 = growthFactorBelowPreferredSize(desired2, sumAvail, sumDesired);
+ const qreal sumFactors = factor1 + factor2;
+ *width1 = sumAvail*factor1/sumFactors + minSize1;
+ *width2 = sumAvail*factor2/sumFactors + minSize2;
+ } else {
+ sumAvail = targetSize - prefSize1 - prefSize2;
+ factor1 = prefSize1;
+ factor2 = prefSize2;
+ const qreal sumFactors = factor1 + factor2;
+ *width1 = sumAvail*factor1/sumFactors + prefSize1;
+ *width2 = sumAvail*factor2/sumFactors + prefSize2;
+ }
+}
+
+
+bool qFuzzyCompare(const QSizeF &a, const QSizeF &b)
+{
+ return qFuzzyCompare(a.width(), b.width()) && qFuzzyCompare(a.height(), b.height());
+}
+
+void tst_QGraphicsGridLayout::heightForWidth()
+{
+ QGraphicsWidget *widget = new QGraphicsWidget;
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout;
+ widget->setLayout(layout);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
+ RectWidget *w00 = new RectWidget;
+ w00->setSizeHint(Qt::MinimumSize, QSizeF(1,1));
+ w00->setSizeHint(Qt::PreferredSize, QSizeF(10,10));
+ w00->setSizeHint(Qt::MaximumSize, QSizeF(100,100));
+ layout->addItem(w00, 0, 0);
+
+ RectWidget *w01 = new RectWidget;
+ w01->setSizeHint(Qt::MinimumSize, QSizeF(1,1));
+ w01->setSizeHint(Qt::PreferredSize, QSizeF(10,10));
+ w01->setSizeHint(Qt::MaximumSize, QSizeF(100,100));
+ layout->addItem(w01, 0, 1);
+
+ RectWidget *w10 = new RectWidget;
+ w10->setSizeHint(Qt::MinimumSize, QSizeF(1,1));
+ w10->setSizeHint(Qt::PreferredSize, QSizeF(10,10));
+ w10->setSizeHint(Qt::MaximumSize, QSizeF(100,100));
+ layout->addItem(w10, 1, 0);
+
+ RectWidget *w11 = new RectWidget;
+ w11->setSizeHint(Qt::MinimumSize, QSizeF(1,1));
+ w11->setSizeHint(Qt::MaximumSize, QSizeF(30000,30000));
+ w11->setConstraintFunction(hfw);
+ QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ sp.setHeightForWidth(true);
+ w11->setSizePolicy(sp);
+ layout->addItem(w11, 1, 1);
+
+ QSizeF prefSize = layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1));
+ QCOMPARE(prefSize, QSizeF(10+200, 10+100));
+
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(2, -1)), QSizeF(2, 20001));
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(2, -1)), QSizeF(2, 20010));
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(2, -1)), QSizeF(2, 20100));
+ qreal width1;
+ qreal width2;
+ expectedWidth(1, 10, 1, 200, 20, &width1, &width2);
+ QSizeF expectedSize = hfw(Qt::MinimumSize, QSizeF(width2, -1)) + QSizeF(width1, 1);
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(20, -1)), expectedSize);
+ expectedSize.rheight()+=9;
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(20, -1)), expectedSize);
+ expectedSize.rheight()+=90;
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(20, -1)), expectedSize);
+
+ expectedWidth(1, 10, 1, 200, 300, &width1, &width2);
+ expectedSize = hfw(Qt::MinimumSize, QSizeF(width2, -1)) + QSizeF(width1, 1);
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(300, -1)), expectedSize);
+ expectedSize.rheight()+=9;
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(300, -1)), expectedSize);
+ // the height of the hfw widget is shorter than the one to the left, which is 100, so
+ // the total height of the last row is 100 (which leaves the layout height to be 200)
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(300, -1)), QSizeF(300, 200));
+
+ // the hfw item is shorter than the item to the left
+ expectedWidth(1, 10, 1, 200, 500, &width1, &width2);
+ expectedSize = hfw(Qt::MinimumSize, QSizeF(width2, -1)) + QSizeF(width1, 1);
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(500, -1)), expectedSize);
+ expectedSize.rheight()+=9;
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(500, -1)), expectedSize);
+ // the height of the hfw widget is shorter than the one to the left, which is 100, so
+ // the total height of the last row is 100 (which leaves the layout height to be 200)
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(500, -1)), QSizeF(500, 200));
+
+}
+
QTEST_MAIN(tst_QGraphicsGridLayout)
#include "tst_qgraphicsgridlayout.moc"
diff --git a/tests/auto/qlocale/test/test.pro b/tests/auto/qlocale/test/test.pro
index e33d0fe..6512e19 100644
--- a/tests/auto/qlocale/test/test.pro
+++ b/tests/auto/qlocale/test/test.pro
@@ -37,3 +37,5 @@ symbian:contains(S60_VERSION,3.2) {
"$${LITERAL_HASH}endif"
MMP_RULES += custom_paged_rule
}
+
+symbian: INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE # Needed for e32svr.h in S^3 envs
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp
index 62416b1..bb96da1 100644
--- a/tests/auto/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp
@@ -714,6 +714,8 @@ void tst_QMetaObject::normalizedSignature_data()
QTest::newRow("const12") << "void foo(Foo<Bar>const*const *const)" << "void foo(Foo<Bar>*const*const)";
QTest::newRow("const13") << "void foo(const Foo<Bar>&)" << "void foo(Foo<Bar>)";
QTest::newRow("const14") << "void foo(Foo<Bar>const&)" << "void foo(Foo<Bar>)";
+
+ QTest::newRow("invalid1") << "a( b" << "a(b";
}
void tst_QMetaObject::normalizedSignature()
@@ -721,7 +723,7 @@ void tst_QMetaObject::normalizedSignature()
QFETCH(QString, signature);
QFETCH(QString, result);
- QCOMPARE(QString::fromLatin1(QMetaObject::normalizedSignature(signature.toLatin1())), result);
+ QCOMPARE(QMetaObject::normalizedSignature(signature.toLatin1()), result.toLatin1());
}
void tst_QMetaObject::normalizedType_data()
@@ -759,7 +761,7 @@ void tst_QMetaObject::normalizedType()
QFETCH(QString, type);
QFETCH(QString, result);
- QCOMPARE(QString::fromLatin1(QMetaObject::normalizedType(type.toLatin1())), result);
+ QCOMPARE(QMetaObject::normalizedType(type.toLatin1()), result.toLatin1());
}
void tst_QMetaObject::customPropertyType()
diff --git a/tests/auto/qpluginloader/lib/lib.pro b/tests/auto/qpluginloader/lib/lib.pro
index 96a9732..ce9bf13 100644
--- a/tests/auto/qpluginloader/lib/lib.pro
+++ b/tests/auto/qpluginloader/lib/lib.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += dll
CONFIG -= staticlib
SOURCES = mylib.c
-TARGET = mylib
+TARGET = tst_qpluginloaderlib
DESTDIR = ../bin
QT = core
diff --git a/tests/auto/qpluginloader/tst/tst.pro b/tests/auto/qpluginloader/tst/tst.pro
index 2de0912..2d757e7 100644
--- a/tests/auto/qpluginloader/tst/tst.pro
+++ b/tests/auto/qpluginloader/tst/tst.pro
@@ -20,7 +20,7 @@ wince*: {
}
symbian: {
- libDep.sources = mylib.dll
+ libDep.sources = tst_qpluginloaderlib.dll
libDep.path = /sys/bin
pluginDep.sources = theplugin.dll
pluginDep.path = bin
diff --git a/tests/auto/qpluginloader/tst_qpluginloader.cpp b/tests/auto/qpluginloader/tst_qpluginloader.cpp
index 705e600..e913cb5 100644
--- a/tests/auto/qpluginloader/tst_qpluginloader.cpp
+++ b/tests/auto/qpluginloader/tst_qpluginloader.cpp
@@ -169,7 +169,7 @@ void tst_QPluginLoader::errorString()
QCOMPARE(loader.errorString(), unknown);
}
{
- QPluginLoader loader( sys_qualifiedLibraryName("mylib")); //not a plugin
+ QPluginLoader loader( sys_qualifiedLibraryName("tst_qpluginloaderlib")); //not a plugin
bool loaded = loader.load();
#ifdef SHOW_ERRORS
qDebug() << loader.errorString();
diff --git a/tests/auto/qregexp/tst_qregexp.cpp b/tests/auto/qregexp/tst_qregexp.cpp
index ea07323..d0d26ee 100644
--- a/tests/auto/qregexp/tst_qregexp.cpp
+++ b/tests/auto/qregexp/tst_qregexp.cpp
@@ -105,6 +105,7 @@ private slots:
void QTBUG_7049_data();
void QTBUG_7049();
+ void interval();
};
// Testing get/set functions
@@ -1426,5 +1427,22 @@ void tst_QRegExp::QTBUG_7049()
QCOMPARE( re.cap(2), cap2 );
}
+void tst_QRegExp::interval()
+{
+ {
+ QRegExp exp("a{0,1}");
+ QVERIFY(exp.isValid());
+ }
+ {
+ QRegExp exp("a{1,1}");
+ QVERIFY(exp.isValid());
+ }
+ {
+ QRegExp exp("a{1,0}");
+ QVERIFY(!exp.isValid());
+ }
+}
+
+
QTEST_APPLESS_MAIN(tst_QRegExp)
#include "tst_qregexp.moc"
diff --git a/tests/auto/qsslsocket/qsslsocket.pro b/tests/auto/qsslsocket/qsslsocket.pro
index 3557fc8..accfa89 100644
--- a/tests/auto/qsslsocket/qsslsocket.pro
+++ b/tests/auto/qsslsocket/qsslsocket.pro
@@ -29,6 +29,7 @@ wince* {
certFiles.sources = certs ssl.tar.gz
certFiles.path = .
DEPLOYMENT += certFiles
+ INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE # Needed for e32svr.h in S^3 envs
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 0c12974..6c1dd8f 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -1072,6 +1072,7 @@ void tst_QSslSocket::wildcardCertificateNames()
QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example.com"), QString("www.example.com")), true );
QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("xxx*.example.com"), QString("xxxwww.example.com")), true );
QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("f*.example.com"), QString("foo.example.com")), true );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("192.168.0.0"), QString("192.168.0.0")), true );
// Failing CN matches
QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("xxx.example.com"), QString("www.example.com")), false );
@@ -1085,6 +1086,7 @@ void tst_QSslSocket::wildcardCertificateNames()
QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example."), QString("www.example")), false );
QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString(""), QString("www")), false );
QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*"), QString("www")), false );
+ QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.168.0.0"), QString("192.168.0.0")), false );
}
void tst_QSslSocket::wildcard()
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp
index 1d166f4..0ae5320 100644
--- a/tests/auto/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/qstatictext/tst_qstatictext.cpp
@@ -85,6 +85,10 @@ private slots:
void setPenPlainText();
void setPenRichText();
void richTextOverridesPen();
+
+ void drawStruckOutText();
+ void drawOverlinedText();
+ void drawUnderlinedText();
};
void tst_QStaticText::init()
@@ -620,5 +624,107 @@ void tst_QStaticText::richTextOverridesPen()
}
}
+void tst_QStaticText::drawStruckOutText()
+{
+ QPixmap imageDrawText(1000, 1000);
+ QPixmap imageDrawStaticText(1000, 1000);
+
+ imageDrawText.fill(Qt::white);
+ imageDrawStaticText.fill(Qt::white);
+
+ QString s = QString::fromLatin1("Foobar");
+
+ QFont font;
+ font.setStrikeOut(true);
+
+ {
+ QPainter p(&imageDrawText);
+ p.setFont(font);
+ p.drawText(QPointF(50, 50), s);
+ }
+
+ {
+ QPainter p(&imageDrawStaticText);
+ QStaticText text = QStaticText(s);
+ p.setFont(font);
+ p.drawStaticText(QPointF(50, 50 - QFontMetricsF(p.font()).ascent()), text);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ imageDrawText.save("drawStruckOutText_imageDrawText.png");
+ imageDrawStaticText.save("drawStruckOutText_imageDrawStaticText.png");
+#endif
+
+ QCOMPARE(imageDrawText, imageDrawStaticText);
+}
+
+void tst_QStaticText::drawOverlinedText()
+{
+ QPixmap imageDrawText(1000, 1000);
+ QPixmap imageDrawStaticText(1000, 1000);
+
+ imageDrawText.fill(Qt::white);
+ imageDrawStaticText.fill(Qt::white);
+
+ QString s = QString::fromLatin1("Foobar");
+
+ QFont font;
+ font.setOverline(true);
+
+ {
+ QPainter p(&imageDrawText);
+ p.setFont(font);
+ p.drawText(QPointF(50, 50), s);
+ }
+
+ {
+ QPainter p(&imageDrawStaticText);
+ QStaticText text = QStaticText(s);
+ p.setFont(font);
+ p.drawStaticText(QPointF(50, 50 - QFontMetricsF(p.font()).ascent()), text);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ imageDrawText.save("drawOverlinedText_imageDrawText.png");
+ imageDrawStaticText.save("drawOverlinedText_imageDrawStaticText.png");
+#endif
+
+ QCOMPARE(imageDrawText, imageDrawStaticText);
+}
+
+void tst_QStaticText::drawUnderlinedText()
+{
+ QPixmap imageDrawText(1000, 1000);
+ QPixmap imageDrawStaticText(1000, 1000);
+
+ imageDrawText.fill(Qt::white);
+ imageDrawStaticText.fill(Qt::white);
+
+ QString s = QString::fromLatin1("Foobar");
+
+ QFont font;
+ font.setUnderline(true);
+
+ {
+ QPainter p(&imageDrawText);
+ p.setFont(font);
+ p.drawText(QPointF(50, 50), s);
+ }
+
+ {
+ QPainter p(&imageDrawStaticText);
+ QStaticText text = QStaticText(s);
+ p.setFont(font);
+ p.drawStaticText(QPointF(50, 50 - QFontMetricsF(p.font()).ascent()), text);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ imageDrawText.save("drawUnderlinedText_imageDrawText.png");
+ imageDrawStaticText.save("drawUnderlinedText_imageDrawStaticText.png");
+#endif
+
+ QCOMPARE(imageDrawText, imageDrawStaticText);
+}
+
QTEST_MAIN(tst_QStaticText)
#include "tst_qstatictext.moc"
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp
index c887936..ef82769 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -208,6 +208,7 @@ private slots:
void repeated_data() const;
void task262677remove();
void QTBUG10404_compareRef();
+ void QTBUG9281_arg_locale();
};
typedef QList<int> IntList;
@@ -4860,6 +4861,17 @@ void tst_QString::QTBUG10404_compareRef()
QVERIFY(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 3), Qt::CaseInsensitive) < 0);
}
+void tst_QString::QTBUG9281_arg_locale()
+{
+ QLocale l(QLocale::English, QLocale::UnitedKingdom);
+ l.setNumberOptions(QLocale::OmitGroupSeparator);
+ QLocale::setDefault(l);
+ QString str("*%L1*%L2*");
+ str = str.arg(123456).arg(1234.56);
+ QCOMPARE(str, QString::fromLatin1("*123456*1234.56*"));
+ QLocale::setDefault(QLocale::C);
+}
+
QTEST_APPLESS_MAIN(tst_QString)
diff --git a/tests/auto/qsvgrenderer/qsvgrenderer.pro b/tests/auto/qsvgrenderer/qsvgrenderer.pro
index 8cfbcce..0b785e3 100644
--- a/tests/auto/qsvgrenderer/qsvgrenderer.pro
+++ b/tests/auto/qsvgrenderer/qsvgrenderer.pro
@@ -13,6 +13,8 @@ wince*|symbian {
addFiles.path = .
DEPLOYMENT += addFiles
- DEPLOYMENT_PLUGIN += qsvg
+ wince*|qt_not_deployed {
+ DEPLOYMENT_PLUGIN += qsvg
+ }
}
diff --git a/tests/auto/qtextcodec/qtextcodec.pro b/tests/auto/qtextcodec/qtextcodec.pro
index 0bcf067..6cb13a9 100644
--- a/tests/auto/qtextcodec/qtextcodec.pro
+++ b/tests/auto/qtextcodec/qtextcodec.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
SUBDIRS = test
-!wince*:SUBDIRS += echo
+!wince*:!symbian:SUBDIRS += echo
diff --git a/tests/auto/qtextcodec/test/test.pro b/tests/auto/qtextcodec/test/test.pro
index efa2e85..b85032a 100644
--- a/tests/auto/qtextcodec/test/test.pro
+++ b/tests/auto/qtextcodec/test/test.pro
@@ -20,7 +20,9 @@ wince*|symbian {
addFiles.sources = ../*.txt
addFiles.path = .
DEPLOYMENT += addFiles
- DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
+ wince*|qt_not_deployed {
+ DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
+ }
}
wince*: {
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index 0946c93..cc41591 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -1946,6 +1946,8 @@ void tst_QTextCodec::toLocal8Bit()
{
#ifdef QT_NO_PROCESS
QSKIP("This test requires QProcess", SkipAll);
+#elif defined(Q_OS_SYMBIAN)
+ QSKIP("This test requires streams support in QProcess", SkipAll);
#else
QProcess process;
process.start("echo/echo");
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index f798faf..659ba1a 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -122,6 +122,7 @@ private slots:
void smallTextLengthWrapAtWordBoundaryOrAnywhere();
void testLineBreakingAllSpaces();
void lineWidthFromBOM();
+ void textWidthVsWIdth();
private:
@@ -1359,5 +1360,34 @@ void tst_QTextLayout::glyphLessItems()
}
}
+void tst_QTextLayout::textWidthVsWIdth()
+{
+ QTextLayout layout;
+ QTextOption opt;
+ opt.setWrapMode(QTextOption::WrapAnywhere);
+ layout.setTextOption(opt);
+ layout.setText(QString::fromLatin1(
+ "g++ -c -m64 -pipe -g -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DCORE_LIBRARY -DIDE_LIBRARY_BASENAME=\"lib\" -DWITH_TESTS "
+ "-DQT_NO_CAST_TO_ASCII -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_FAST_CONCATENATION -DQT_PLUGIN -DQT_TESTLIB_LIB -DQT_SCRIPT_LIB -DQT_SVG_LIB -DQT_SQL_LIB -DQT_XM"
+ "L_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../../qt-qml/mkspecs/linux-g++-64 -I. -I../../../../qt-qml/include/QtCore -I../../../."
+ "./qt-qml/include/QtNetwork -I../../../../qt-qml/include/QtGui -I../../../../qt-qml/include/QtXml -I../../../../qt-qml/include/QtSql -I../../../../qt-qml/inc"
+ "lude/QtSvg -I../../../../qt-qml/include/QtScript -I../../../../qt-qml/include/QtTest -I../../../../qt-qml/include -I../../../../qt-qml/include/QtHelp -I../."
+ "./libs -I/home/ettrich/dev/creator/tools -I../../plugins -I../../shared/scriptwrapper -I../../libs/3rdparty/botan/build -Idialogs -Iactionmanager -Ieditorma"
+ "nager -Iprogressmanager -Iscriptmanager -I.moc/debug-shared -I.uic -o .obj/debug-shared/sidebar.o sidebar.cpp"));
+
+ // textWidth includes right bearing, but it should never be LARGER than width if there is space for at least one character
+ for (int width = 100; width < 1000; ++width) {
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ line.setLineWidth(width);
+ layout.endLayout();
+
+ qreal textWidthIsLargerBy = qMax(qreal(0), line.naturalTextWidth() - line.width());
+ qreal thisMustBeZero = 0;
+ QCOMPARE(textWidthIsLargerBy, thisMustBeZero);
+ }
+}
+
+
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"
diff --git a/tests/auto/qtextstream/qtextstream.pro b/tests/auto/qtextstream/qtextstream.pro
index 8346d7f..a2dcc81 100644
--- a/tests/auto/qtextstream/qtextstream.pro
+++ b/tests/auto/qtextstream/qtextstream.pro
@@ -1,5 +1,6 @@
TEMPLATE = subdirs
-SUBDIRS = test stdinProcess readAllStdinProcess readLineStdinProcess
+SUBDIRS = test
+!symbian: SUBDIRS += stdinProcess readAllStdinProcess readLineStdinProcess
diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp
index a0408ef..8d213ed 100644
--- a/tests/auto/qtimer/tst_qtimer.cpp
+++ b/tests/auto/qtimer/tst_qtimer.cpp
@@ -86,6 +86,7 @@ private slots:
void timerIdPersistsAfterThreadExit();
void cancelLongTimer();
void singleShotStaticFunctionZeroTimeout();
+ void recurseOnTimeoutAndStopTimer();
};
class TimerHelper : public QObject
@@ -623,5 +624,48 @@ void tst_QTimer::singleShotStaticFunctionZeroTimeout()
QCOMPARE(helper.count, 1);
}
+class RecursOnTimeoutAndStopTimerTimer : public QObject
+{
+ Q_OBJECT
+
+public:
+ QTimer *one;
+ QTimer *two;
+
+public slots:
+ void onetrigger()
+ {
+ QCoreApplication::processEvents();
+ }
+
+ void twotrigger()
+ {
+ one->stop();
+ }
+};
+
+void tst_QTimer::recurseOnTimeoutAndStopTimer()
+{
+ QEventLoop eventLoop;
+ QTimer::singleShot(1000, &eventLoop, SLOT(quit()));
+
+ RecursOnTimeoutAndStopTimerTimer t;
+ t.one = new QTimer(&t);
+ t.two = new QTimer(&t);
+
+ QObject::connect(t.one, SIGNAL(timeout()), &t, SLOT(onetrigger()));
+ QObject::connect(t.two, SIGNAL(timeout()), &t, SLOT(twotrigger()));
+
+ t.two->setSingleShot(true);
+
+ t.one->start();
+ t.two->start();
+
+ (void) eventLoop.exec();
+
+ QVERIFY(!t.one->isActive());
+ QVERIFY(!t.two->isActive());
+}
+
QTEST_MAIN(tst_QTimer)
#include "tst_qtimer.moc"
diff --git a/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml
new file mode 100644
index 0000000..b17739a
--- /dev/null
+++ b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml
@@ -0,0 +1 @@
+<date>2009-12-16T23:14:10.823218Z</date>
diff --git a/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd
new file mode 100644
index 0000000..55557f1
--- /dev/null
+++ b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="date" type="xsd:dateTime"/>
+
+ <xsd:simpleType name="microsecondsType">
+ <xsd:restriction base="xsd:dateTime">
+ <xsd:pattern value="\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\d\d\d\dZ"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp
index 3517b5a..092e966 100644
--- a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp
+++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp
@@ -216,6 +216,12 @@ void tst_XmlPatternsValidator::xsdSupport_data() const
<< 0
<< (QStringList() << QLatin1String("files/complex-type-including-anonymous-type.xsd"))
<< QString();
+
+ QTest::newRow("QTBUG-11559 A schema and instance with a dateTime containing microseconds")
+ << 0
+ << (QStringList() << QLatin1String("files/dateTime-with-microseconds.xml")
+ << QLatin1String("files/dateTime-with-microseconds.xsd"))
+ << QString();
}
QTEST_MAIN(tst_XmlPatternsValidator)
diff --git a/tests/benchmarks/corelib/tools/qregexp/main.cpp b/tests/benchmarks/corelib/tools/qregexp/main.cpp
index ab9ed71..51cde95 100644
--- a/tests/benchmarks/corelib/tools/qregexp/main.cpp
+++ b/tests/benchmarks/corelib/tools/qregexp/main.cpp
@@ -38,16 +38,27 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include <QDebug>
#include <QRegExp>
#include <QString>
+#include <QFile>
#include <qtest.h>
+#ifdef HAVE_BOOST
+#include <boost/regex.hpp>
+#endif
+
+#include <QtScript>
+#include "pcre/pcre.h"
+#define ZLIB_VERSION "1.2.3.4"
class tst_qregexp : public QObject
{
Q_OBJECT
+public:
+ tst_qregexp();
private slots:
void escape_old();
void escape_old_data() { escape_data(); }
@@ -59,10 +70,56 @@ private slots:
void escape_new3_data() { escape_data(); }
void escape_new4();
void escape_new4_data() { escape_data(); }
+/*
+ JSC outperforms everything.
+ Boost is less impressive then expected.
+ */
+ void simpleFind1();
+ void rangeReplace1();
+ void matchReplace1();
+
+ void simpleFind2();
+ void rangeReplace2();
+ void matchReplace2();
+
+ void simpleFindJSC();
+ void rangeReplaceJSC();
+ void matchReplaceJSC();
+
+#ifdef HAVE_BOOST
+ void simpleFindBoost();
+ void rangeReplaceBoost();
+ void matchReplaceBoost();
+#endif
+
+/* those apply an (incorrect) regexp on entire source
+ (this main.cpp). JSC appears to handle this
+ (ab)use case best. QRegExp performs extremly bad.
+ */
+ void horribleWrongReplace1();
+ void horribleReplace1();
+ void horribleReplace2();
+ void horribleWrongReplace2();
+ void horribleWrongReplaceJSC();
+ void horribleReplaceJSC();
+#ifdef HAVE_BOOST
+ void horribleWrongReplaceBoost();
+ void horribleReplaceBoost();
+#endif
private:
+ QString str1;
+ QString str2;
void escape_data();
};
+tst_qregexp::tst_qregexp()
+ :QObject()
+ ,str1("We are all happy monkeys")
+{
+ QFile f(":/main.cpp");
+ f.open(QFile::ReadOnly);
+ str2=f.readAll();
+}
static void verify(const QString &quoted, const QString &expected)
{
@@ -285,6 +342,253 @@ void tst_qregexp::escape_new4()
// "return quoted"
}
}
+
+
+void tst_qregexp::simpleFind1()
+{
+ int roff;
+ QRegExp rx("happy");
+ rx.setPatternSyntax(QRegExp::RegExp);
+ QBENCHMARK{
+ roff = rx.indexIn(str1);
+ }
+ QCOMPARE(roff, 11);
+}
+
+void tst_qregexp::rangeReplace1()
+{
+ QString r;
+ QRegExp rx("[a-f]");
+ rx.setPatternSyntax(QRegExp::RegExp);
+ QBENCHMARK{
+ r = QString(str1).replace(rx, "-");
+ }
+ QCOMPARE(r, QString("W- -r- -ll h-ppy monk-ys"));
+}
+
+void tst_qregexp::matchReplace1()
+{
+ QString r;
+ QRegExp rx("[^a-f]*([a-f]+)[^a-f]*");
+ rx.setPatternSyntax(QRegExp::RegExp);
+ QBENCHMARK{
+ r = QString(str1).replace(rx, "\\1");
+ }
+ QCOMPARE(r, QString("eaeaae"));
+}
+
+void tst_qregexp::horribleWrongReplace1()
+{
+ QString r;
+ QRegExp rx(".*#""define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*");
+ rx.setPatternSyntax(QRegExp::RegExp);
+ QBENCHMARK{
+ r = QString(str2).replace(rx, "\\1.\\2.\\3");
+ }
+ QCOMPARE(r, str2);
+}
+
+void tst_qregexp::horribleReplace1()
+{
+ QString r;
+ QRegExp rx(".*#""define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+).*");
+ rx.setPatternSyntax(QRegExp::RegExp);
+ QBENCHMARK{
+ r = QString(str2).replace(rx, "\\1.\\2.\\3");
+ }
+ QCOMPARE(r, QString("1.2.3"));
+}
+
+
+void tst_qregexp::simpleFind2()
+{
+ int roff;
+ QRegExp rx("happy");
+ rx.setPatternSyntax(QRegExp::RegExp2);
+ QBENCHMARK{
+ roff = rx.indexIn(str1);
+ }
+ QCOMPARE(roff, 11);
+}
+
+void tst_qregexp::rangeReplace2()
+{
+ QString r;
+ QRegExp rx("[a-f]");
+ rx.setPatternSyntax(QRegExp::RegExp2);
+ QBENCHMARK{
+ r = QString(str1).replace(rx, "-");
+ }
+ QCOMPARE(r, QString("W- -r- -ll h-ppy monk-ys"));
+}
+
+void tst_qregexp::matchReplace2()
+{
+ QString r;
+ QRegExp rx("[^a-f]*([a-f]+)[^a-f]*");
+ rx.setPatternSyntax(QRegExp::RegExp2);
+ QBENCHMARK{
+ r = QString(str1).replace(rx, "\\1");
+ }
+ QCOMPARE(r, QString("eaeaae"));
+}
+
+void tst_qregexp::horribleWrongReplace2()
+{
+ QString r;
+ QRegExp rx(".*#""define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*");
+ rx.setPatternSyntax(QRegExp::RegExp2);
+ QBENCHMARK{
+ r = QString(str2).replace(rx, "\\1.\\2.\\3");
+ }
+ QCOMPARE(r, str2);
+}
+
+void tst_qregexp::horribleReplace2()
+{
+ QString r;
+ QRegExp rx(".*#""define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+).*");
+ rx.setPatternSyntax(QRegExp::RegExp2);
+ QBENCHMARK{
+ r = QString(str2).replace(rx, "\\1.\\2.\\3");
+ }
+ QCOMPARE(r, QString("1.2.3"));
+}
+
+
+void tst_qregexp::simpleFindJSC()
+{
+ int numr;
+ const char * errmsg=" ";
+ QString rxs("happy");
+ JSRegExp *rx = jsRegExpCompile(rxs.utf16(), rxs.length(), JSRegExpDoNotIgnoreCase, JSRegExpSingleLine, 0, &errmsg);
+ QVERIFY(rx != 0);
+ QString s(str1);
+ int offsetVector[3];
+ QBENCHMARK{
+ numr = jsRegExpExecute(rx, s.utf16(), s.length(), 0, offsetVector, 3);
+ }
+ jsRegExpFree(rx);
+ QCOMPARE(numr, 1);
+ QCOMPARE(offsetVector[0], 11);
+}
+
+void tst_qregexp::rangeReplaceJSC()
+{
+ QScriptValue r;
+ QScriptEngine engine;
+ engine.globalObject().setProperty("s", str1);
+ QScriptValue replaceFunc = engine.evaluate("(function() { return s.replace(/[a-f]/g, '-') } )");
+ QVERIFY(replaceFunc.isFunction());
+ QBENCHMARK{
+ r = replaceFunc.call(QScriptValue());
+ }
+ QCOMPARE(r.toString(), QString("W- -r- -ll h-ppy monk-ys"));
+}
+
+void tst_qregexp::matchReplaceJSC()
+{
+ QScriptValue r;
+ QScriptEngine engine;
+ engine.globalObject().setProperty("s", str1);
+ QScriptValue replaceFunc = engine.evaluate("(function() { return s.replace(/[^a-f]*([a-f]+)[^a-f]*/g, '$1') } )");
+ QVERIFY(replaceFunc.isFunction());
+ QBENCHMARK{
+ r = replaceFunc.call(QScriptValue());
+ }
+ QCOMPARE(r.toString(), QString("eaeaae"));
+}
+
+void tst_qregexp::horribleWrongReplaceJSC()
+{
+ QScriptValue r;
+ QScriptEngine engine;
+ engine.globalObject().setProperty("s", str2);
+ QScriptValue replaceFunc = engine.evaluate("(function() { return s.replace(/.*#""define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*/gm, '$1.$2.$3') } )");
+ QVERIFY(replaceFunc.isFunction());
+ QBENCHMARK{
+ r = replaceFunc.call(QScriptValue());
+ }
+ QCOMPARE(r.toString(), str2);
+}
+
+void tst_qregexp::horribleReplaceJSC()
+{
+ QScriptValue r;
+ QScriptEngine engine;
+ // the m flag doesnt actually work here; dunno
+ engine.globalObject().setProperty("s", str2.replace('\n', ' '));
+ QScriptValue replaceFunc = engine.evaluate("(function() { return s.replace(/.*#""define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+).*/gm, '$1.$2.$3') } )");
+ QVERIFY(replaceFunc.isFunction());
+ QBENCHMARK{
+ r = replaceFunc.call(QScriptValue());
+ }
+ QCOMPARE(r.toString(), QString("1.2.3"));
+}
+
+
+#ifdef HAVE_BOOST
+void tst_qregexp::simpleFindBoost(){
+ int roff;
+ boost::regex rx ("happy", boost::regex_constants::perl);
+ std::string s = str1.toStdString();
+ std::string::const_iterator start, end;
+ start = s.begin();
+ end = s.end();
+ boost::match_flag_type flags = boost::match_default;
+ QBENCHMARK{
+ boost::match_results<std::string::const_iterator> what;
+ regex_search(start, end, what, rx, flags);
+ roff = (what[0].first)-start;
+ }
+ QCOMPARE(roff, 11);
+}
+
+void tst_qregexp::rangeReplaceBoost()
+{
+ boost::regex pattern ("[a-f]", boost::regex_constants::perl);
+ std::string s = str1.toStdString();
+ std::string r;
+ QBENCHMARK{
+ r = boost::regex_replace (s, pattern, "-");
+ }
+ QCOMPARE(r, std::string("W- -r- -ll h-ppy monk-ys"));
+}
+
+void tst_qregexp::matchReplaceBoost()
+{
+ boost::regex pattern ("[^a-f]*([a-f]+)[^a-f]*",boost::regex_constants::perl);
+ std::string s = str1.toStdString();
+ std::string r;
+ QBENCHMARK{
+ r = boost::regex_replace (s, pattern, "$1");
+ }
+ QCOMPARE(r, std::string("eaeaae"));
+}
+
+void tst_qregexp::horribleWrongReplaceBoost()
+{
+ boost::regex pattern (".*#""define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*", boost::regex_constants::perl);
+ std::string s = str2.toStdString();
+ std::string r;
+ QBENCHMARK{
+ r = boost::regex_replace (s, pattern, "$1.$2.$3");
+ }
+ QCOMPARE(r, s);
+}
+
+void tst_qregexp::horribleReplaceBoost()
+{
+ boost::regex pattern (".*#""define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+).*", boost::regex_constants::perl);
+ std::string s = str2.toStdString();
+ std::string r;
+ QBENCHMARK{
+ r = boost::regex_replace (s, pattern, "$1.$2.$3");
+ }
+ QCOMPARE(r, std::string("1.2.3"));
+}
+#endif //HAVE_BOOST
+
QTEST_MAIN(tst_qregexp)
#include "main.moc"
diff --git a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro
index e0f47c9..ffdad12 100644
--- a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro
+++ b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro
@@ -3,10 +3,19 @@ TEMPLATE = app
TARGET = tst_bench_qregexp
DEPENDPATH += .
INCLUDEPATH += .
-
+RESOURCES+=qregexp.qrc
QT -= gui
+QT += script
CONFIG += release
# Input
SOURCES += main.cpp
+
+include( $${QT_SOURCE_TREE}/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri )
+
+exists( /usr/include/boost/regex.hpp ){
+DEFINES+=HAVE_BOOST
+LIBS+=-lboost_regex
+}
+
diff --git a/tests/benchmarks/corelib/tools/qregexp/qregexp.qrc b/tests/benchmarks/corelib/tools/qregexp/qregexp.qrc
new file mode 100644
index 0000000..a7fe13c
--- /dev/null
+++ b/tests/benchmarks/corelib/tools/qregexp/qregexp.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>main.cpp</file>
+</qresource>
+</RCC>
+
diff --git a/tests/manual/inputmethodhints/inputmethodhints.cpp b/tests/manual/inputmethodhints/inputmethodhints.cpp
new file mode 100644
index 0000000..0c00b8d
--- /dev/null
+++ b/tests/manual/inputmethodhints/inputmethodhints.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "inputmethodhints.h"
+
+inputmethodhints::inputmethodhints(QWidget *parent)
+ : QMainWindow(parent)
+{
+ ui.setupUi(this);
+ connect(ui.cbDialableOnly, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbDigitsOnly, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbEmailOnly, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbFormattedNumbersOnly, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbHiddenText, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbLowercaseOnly, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbNoAutoUppercase, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbNoPredictiveText, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbPreferLowercase, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbPreferNumbers, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbPreferUpperCase, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbUppercaseOnly, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+ connect(ui.cbUrlOnly, SIGNAL(stateChanged(int)), this, SLOT(checkboxChanged(int)));
+}
+
+inputmethodhints::~inputmethodhints()
+{
+
+}
+
+void inputmethodhints::checkboxChanged(int)
+{
+ int flags = 0;
+ if (ui.cbDialableOnly->isChecked())
+ flags |= Qt::ImhDialableCharactersOnly;
+ if (ui.cbDigitsOnly->isChecked())
+ flags |= Qt::ImhDigitsOnly;
+ if (ui.cbEmailOnly->isChecked())
+ flags |= Qt::ImhEmailCharactersOnly;
+ if (ui.cbFormattedNumbersOnly->isChecked())
+ flags |= Qt::ImhFormattedNumbersOnly;
+ if (ui.cbHiddenText->isChecked())
+ flags |= Qt::ImhHiddenText;
+ if (ui.cbLowercaseOnly->isChecked())
+ flags |= Qt::ImhLowercaseOnly;
+ if (ui.cbNoAutoUppercase->isChecked())
+ flags |= Qt::ImhNoAutoUppercase;
+ if (ui.cbNoPredictiveText->isChecked())
+ flags |= Qt::ImhNoPredictiveText;
+ if (ui.cbPreferLowercase->isChecked())
+ flags |= Qt::ImhPreferLowercase;
+ if (ui.cbPreferNumbers->isChecked())
+ flags |= Qt::ImhPreferNumbers;
+ if (ui.cbPreferUpperCase->isChecked())
+ flags |= Qt::ImhPreferUppercase;
+ if (ui.cbUppercaseOnly->isChecked())
+ flags |= Qt::ImhUppercaseOnly;
+ if (ui.cbUrlOnly->isChecked())
+ flags |= Qt::ImhUrlCharactersOnly;
+ ui.lineEdit->clear();
+ ui.lineEdit->setInputMethodHints(Qt::InputMethodHints(flags));
+}
diff --git a/tests/manual/inputmethodhints/inputmethodhints.h b/tests/manual/inputmethodhints/inputmethodhints.h
new file mode 100644
index 0000000..988a4be
--- /dev/null
+++ b/tests/manual/inputmethodhints/inputmethodhints.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INPUTMETHODHINTS_H
+#define INPUTMETHODHINTS_H
+
+#include <QtGui/QMainWindow>
+#include "ui_tst_inputmethodhints.h"
+
+class inputmethodhints : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ inputmethodhints(QWidget *parent = 0);
+ ~inputmethodhints();
+
+public slots:
+ void checkboxChanged(int);
+
+private:
+ Ui::MainWindow ui;
+};
+
+#endif // INPUTMETHODHINTS_H
diff --git a/tests/manual/inputmethodhints/inputmethodhints.pro b/tests/manual/inputmethodhints/inputmethodhints.pro
new file mode 100644
index 0000000..7298ec6
--- /dev/null
+++ b/tests/manual/inputmethodhints/inputmethodhints.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+TARGET = tst_inputmethodhints
+
+QT += core \
+ gui
+
+HEADERS += inputmethodhints.h
+SOURCES += main.cpp \
+ inputmethodhints.cpp
+FORMS += inputmethodhints.ui
+RESOURCES +=
+
+symbian:TARGET.UID3 = 0xE4938ABC
diff --git a/tests/manual/inputmethodhints/inputmethodhints.ui b/tests/manual/inputmethodhints/inputmethodhints.ui
new file mode 100644
index 0000000..d0dc01d
--- /dev/null
+++ b/tests/manual/inputmethodhints/inputmethodhints.ui
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>360</width>
+ <height>640</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>behaviour</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QCheckBox" name="cbHiddenText">
+ <property name="text">
+ <string>ImhHiddenText</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbNoAutoUppercase">
+ <property name="text">
+ <string>ImhNoAutoUppercase</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbPreferNumbers">
+ <property name="text">
+ <string>ImhPreferNumbers</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbPreferUpperCase">
+ <property name="text">
+ <string>ImhPreferUppercase</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbPreferLowercase">
+ <property name="text">
+ <string>ImhPreferLowercase</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbNoPredictiveText">
+ <property name="text">
+ <string>ImhNoPredictiveText</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string>restrictions</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="cbDigitsOnly">
+ <property name="text">
+ <string>ImhDigitsOnly</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbFormattedNumbersOnly">
+ <property name="text">
+ <string>ImhFormattedNumbersOnly</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbUppercaseOnly">
+ <property name="text">
+ <string>ImhUppercaseOnly</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbLowercaseOnly">
+ <property name="text">
+ <string>ImhLowercaseOnly</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbDialableOnly">
+ <property name="text">
+ <string>ImhDialableCharactersOnly</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbEmailOnly">
+ <property name="text">
+ <string>ImhEmailCharactersOnly</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbUrlOnly">
+ <property name="text">
+ <string>ImhUrlCharactersOnly</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/manual/inputmethodhints/main.cpp b/tests/manual/inputmethodhints/main.cpp
new file mode 100644
index 0000000..022bf3f
--- /dev/null
+++ b/tests/manual/inputmethodhints/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "inputmethodhints.h"
+
+#include <QtGui>
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ inputmethodhints w;
+ w.showMaximized();
+ return a.exec();
+}