summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-17 06:18:30 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-17 06:18:30 (GMT)
commit85e625accb7f55b51e19016313bb204f6f0f835c (patch)
treeb60a7fd15f68d49c530bfa3ca326bdcfe070a9c3 /tests
parent53fd1e2fd9c75d7d55606d4ac5df75eda96b9cc9 (diff)
parent67d8b96d11b560367f068c2466664898a6fb5aed (diff)
downloadQt-85e625accb7f55b51e19016313bb204f6f0f835c.zip
Qt-85e625accb7f55b51e19016313bb204f6f0f835c.tar.gz
Qt-85e625accb7f55b51e19016313bb204f6f0f835c.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (83 commits) probably need to update user configurations once in a while too use dynamicstore instead Define JS_NO_EXPORT to avoid JSC C API functions being exported Don't use QScriptValueIterator to iterate over an array QtScript: Fix regression when calling newQObject() from native constructor Added note to OS X installation instructions. Keypress events ignored in listview on Cocoa (64 Bit) with Japanese IME Update only appropriate rectangles during update_sys(). Marked QTDS obsolete from Qt 4.7. QNetworkReply: Fix canReadLine() Abort waiting replies on session error. different approach to fixing "the other" aliasing issue fix aliasing issue in node_construct() detach in fewer cases, remove redundant calculation SSL: Fix memleak related to local certificate Improve keyboard layout detection on X11 Compile on ARM with -Werror -Wold-style-cast Use the vista-style native dialog for QFileDialog::getExistingDirectory Apply the stdset attribute for resource properties doc: Completed sentence about HideNameFilterDetails ...
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qabstractslider/tst_qabstractslider.cpp15
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp17
-rw-r--r--tests/auto/qscriptclass/tst_qscriptclass.cpp1
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp20
-rw-r--r--tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp24
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp8
-rw-r--r--tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp22
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp15
-rw-r--r--tests/auto/qzip/tst_qzip.cpp11
-rw-r--r--tests/benchmarks/script/qscriptvalueiterator/qscriptvalueiterator.pro7
-rw-r--r--tests/benchmarks/script/qscriptvalueiterator/tst_qscriptvalueiterator.cpp293
-rw-r--r--tests/manual/networkmanager/README2
-rw-r--r--tests/manual/networkmanager/dialog.ui213
-rw-r--r--tests/manual/networkmanager/networkmanager.pro9
-rw-r--r--tests/manual/networkmanager/networkmanagertest.cpp287
-rw-r--r--tests/manual/networkmanager/nmview.cpp1028
-rw-r--r--tests/manual/networkmanager/nmview.h109
-rw-r--r--tests/manual/networkmanager/startdlg.cpp96
-rw-r--r--tests/manual/repaint/mainwindow/main.cpp69
-rw-r--r--tests/manual/repaint/mainwindow/mainwindow.pro15
-rw-r--r--tests/manual/repaint/scrollarea/main.cpp65
-rw-r--r--tests/manual/repaint/scrollarea/scrollarea.pro15
-rw-r--r--tests/manual/repaint/shared/shared.h130
-rw-r--r--tests/manual/repaint/splitter/main.cpp58
-rw-r--r--tests/manual/repaint/splitter/splitter.pro15
-rw-r--r--tests/manual/repaint/tableview/main.cpp77
-rw-r--r--tests/manual/repaint/tableview/tableview.pro8
-rw-r--r--tests/manual/repaint/task141091/main.cpp63
-rw-r--r--tests/manual/repaint/task141091/task141091.pro12
-rw-r--r--tests/manual/repaint/toplevel/main.cpp (renamed from tests/manual/networkmanager/startdlg.h)23
-rw-r--r--tests/manual/repaint/toplevel/toplevel.pro16
-rw-r--r--tests/manual/repaint/widget/main.cpp135
-rw-r--r--tests/manual/repaint/widget/widget.pro15
33 files changed, 1127 insertions, 1766 deletions
diff --git a/tests/auto/qabstractslider/tst_qabstractslider.cpp b/tests/auto/qabstractslider/tst_qabstractslider.cpp
index 293af36..cf069db 100644
--- a/tests/auto/qabstractslider/tst_qabstractslider.cpp
+++ b/tests/auto/qabstractslider/tst_qabstractslider.cpp
@@ -728,7 +728,12 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 1 // delta
<< int(Qt::Vertical) // orientation of slider
<< int(Qt::Vertical) // orientation of wheel
+#ifndef Q_WS_MAC
<< 1 // expected position after
+#else
+ // We don't restrict scrolling to pageStep on Mac
+ << 100 // expected position after
+#endif
<< QPoint(1,1);
QTest::newRow("Different orientation") << 0 // initial position
@@ -742,7 +747,12 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 1 // delta
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Vertical) // orientation of wheel
+#ifndef Q_WS_MAC
<< 1 // expected position after
+#else
+ // We don't restrict scrolling to pageStep on Mac
+ << 100 // expected position after
+#endif
<< QPoint(1,1);
QTest::newRow("Different orientation2")<< 0 // initial position
@@ -756,7 +766,12 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 1 // delta
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Vertical) // orientation of wheel
+#ifndef Q_WS_MAC
<< 1 // expected position after
+#else
+ // We don't restrict scrolling to pageStep on Mac
+ << 100 // expected position after
+#endif
<< QPoint(0,0);
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index cafeef0..76e69c5 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -237,6 +237,8 @@ private Q_SLOTS:
void lastModifiedHeaderForFile();
void lastModifiedHeaderForHttp();
+ void httpCanReadLine();
+
void rateControl_data();
void rateControl();
@@ -3315,6 +3317,21 @@ void tst_QNetworkReply::lastModifiedHeaderForHttp()
QCOMPARE(header, realDate);
}
+void tst_QNetworkReply::httpCanReadLine()
+{
+ QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt"));
+ QNetworkReplyPtr reply = manager.get(request);
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+
+ QVERIFY(reply->canReadLine());
+ QVERIFY(!reply->readAll().isEmpty());
+ QVERIFY(!reply->canReadLine());
+}
+
void tst_QNetworkReply::rateControl_data()
{
QTest::addColumn<int>("rate");
diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp
index 41c674c..aca33ce 100644
--- a/tests/auto/qscriptclass/tst_qscriptclass.cpp
+++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp
@@ -688,6 +688,7 @@ void tst_QScriptClass::getAndSetProperty()
QCOMPARE(obj1.propertyFlags(foo2), foo2Pflags);
QVERIFY(cls.lastQueryPropertyObject().strictlyEquals(obj1));
QVERIFY(cls.lastQueryPropertyName() == foo2);
+ QEXPECT_FAIL("", "classObject.getOwnPropertyDescriptor() reads the property value", Continue);
QVERIFY(!cls.lastPropertyObject().isValid());
QVERIFY(cls.lastPropertyFlagsObject().strictlyEquals(obj1));
QVERIFY(cls.lastPropertyFlagsName() == foo2);
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 8658240..d9beb45 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -155,6 +155,7 @@ private slots:
void nativeFunctionScopes();
void evaluateProgram();
void collectGarbageAfterConnect();
+ void promoteThisObjectToQObjectInConstructor();
void qRegExpInport_data();
void qRegExpInport();
@@ -4461,6 +4462,25 @@ void tst_QScriptEngine::collectGarbageAfterConnect()
QVERIFY(widget == 0);
}
+static QScriptValue constructQObjectFromThisObject(QScriptContext *ctx, QScriptEngine *eng)
+{
+ Q_ASSERT(ctx->isCalledAsConstructor());
+ return eng->newQObject(ctx->thisObject(), new QObject, QScriptEngine::ScriptOwnership);
+}
+
+void tst_QScriptEngine::promoteThisObjectToQObjectInConstructor()
+{
+ QScriptEngine engine;
+ QScriptValue ctor = engine.newFunction(constructQObjectFromThisObject);
+ engine.globalObject().setProperty("Ctor", ctor);
+ QScriptValue object = engine.evaluate("new Ctor");
+ QVERIFY(!object.isError());
+ QVERIFY(object.isQObject());
+ QVERIFY(object.toQObject() != 0);
+ QVERIFY(object.property("objectName").isString());
+ QVERIFY(object.property("deleteLater").isFunction());
+}
+
static QRegExp minimal(QRegExp r) { r.setMinimal(true); return r; }
void tst_QScriptEngine::qRegExpInport_data()
diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
index ac9ca46..a0f10dd 100644
--- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
+++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
@@ -1245,6 +1245,7 @@ void tst_QScriptEngineAgent::positionChange_1()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, lineNumber);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 8);
// 5 + 6
@@ -1279,6 +1280,7 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QVERIFY(spy->at(1).scriptId != spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, lineNumber);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 18);
}
@@ -1297,6 +1299,7 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 11);
}
@@ -1327,12 +1330,14 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 31);
// void(i)
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 31);
}
@@ -1351,18 +1356,21 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 12);
// ++i
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 28);
// ++i
QCOMPARE(spy->at(3).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(3).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(3).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(3).columnNumber, 28);
}
@@ -1381,24 +1389,28 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 12);
// ++i
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 17);
// do
QCOMPARE(spy->at(3).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(3).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(3).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(3).columnNumber, 12);
// ++i
QCOMPARE(spy->at(4).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(4).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(4).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(4).columnNumber, 17);
}
@@ -1429,6 +1441,7 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 15);
}
@@ -1447,12 +1460,14 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 32);
// continue
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 32);
}
@@ -1495,6 +1510,7 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 31);
}
@@ -1513,12 +1529,14 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 38);
// break
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 45);
}
@@ -1543,18 +1561,21 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(0).type, ScriptEngineEvent::PositionChange);
QVERIFY(spy->at(0).scriptId != -1);
QCOMPARE(spy->at(0).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(0).columnNumber, 7);
// i = e
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 29);
// i = 2
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 48);
}
@@ -1567,12 +1588,14 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(0).type, ScriptEngineEvent::PositionChange);
QVERIFY(spy->at(0).scriptId != -1);
QCOMPARE(spy->at(0).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(0).columnNumber, 7);
// i = 3
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 46);
}
@@ -1594,6 +1617,7 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
+ QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 20);
}
delete spy;
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index f83cf58..5b79340 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2047,7 +2047,9 @@ void tst_QScriptValue::getSetProperty()
}
// should still be deletable from C++
object.setProperty("undeletableProperty", QScriptValue());
+ QEXPECT_FAIL("", "With JSC-based back-end, undeletable properties can't be deleted from C++", Continue);
QVERIFY(!object.property("undeletableProperty").isValid());
+ QEXPECT_FAIL("", "With JSC-based back-end, undeletable properties can't be deleted from C++", Continue);
QCOMPARE(object.propertyFlags("undeletableProperty"), 0);
// SkipInEnumeration
@@ -2082,11 +2084,11 @@ void tst_QScriptValue::getSetProperty()
object.setProperty("flagProperty", str, QScriptValue::ReadOnly);
QCOMPARE(object.propertyFlags("flagProperty"), QScriptValue::ReadOnly);
- object.setProperty("flagProperty", str, object.propertyFlags("flagProperty") | QScriptValue::Undeletable);
- QCOMPARE(object.propertyFlags("flagProperty"), QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ object.setProperty("flagProperty", str, object.propertyFlags("flagProperty") | QScriptValue::SkipInEnumeration);
+ QCOMPARE(object.propertyFlags("flagProperty"), QScriptValue::ReadOnly | QScriptValue::SkipInEnumeration);
object.setProperty("flagProperty", str, QScriptValue::KeepExistingFlags);
- QCOMPARE(object.propertyFlags("flagProperty"), QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ QCOMPARE(object.propertyFlags("flagProperty"), QScriptValue::ReadOnly | QScriptValue::SkipInEnumeration);
object.setProperty("flagProperty", str, QScriptValue::UserRange);
QCOMPARE(object.propertyFlags("flagProperty"), QScriptValue::UserRange);
diff --git a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
index 5ca7a3d..55773f0 100644
--- a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
+++ b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
@@ -255,8 +255,14 @@ void tst_QScriptValueIterator::iterateArray()
QVERIFY(it.value().strictlyEquals(array.property(propertyNames.at(i))));
QCOMPARE(it.value().toString(), propertyValues.at(i));
}
- QCOMPARE(it.hasNext(), false);
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("length"));
+ QVERIFY(it.value().isNumber());
+ QCOMPARE(it.value().toInt32(), length);
+ QCOMPARE(it.flags(), QScriptValue::SkipInEnumeration | QScriptValue::Undeletable);
+ it.previous();
QCOMPARE(it.hasPrevious(), length > 0);
for (int i = length - 1; i >= 0; --i) {
it.previous();
@@ -301,7 +307,9 @@ void tst_QScriptValueIterator::iterateArray()
QVERIFY(it.value().strictlyEquals(array.property(propertyNames.at(i))));
QCOMPARE(it.value().toString(), propertyValues.at(i));
}
- QCOMPARE(it.hasNext(), false);
+ QCOMPARE(it.hasNext(), true);
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("length"));
}
}
@@ -420,9 +428,15 @@ void tst_QScriptValueIterator::iterateString()
QCOMPARE(it.flags(), obj.propertyFlags(indexStr));
QCOMPARE(it.value().strictlyEquals(obj.property(indexStr)), true);
}
- QCOMPARE(it.hasNext(), false);
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("length"));
+ QVERIFY(it.value().isNumber());
+ QCOMPARE(it.value().toInt32(), length);
+ QCOMPARE(it.flags(), QScriptValue::ReadOnly | QScriptValue::SkipInEnumeration | QScriptValue::Undeletable);
- QVERIFY(it.hasPrevious());
+ it.previous();
+ QCOMPARE(it.hasPrevious(), length > 0);
for (int i = length - 1; i >= 0; --i) {
it.previous();
QString indexStr = QScriptValue(&engine, i).toString();
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index ad2b50d..4397ab1 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -666,6 +666,21 @@ void tst_QSslSocket::isEncrypted()
void tst_QSslSocket::localCertificate()
{
+ if (!QSslSocket::supportsSsl())
+ return;
+
+ // This test does not make 100% sense yet. We just set some local CA/cert/key and use it
+ // to authenticate ourselves against the server. The server does not actually check this
+ // values. This test should just run the codepath inside qsslsocket_openssl.cpp
+
+ QSslSocketPtr socket = newSocket();
+ QList<QSslCertificate> localCert = QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem");
+ socket->setCaCertificates(localCert);
+ socket->setLocalCertificate(QLatin1String(SRCDIR "certs/fluke.cert"));
+ socket->setPrivateKey(QLatin1String(SRCDIR "certs/fluke.key"));
+
+ socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
+ QVERIFY(socket->waitForEncrypted(5000));
}
void tst_QSslSocket::mode()
diff --git a/tests/auto/qzip/tst_qzip.cpp b/tests/auto/qzip/tst_qzip.cpp
index d7fc2f7..cb3acf5 100644
--- a/tests/auto/qzip/tst_qzip.cpp
+++ b/tests/auto/qzip/tst_qzip.cpp
@@ -77,6 +77,7 @@ void tst_QZip::basicUnpack()
QCOMPARE(files.count(), 2);
QZipReader::FileInfo fi = files.at(0);
+ QVERIFY(fi.isValid());
QCOMPARE(fi.filePath, QString("test/"));
QCOMPARE(uint(fi.isDir), (uint) 1);
QCOMPARE(uint(fi.isFile), (uint) 0);
@@ -85,7 +86,10 @@ void tst_QZip::basicUnpack()
QCOMPARE(fi.permissions,QFile::Permissions( QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner
| QFile::ReadUser | QFile::WriteUser | QFile::ExeUser ));
+ QCOMPARE(fi.lastModified, QDateTime::fromString("2005.11.11 13:08:02", "yyyy.MM.dd HH:mm:ss"));
+
fi = files.at(1);
+ QVERIFY(fi.isValid());
QCOMPARE(fi.filePath, QString("test/test.txt"));
QCOMPARE(uint(fi.isDir), (uint) 0);
QCOMPARE(uint(fi.isFile), (uint) 1);
@@ -94,7 +98,12 @@ void tst_QZip::basicUnpack()
QVERIFY(fi.permissions == QFile::Permissions( QFile::ReadOwner | QFile::WriteOwner
| QFile::ReadUser | QFile::WriteUser ));
+ QCOMPARE(fi.lastModified, QDateTime::fromString("2005.11.11 13:08:02", "yyyy.MM.dd HH:mm:ss"));
+
QCOMPARE(zip.fileData("test/test.txt"), QByteArray("content\n"));
+
+ fi = files.at(-1);
+ QVERIFY(!fi.isValid());
}
void tst_QZip::symlinks()
@@ -104,6 +113,7 @@ void tst_QZip::symlinks()
QCOMPARE(files.count(), 2);
QZipReader::FileInfo fi = files.at(0);
+ QVERIFY(fi.isValid());
QCOMPARE(fi.filePath, QString("symlink"));
QVERIFY(!fi.isDir);
QVERIFY(!fi.isFile);
@@ -112,6 +122,7 @@ void tst_QZip::symlinks()
QCOMPARE(zip.fileData("symlink"), QByteArray("destination"));
fi = files.at(1);
+ QVERIFY(fi.isValid());
QCOMPARE(fi.filePath, QString("destination"));
QVERIFY(!fi.isDir);
QVERIFY(fi.isFile);
diff --git a/tests/benchmarks/script/qscriptvalueiterator/qscriptvalueiterator.pro b/tests/benchmarks/script/qscriptvalueiterator/qscriptvalueiterator.pro
new file mode 100644
index 0000000..ecd48f0
--- /dev/null
+++ b/tests/benchmarks/script/qscriptvalueiterator/qscriptvalueiterator.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qscriptvalueiterator
+
+SOURCES += tst_qscriptvalueiterator.cpp
+
+QT = core script
diff --git a/tests/benchmarks/script/qscriptvalueiterator/tst_qscriptvalueiterator.cpp b/tests/benchmarks/script/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
new file mode 100644
index 0000000..7d06744
--- /dev/null
+++ b/tests/benchmarks/script/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
@@ -0,0 +1,293 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtScript>
+
+//TESTED_FILES=
+
+class tst_QScriptValueIterator : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QScriptValueIterator();
+ virtual ~tst_QScriptValueIterator();
+
+ void dataHelper();
+
+private slots:
+ void init();
+ void cleanup();
+
+ void hasNextAndNext();
+
+ void constructAndNext_data();
+ void constructAndNext();
+
+ void name_data();
+ void name();
+ void scriptName_data();
+ void scriptName();
+
+ void value_data();
+ void value();
+ void setValue_data();
+ void setValue();
+
+ void flags();
+
+ void iterateArrayAndConvertNameToIndex();
+ void iterateArrayAndDoubleElements();
+ void iterateArrayAndRemoveAllElements();
+};
+
+tst_QScriptValueIterator::tst_QScriptValueIterator()
+{
+}
+
+tst_QScriptValueIterator::~tst_QScriptValueIterator()
+{
+}
+
+void tst_QScriptValueIterator::init()
+{
+}
+
+void tst_QScriptValueIterator::cleanup()
+{
+}
+
+void tst_QScriptValueIterator::dataHelper()
+{
+ QTest::addColumn<QString>("code");
+ QTest::newRow("{ foo: 123 }") << QString::fromLatin1("({ foo: 123 })");
+ QTest::newRow("Math") << QString::fromLatin1("Math");
+ QTest::newRow("Array.prototype") << QString::fromLatin1("Array.prototype");
+ QTest::newRow("Global Object") << QString::fromLatin1("this");
+ QTest::newRow("['foo']") << QString::fromLatin1("['foo']");
+ QTest::newRow("array with 1000 elements")
+ << QString::fromLatin1("(function() {"
+ " var a = new Array;"
+ " for (i = 0; i < 1000; ++i)"
+ " a[i] = i;"
+ " return a;"
+ "})()");
+}
+
+void tst_QScriptValueIterator::hasNextAndNext()
+{
+ QScriptEngine engine;
+ QScriptValue object = engine.newObject();
+ for (int i = 0; i < 2000; ++i)
+ object.setProperty(i, i);
+ QScriptValueIterator it(object);
+ QBENCHMARK {
+ for (int i = 0; i < 1000; ++i) {
+ it.toFront();
+ while (it.hasNext())
+ it.next();
+ }
+ }
+}
+
+void tst_QScriptValueIterator::constructAndNext_data()
+{
+ dataHelper();
+}
+
+void tst_QScriptValueIterator::constructAndNext()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+ QScriptValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QBENCHMARK {
+ for (int i = 0; i < 100; ++i) {
+ QScriptValueIterator it(object);
+ it.next();
+ }
+ }
+}
+
+void tst_QScriptValueIterator::name_data()
+{
+ dataHelper();
+}
+
+void tst_QScriptValueIterator::name()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+ QScriptValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QScriptValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 200000; ++i)
+ it.name();
+ }
+}
+
+void tst_QScriptValueIterator::scriptName_data()
+{
+ dataHelper();
+}
+
+void tst_QScriptValueIterator::scriptName()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+ QScriptValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QScriptValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.scriptName();
+ }
+}
+
+void tst_QScriptValueIterator::value_data()
+{
+ dataHelper();
+}
+
+void tst_QScriptValueIterator::value()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+ QScriptValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QScriptValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.value();
+ }
+}
+
+void tst_QScriptValueIterator::setValue_data()
+{
+ dataHelper();
+}
+
+void tst_QScriptValueIterator::setValue()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+ QScriptValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QScriptValueIterator it(object);
+ it.next();
+ QScriptValue newValue(&engine, 456);
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.setValue(newValue);
+ }
+}
+
+void tst_QScriptValueIterator::flags()
+{
+ QScriptEngine engine;
+ QScriptValue object = engine.newObject();
+ QScriptValue::PropertyFlags flags = flags;
+ object.setProperty("foo", 123, QScriptValue::SkipInEnumeration | QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ QScriptValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.flags();
+ }
+}
+
+void tst_QScriptValueIterator::iterateArrayAndConvertNameToIndex()
+{
+ QScriptEngine engine;
+ QScriptValue array = engine.newArray();
+ for (int i = 0; i < 20000; ++i)
+ array.setProperty(i, i);
+ QBENCHMARK {
+ QScriptValueIterator it(array);
+ while (it.hasNext()) {
+ it.next();
+ it.scriptName().toArrayIndex();
+ }
+ }
+}
+
+void tst_QScriptValueIterator::iterateArrayAndDoubleElements()
+{
+ QScriptEngine engine;
+ QScriptValue array = engine.newArray();
+ for (int i = 0; i < 20000; ++i)
+ array.setProperty(i, i);
+ QBENCHMARK {
+ QScriptValueIterator it(array);
+ while (it.hasNext()) {
+ it.next();
+ it.setValue(QScriptValue(&engine, it.value().toNumber() * 2));
+ }
+ }
+}
+
+void tst_QScriptValueIterator::iterateArrayAndRemoveAllElements()
+{
+ QScriptEngine engine;
+ QScriptValue array = engine.newArray();
+ for (int i = 0; i < 20000; ++i)
+ array.setProperty(i, i);
+ QBENCHMARK {
+ QScriptValueIterator it(array);
+ while (it.hasNext()) {
+ it.next();
+ it.remove();
+ }
+ }
+}
+
+QTEST_MAIN(tst_QScriptValueIterator)
+#include "tst_qscriptvalueiterator.moc"
diff --git a/tests/manual/networkmanager/README b/tests/manual/networkmanager/README
deleted file mode 100644
index 4bc7171..0000000
--- a/tests/manual/networkmanager/README
+++ /dev/null
@@ -1,2 +0,0 @@
-This application serves as prototype/test-bed for NetworkManager development. The excellent (non-existing) documentation
-for the various NetworkManager interfaces makes this harder than it should be.
diff --git a/tests/manual/networkmanager/dialog.ui b/tests/manual/networkmanager/dialog.ui
deleted file mode 100644
index 1301908..0000000
--- a/tests/manual/networkmanager/dialog.ui
+++ /dev/null
@@ -1,213 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Dialog</class>
- <widget class="QDialog" name="Dialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>919</width>
- <height>657</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Dialog</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Connections</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTreeWidget" name="cons">
- <column>
- <property name="text">
- <string>Path</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>State</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Id</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Settings</string>
- </property>
- </column>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Devices:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTreeWidget" name="devicesTreeWidget">
- <column>
- <property name="text">
- <string>Path</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Managed</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Interface</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Driver</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Type</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>State</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>IP4 Address</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>IP4 Config</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Hostname</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Domains</string>
- </property>
- </column>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="0">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>908</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="3" column="0">
- <widget class="QTreeWidget" name="accessPointsTreeWidget">
- <property name="sortingEnabled">
- <bool>true</bool>
- </property>
- <column>
- <property name="text">
- <string>SSID</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Strength</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Wpa</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Rsn</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Freq</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Hardware Address</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Mode</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Max Bitrate</string>
- </property>
- </column>
- </widget>
- </item>
- <item row="4" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QPushButton" name="startButton">
- <property name="text">
- <string>Start</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="stopButton">
- <property name="text">
- <string>Stop</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="scanButton">
- <property name="text">
- <string>Scan</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="updateButton">
- <property name="text">
- <string>Update</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/tests/manual/networkmanager/networkmanager.pro b/tests/manual/networkmanager/networkmanager.pro
deleted file mode 100644
index 84289d3..0000000
--- a/tests/manual/networkmanager/networkmanager.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-SOURCES += networkmanagertest.cpp nmview.cpp
-HEADERS += nmview.h
-TARGET = tst_networkmanagertest
-
-QT = core network dbus gui
-
-requires(contains(QT_CONFIG,dbus))
-
-FORMS += dialog.ui
diff --git a/tests/manual/networkmanager/networkmanagertest.cpp b/tests/manual/networkmanager/networkmanagertest.cpp
deleted file mode 100644
index 8a6c5fa..0000000
--- a/tests/manual/networkmanager/networkmanagertest.cpp
+++ /dev/null
@@ -1,287 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDBusConnection>
-#include <QDBusError>
-#include <QDBusInterface>
-#include <QDBusMessage>
-#include <QDBusReply>
-#include <QtDBus>
-#include <QHostAddress>
-#include <QDebug>
-#include <NetworkManager/NetworkManager.h>
-#include <QApplication>
-#include <QMainWindow>
-#include "nmview.h"
-
-#include <arpa/inet.h>
-
-typedef QMap< QString, QMap<QString,QVariant> > SettingsMap;
-Q_DECLARE_METATYPE(SettingsMap)
-
-void printConnectionDetails(const QString& service)
-{
- QDBusConnection dbc = QDBusConnection::systemBus();
- if (!dbc.isConnected()) {
- qWarning() << "Unable to connect to D-Bus:" << dbc.lastError();
- return;
- }
- QDBusInterface allCons(service, NM_DBUS_PATH_SETTINGS, NM_DBUS_IFACE_SETTINGS, dbc);
- if (allCons.isValid()) {
- QDBusReply<QList<QDBusObjectPath> > reply = allCons.call("ListConnections");
- if ( reply.isValid() ) {
- qWarning() << "Known connections:";
- QList<QDBusObjectPath> list = reply.value();
- foreach(QDBusObjectPath path, list) {
- qWarning() << " " << path.path();
- QDBusInterface sysIface(NM_DBUS_SERVICE_SYSTEM_SETTINGS, path.path(), NM_DBUS_IFACE_SETTINGS_CONNECTION, dbc);
- if (sysIface.isValid()) {
- QDBusMessage r = sysIface.call("GetSettings");
- QDBusReply< SettingsMap > rep = sysIface.call("GetSettings");
- qWarning() << " GetSettings:" << r.arguments() << r.signature() << rep.isValid() << sysIface.lastError();
- QMap< QString, QMap<QString,QVariant> > map = rep.value();
- QList<QString> list = map.keys();
- foreach (QString key, list) {
- QMap<QString,QVariant> innerMap = map[key];
- qWarning() << " Key: " << key;
- QMap<QString,QVariant>::const_iterator i = innerMap.constBegin();
- while (i != innerMap.constEnd()) {
- QString k = i.key();
- qWarning() << " Key: " << k << " Entry: " << i.value();
- if (k == "addresses" && i.value().canConvert<QDBusArgument>()) {
- QDBusArgument arg = i.value().value<QDBusArgument>();
- arg.beginArray();
- while (!arg.atEnd()) {
- QDBusVariant addr;
- arg >> addr;
- uint ip = addr.variant().toUInt();
- qWarning() << ip;
- qWarning() << " " << QHostAddress(htonl(ip)).toString();
- }
-
- }
- i++;
- }
- }
- }
- }
- }
- }
-
-
-}
-
-void readConnectionManagerDetails()
-{
- qDBusRegisterMetaType<SettingsMap>();
- QDBusConnection dbc = QDBusConnection::systemBus();
- if (!dbc.isConnected()) {
- qWarning() << "Unable to connect to D-Bus:" << dbc.lastError();
- return;
- }
-
- QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc);
- if (!iface.isValid()) {
- qWarning() << "Could not find NetworkManager";
- return;
- }
-
- uint state = iface.property("State").toUInt();
- switch(state) {
- case NM_STATE_UNKNOWN:
- qWarning() << "State: Unknown"; break;
- case NM_STATE_ASLEEP:
- qWarning() << "State: Asleep"; break;
- case NM_STATE_CONNECTING:
- qWarning() << "State: Connecting"; break;
- case NM_STATE_CONNECTED:
- qWarning() << "State: Connected"; break;
- case NM_STATE_DISCONNECTED:
- qWarning() << "State: Disconnected"; break;
- }
- //get list of network devices
- QDBusReply<QList<QDBusObjectPath> > reply = iface.call("GetDevices");
- if ( reply.isValid() ) {
- qWarning() << "Current devices:";
- QList<QDBusObjectPath> list = reply.value();
- foreach(QDBusObjectPath path, list) {
- qWarning() << " " << path.path();
- QDBusInterface devIface(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_DEVICE, dbc);
- if (devIface.isValid()) {
- qWarning() << " Managed: " << devIface.property("Managed").toBool();
- qWarning() << " Interface: " << devIface.property("Interface").toString();
- qWarning() << " HAL UDI: " << devIface.property("Udi").toString();
- qWarning() << " Driver: " << devIface.property("Driver").toString();
- QVariant v = devIface.property("DeviceType");
- switch(v.toUInt()) {
- case DEVICE_TYPE_UNKNOWN:
- qWarning() << " DeviceType: Unknown" ;
- break;
- case DEVICE_TYPE_802_3_ETHERNET:
- qWarning() << " DeviceType: Ethernet" ;
- break;
- case DEVICE_TYPE_802_11_WIRELESS:
- qWarning() << " DeviceType: Wireless" ;
- break;
- case DEVICE_TYPE_GSM:
- qWarning() << " DeviceType: GSM" ;
- break;
- case DEVICE_TYPE_CDMA:
- qWarning() << " DeviceType: CDMA" ;
- break;
-
- }
- v = devIface.property("State");
- switch(v.toUInt()) {
- case NM_DEVICE_STATE_UNKNOWN:
- qWarning() << " State: Unknown" ; break;
- case NM_DEVICE_STATE_UNMANAGED:
- qWarning() << " State: Unmanaged" ; break;
- case NM_DEVICE_STATE_UNAVAILABLE:
- qWarning() << " State: Unavailable" ; break;
- case NM_DEVICE_STATE_DISCONNECTED:
- qWarning() << " State: Disconnected" ; break;
- case NM_DEVICE_STATE_PREPARE:
- qWarning() << " State: Preparing" ; break;
- case NM_DEVICE_STATE_CONFIG:
- qWarning() << " State: Being configured" ; break;
- case NM_DEVICE_STATE_NEED_AUTH:
- qWarning() << " State: Awaiting secrets" ; break;
- case NM_DEVICE_STATE_IP_CONFIG:
- qWarning() << " State: IP requested" ; break;
- case NM_DEVICE_STATE_ACTIVATED:
- qWarning() << " State: Activated" ; break;
- case NM_DEVICE_STATE_FAILED:
- qWarning() << " State: FAILED" ; break;
- }
- quint32 ip = devIface.property("Ip4Address").toUInt();
- qWarning() << " IP4Address: " << QHostAddress(htonl(ip)).toString();
- if (v.toUInt() == NM_DEVICE_STATE_ACTIVATED) {
- QString path = devIface.property("Ip4Config").value<QDBusObjectPath>().path();
- qWarning() << " IP4Config: " << path;
- QDBusInterface ipIface(NM_DBUS_SERVICE, path, NM_DBUS_INTERFACE_IP4_CONFIG, dbc);
- if (ipIface.isValid()) {
- qWarning() << " Hostname: " << ipIface.property("Hostname").toString();
- qWarning() << " Domains: " << ipIface.property("Domains").toStringList();
- qWarning() << " NisDomain: " << ipIface.property("NisDomain").toString();
- QDBusArgument arg= ipIface.property("Addresses").value<QDBusArgument>();
- //qWarning() << " " << arg.currentType();
- qWarning() << " Addresses: " << ipIface.property("Addresses");
- qWarning() << " Nameservers: " << ipIface.property("Nameservers");
- qWarning() << " NisServers: " << ipIface.property("NisServers");
- }
-
- }
-
- }
- }
- }
-
- //get list of active connections
- QVariant prop = iface.property("ActiveConnections");
- QList<QDBusObjectPath> connections = prop.value<QList<QDBusObjectPath> >();
- QString activePath;
- if ( connections.count() )
- qWarning() << "Active connections:";
- foreach(QDBusObjectPath path, connections) {
- qWarning() << " " << path.path();
- activePath = path.path();
- QString serviceName;
- QDBusInterface conIface(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_ACTIVE_CONNECTION, dbc);
- if (conIface.isValid()) {
- qWarning() << " default connection: " << conIface.property("Default").toBool();
- serviceName = conIface.property("ServiceName").toString();
- qWarning() << " service name: " << serviceName;
- qWarning() << " connection path: " << conIface.property("Connection").value<QDBusObjectPath>().path();
- qWarning() << " specific object:" << conIface.property("SpecificObject").value<QDBusObjectPath>().path();
- qWarning() << " sharedServiceName: " << conIface.property("SharedServiceName").toString();
- QList<QDBusObjectPath> devs = conIface.property("Devices").value<QList<QDBusObjectPath> >();
- qWarning() << " devices: ";
- foreach(QDBusObjectPath p, devs)
- qWarning() << " " << path.path();
- QVariant v = conIface.property("State");
- switch (v.toInt()) {
- case NM_ACTIVE_CONNECTION_STATE_UNKNOWN:
- qWarning()<< " State: unknown"; break;
- case NM_ACTIVE_CONNECTION_STATE_ACTIVATING:
- qWarning()<< " State: activating"; break;
- case NM_ACTIVE_CONNECTION_STATE_ACTIVATED:
- qWarning()<< " State: activated"; break;
- }
- } else {
- qWarning() << conIface.lastError();
- }
-
- }
-
- printConnectionDetails(NM_DBUS_SERVICE_SYSTEM_SETTINGS);
- printConnectionDetails(NM_DBUS_SERVICE_USER_SETTINGS);
-
-
- //turn active connection off
- /*QDBusObjectPath dbop("/org/freedesktop/NetworkManager/ActiveConnection/1");
- QVariant asd = QVariant::fromValue(dbop);
- iface.call(QLatin1String("DeactivateConnection"), asd);
- qWarning() << iface.lastError();*/
-
- /*QDBusObjectPath p1device("/org/freedesktop/Hal/devices/net_00_60_6e_82_02_65");
- QVariant p1v = QVariant::fromValue(p1device);
- QDBusObjectPath p1con("/org/freedesktop/NetworkManagerSettings/0");
- QVariant p1c = QVariant::fromValue(p1con);
- QDBusObjectPath p1sp("");
- QVariant p1sp1 = QVariant::fromValue(p1sp);
- iface.call(QLatin1String("ActivateConnection"),
- QString("/org/freedesktop/NetworkManagerSystemSettings"), p1c,p1v, p1v );
- qWarning() << iface.lastError();
- */
-}
-
-int main( int argc, char** argv)
-{
- QApplication app(argc, argv);
- //readConnectionManagerDetails();
- QMainWindow main;
- NMView view;
- main.setCentralWidget(&view);
- main.show();
- return app.exec();
-
-}
diff --git a/tests/manual/networkmanager/nmview.cpp b/tests/manual/networkmanager/nmview.cpp
deleted file mode 100644
index 9e28ff0..0000000
--- a/tests/manual/networkmanager/nmview.cpp
+++ /dev/null
@@ -1,1028 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "nmview.h"
-
-#include <QLabel>
-#include <QLayout>
-#include <QListWidget>
-#include <QDebug>
-#include <QPushButton>
-
-#include <QtDBus>
-#include <QtNetwork>
-#include <NetworkManager/NetworkManager.h>
-#include <arpa/inet.h>
-
-#include <QDBusConnection>
-#include <QDBusError>
-#include <QDBusInterface>
-#include <QDBusMessage>
-#include <QDBusReply>
-
-#include <QHostAddress>
-#include <QNetworkInterface>
-#include <QTreeWidgetItem>
-#include <QMessageBox>
-
-//#include "ui_dialog.h"
-
-#include <qnetworkconfiguration.h>
-#include <qnetworkconfigmanager.h>
-#include <qnetworksession.h>
-#include <QtNetwork/private/qnetworkmanagerservice_p.h>
-
-//static QDBusConnection dbc = QDBusConnection::systemBus();
-//typedef QMap< QString, QMap<QString,QVariant> > SettingsMap;
-//Q_DECLARE_METATYPE(SettingsMap)
-
-
-NMView::NMView(QDialog* parent)
- : QDialog(parent, 0), dbc(QDBusConnection::systemBus())
-{
- init();
-
- if (!dbc.isConnected()) {
- qWarning() << "Unable to connect to D-Bus:" << dbc.lastError();
- return;
- }
- updateConnections();
- getDevices();
-}
-
-NMView::~NMView()
-{
-}
-void NMView::init()
-{
- setupUi(this);
- sess = 0;
-// readSettings();
- connect(startButton, SIGNAL(clicked()), this, SLOT(activate()));
- connect(stopButton, SIGNAL(clicked()), this, SLOT(deactivate()));
- connect(scanButton, SIGNAL(clicked()), this, SLOT(findAccessPoints()));
- connect(updateButton, SIGNAL(clicked()), this, SLOT(update()));
-
- connect(cons, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
- this,SLOT(connectionItemActivated(QTreeWidgetItem*, int)));
-
-
- connect(devicesTreeWidget, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
- this, SLOT(deviceItemActivated(QTreeWidgetItem*, int)));
-
- cons->header()->setResizeMode(QHeaderView::ResizeToContents);
- devicesTreeWidget->header()->setResizeMode(QHeaderView::ResizeToContents);
- accessPointsTreeWidget->header()->setResizeMode(QHeaderView::ResizeToContents);
-// accessPointsTreeWidget->header()->setResizeMode(QHeaderView::ResizeToContents);
-
- manager = new QNetworkConfigurationManager(this);
-
- connect(manager, SIGNAL(updateCompleted()), this, SLOT(updateCompleted()));
-
- connect(manager, SIGNAL(configurationAdded(const QNetworkConfiguration &)),
- this, SLOT(configurationAdded(const QNetworkConfiguration&)));
-
- devicesTreeWidget->header()->hideSection(0);
- devicesTreeWidget->header()->hideSection(1);
- devicesTreeWidget->header()->hideSection(3);
- devicesTreeWidget->header()->hideSection(5);
- devicesTreeWidget->header()->hideSection(6);
- devicesTreeWidget->header()->hideSection(7);
- devicesTreeWidget->header()->hideSection(8);
- devicesTreeWidget->header()->hideSection(9);
-}
-
-void NMView::updateConnections()
-{
- cons->clear();
- manager->updateConfigurations();
- QList<QNetworkConfiguration> configs = manager->allConfigurations();
- foreach(QNetworkConfiguration p, configs) {
- QStringList strlist;
- strlist << p.name();
- strlist << stateToString(p.state());
- strlist << p.identifier();
- strlist << typeToString(p.type());
- QTreeWidgetItem *item;
- item = new QTreeWidgetItem(strlist);
- cons->insertTopLevelItem(0, item);
- }
- cons->sortItems ( 1, Qt::AscendingOrder);
-}
-
-void NMView::getActiveConnections()
-{
- QList<QNetworkConfiguration> configs = manager->allConfigurations(QNetworkConfiguration::Active);
- foreach(QNetworkConfiguration p, configs) {
- qWarning() << __FUNCTION__ << p.name() << p.identifier();
- }
-
-// QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc);
-// if (!iface.isValid()) {
-// qWarning() << "Could not find NetworkManager";
-// return;
-// }
-
-// QVariant prop = iface.property("ActiveConnections");
-// QList<QDBusObjectPath> connections = prop.value<QList<QDBusObjectPath> >();
-// foreach(QDBusObjectPath path, connections) {
-// QDBusInterface conDetails(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_ACTIVE_CONNECTION, dbc);
-// if (conDetails.isValid()) {
-// QString desc = path.path();
-// conDetails.property("Connection Path").value<QDBusObjectPath>().path();
-
-// QList<QDBusObjectPath> devices = conDetails.property("Devices").value<QList<QDBusObjectPath> >();
-//
-// foreach(QDBusObjectPath devpath, devices) {
-// QDBusInterface devIface(NM_DBUS_SERVICE, devpath.path(), NM_DBUS_INTERFACE_DEVICE, dbc);
-// desc += " "+devIface.property("Interface").toString();
-// desc += " "+QHostAddress(htonl(devIface.property("Ip4Address").toUInt())).toString();
-
-// }
-
-// qWarning() << conDetails.property("Connection").value<QDBusObjectPath>().path() << path.path();
-
-// QListWidgetItem* item = new QListWidgetItem(desc, activeCons);
-// item->setData(Qt::UserRole, path.path());
-// }
-// }
-}
-
-void NMView::update()
-{
-// QNetworkManagerInterface *dbIface;
-// dbIface = new QNetworkManagerInterface;
-// QList <QDBusObjectPath> connections = dbIface->activeConnections();
-//
-// foreach(QDBusObjectPath conpath, connections) {
-// QNetworkManagerConnectionActive *aConn;
-// aConn = new QNetworkManagerConnectionActive(conpath.path());
-// // in case of accesspoint, specificObject will hold the accessPOintObjectPath
-// qWarning() << aConn->connection().path() << aConn->specificObject().path() << aConn->devices().count();
-// QList <QDBusObjectPath> devs = aConn->devices();
-// foreach(QDBusObjectPath device, devs) {
-// qWarning() << " " << device.path();
-// }
-// }
-
- QStringList connectionServices;
- connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS;
- connectionServices << NM_DBUS_SERVICE_USER_SETTINGS;
- foreach (QString service, connectionServices) {
- QDBusInterface allCons(service,
- NM_DBUS_PATH_SETTINGS,
- NM_DBUS_IFACE_SETTINGS,
- dbc);
- if (allCons.isValid()) {
- QDBusReply<QList<QDBusObjectPath> > reply = allCons.call("ListConnections");
- if ( reply.isValid() ) {
- QList<QDBusObjectPath> list = reply.value();
- foreach(QDBusObjectPath path, list) {
- QDBusInterface sysIface(service,
- path.path(),
- NM_DBUS_IFACE_SETTINGS_CONNECTION,
- dbc);
- if (sysIface.isValid()) {
- qWarning() << "";
- qWarning() << path.path();
-
- // QDBusMessage r = sysIface.call("GetSettings");
- QDBusReply< QNmSettingsMap > rep = sysIface.call("GetSettings");
-
- QMap< QString, QMap<QString,QVariant> > map = rep.value();
- QList<QString> list = map.keys();
- foreach (QString key, list) {
- QMap<QString,QVariant> innerMap = map[key];
- qWarning() << " Key: " << key;
- QMap<QString,QVariant>::const_iterator i = innerMap.constBegin();
-
- while (i != innerMap.constEnd()) {
- QString k = i.key();
- qWarning() << " Key: " << k << " Entry: " << i.value();
- i++;
- }//end innerMap
- }//end foreach key
- }//end settings connection
- } // foreach path
- } //end ListConnections
- } //end settingsInterface
- }// end services
- QDBusInterface iface(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
- dbc);
- if (iface.isValid()) {
- QVariant prop = iface.property("ActiveConnections");
- QList<QDBusObjectPath> connections = prop.value<QList<QDBusObjectPath> >();
- foreach(QDBusObjectPath conpath, connections) {
- qWarning() << "Active connection" << conpath.path();
- QDBusInterface conDetails(NM_DBUS_SERVICE,
- conpath.path(),
- NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
- dbc);
- if (conDetails.isValid()) {
-
- QVariant prop = conDetails.property("Connection");
- QDBusObjectPath connection = prop.value<QDBusObjectPath>();
- qWarning() << conDetails.property("Default").toBool() << connection.path();
-
-// QVariant Sprop = conDetails.property("Devices");
-// QList<QDBusObjectPath> so = Sprop.value<QList<QDBusObjectPath> >();
-// foreach(QDBusObjectPath device, so) {
-// if(device.path() == devicePath) {
-// path = connection.path();
-// }
-// break;
-// }
- }
- }
- }
-qWarning() << "";
-}
-
-void NMView::deactivate()
-{
- QList<QNetworkConfiguration> configs = manager->allConfigurations(QNetworkConfiguration::Active);
- foreach(QNetworkConfiguration p, configs) {
- qWarning() << "Active cons" << p.name();
- if(p.name() == cons->currentItem()->text(0)
- && p.identifier() == cons->currentItem()->text(2)) {
- qWarning() <<__FUNCTION__<< p.name();
- if(!sess) {
- sess = new QNetworkSession(p);
-
- connect(sess, SIGNAL(stateChanged(QNetworkSession::State)),
- this, SLOT(stateChanged(QNetworkSession::State)));
-
- connect(sess, SIGNAL(error(QNetworkSession::SessionError)),
- this, SLOT(networkSessionError(QNetworkSession::SessionError)));
- }
- sess->close();
- delete sess;
- sess = 0;
- }
- }
-}
-
-void NMView::activate()
-{
- qWarning() << __FUNCTION__ << cons->currentItem()->text(0);
-
- QList<QNetworkConfiguration> configs = manager->allConfigurations();
- foreach(QNetworkConfiguration p, configs) {
- if(p.name() == cons->currentItem()->text(0)) {
-
- sess = new QNetworkSession(p);
-
- connect(sess, SIGNAL(newConfigurationActivated()),
- this, SLOT(getActiveConnections()));
-
- connect(sess, SIGNAL(stateChanged(QNetworkSession::State)),
- this, SLOT(stateChanged(QNetworkSession::State)));
-
- connect(sess, SIGNAL(error(QNetworkSession::SessionError)),
- this, SLOT(networkSessionError(QNetworkSession::SessionError)));
-
- sess->open();
- }
- }
-}
-
-void NMView::getDevices()
-{
- qWarning() << "";
- qWarning() << __FUNCTION__;
- devicesTreeWidget->clear();
- //qDBusRegisterMetaType<SettingsMap>();
-
- if (!dbc.isConnected()) {
- qWarning() << "Unable to connect to D-Bus:" << dbc.lastError();
- return;
- }
- QDBusInterface iface(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
- dbc);
-//NetworkManager interface
- if (!iface.isValid()) {
- qWarning() << "Could not find NetworkManager";
- return;
- }
-
-// uint state = iface.property("State").toUInt();
-// switch(state) {
-// case NM_STATE_UNKNOWN:
-// qWarning() << "State: Unknown"; break;
-// case NM_STATE_ASLEEP:
-// qWarning() << "State: Asleep"; break;
-// case NM_STATE_CONNECTING:
-// qWarning() << "State: Connecting"; break;
-// case NM_STATE_CONNECTED:
-// qWarning() << "State: Connected"; break;
-// case NM_STATE_DISCONNECTED:
-// qWarning() << "State: Disconnected"; break;
-// }
-
- //get list of network devices
- QTreeWidgetItem *item;
- QDBusReply<QList<QDBusObjectPath> > reply = iface.call("GetDevices");
- if ( reply.isValid() ) {
-// qWarning() << "Current devices:";
- QList<QDBusObjectPath> list = reply.value();
- foreach(QDBusObjectPath path, list) {
- QStringList devicesList;
- qWarning() << " " << path.path();
- devicesList << path.path();
-
- QDBusInterface devIface(NM_DBUS_SERVICE,
- path.path(),
- NM_DBUS_INTERFACE_DEVICE,
- dbc);
- if (devIface.isValid()) {
-
-
-
- ////// connect the dbus signal
-// /*if(*/dbc.connect(NM_DBUS_SERVICE,
-// path.path(),
-// NM_DBUS_INTERFACE_DEVICE,
-// "StateChanged",
-// this,SLOT(deviceStateChanged(quint32)));
-// {
-// qWarning() << "XXXXXXXXXX dbus connect successful" << path.path();
-// }
-
-
- // qWarning() << " Managed: " << devIface.property("Managed").toBool();
- devicesList << devIface.property("Managed").toString();
- // qWarning() << " Interface: " << devIface.property("Interface").toString();
- devicesList << devIface.property("Interface").toString();
- // qWarning() << " HAL UDI: " << devIface.property("Udi").toString();
- // qWarning() << " Driver: " << devIface.property("Driver").toString();
- devicesList << devIface.property("Driver").toString();
-
- QString x = deviceTypeToString(devIface.property("DeviceType").toUInt());
- // qWarning() << " Type:" << x;
- devicesList << x;
-
- if( devIface.property("DeviceType").toUInt() == DEVICE_TYPE_802_11_WIRELESS) {
- qWarning() << "Device is WIFI";
- // // findAccessPoints(path.path());
- }
-
- QVariant v = devIface.property("State");
- x = deviceStateToString(v.toUInt());
-// qWarning() << " State:" << x;
- devicesList << x;
-
- quint32 ip = devIface.property("Ip4Address").toUInt();
-// qWarning() << " IP4Address: " << QHostAddress(htonl(ip)).toString();
- devicesList << QHostAddress(htonl(ip)).toString();
-
-
- if (v.toUInt() == NM_DEVICE_STATE_ACTIVATED) {
- QString path = devIface.property("Ip4Config").value<QDBusObjectPath>().path();
-// qWarning() << " IP4Config: " << path;
- devicesList << path;
- QDBusInterface ipIface(NM_DBUS_SERVICE,
- path,
- NM_DBUS_INTERFACE_IP4_CONFIG,
- dbc);
- if (ipIface.isValid()) {
- // qWarning() << " Hostname: " << ipIface.property("Hostname").toString();
- devicesList << ipIface.property("Hostname").toString();
-// qWarning() << " Domains: " << ipIface.property("Domains").toStringList();
- devicesList << ipIface.property("Domains").toStringList().join(", ");
-// qWarning() << " NisDomain: " << ipIface.property("NisDomain").toString();
- QDBusArgument arg= ipIface.property("Addresses").value<QDBusArgument>();
-// qWarning() << " Addresses: " << ipIface.property("Addresses");
-// qWarning() << " Nameservers: " << ipIface.property("Nameservers");
-// qWarning() << " NisServers: " << ipIface.property("NisServers");
- }
-
- }
-
- }
- item = new QTreeWidgetItem(devicesList);
- devicesTreeWidget->insertTopLevelItem(0, item);
- }
- }
-
-
-// netconfig();
-
-}
-
-void NMView::readSettings()
-{
- QDBusInterface settingsiface(NM_DBUS_SERVICE_SYSTEM_SETTINGS,
- NM_DBUS_PATH_SETTINGS,
- NM_DBUS_IFACE_SETTINGS,
- dbc);
- //NetworkManagerSettings interface
- if (settingsiface.isValid()) {
- QDBusReply<QList<QDBusObjectPath> > reply = settingsiface.call("ListConnections");
- if ( reply.isValid() ) {
- QList<QDBusObjectPath> list = reply.value();
- foreach(QDBusObjectPath path, list) {
- qWarning() <<__FUNCTION__ << path.path();
-
- }
- }
- }
-
- QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc);
- if (!iface.isValid()) {
- qWarning() << "Could not find NetworkManager";
- return;
- }
-
- // QStringList list = item->text().split(" -> ");
-
- QVariant prop = iface.property("ActiveConnections");
- QList<QDBusObjectPath> connections = prop.value<QList<QDBusObjectPath> >();
- foreach(QDBusObjectPath path, connections) {
- QDBusInterface conDetails(NM_DBUS_SERVICE,
- path.path(),
- NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
- dbc);
-
- if (conDetails.isValid()) {
- QString desc = path.path();
- qWarning() << desc;
- //if ( item->text(0) == conDetails.property("Connection").value<QDBusObjectPath>().path() ) {
- // QListWidgetItem* item = new QTreeWidgetItem( desc,
- // cons);
- // item->setData(Qt::UserRole, desc);
- // activeItemActivated( item );
- //}
- }
- }
-}
-
-void NMView::printConnectionDetails(const QString& service)
-{
- Q_UNUSED(service);
-
-//
-// qWarning() << __FUNCTION__ << service;
-//
-// QDBusConnection dbc = QDBusConnection::systemBus();
-// if (!dbc.isConnected()) {
-// qWarning() << "Unable to connect to D-Bus:" << dbc.lastError();
-// return;
-// }
-// QDBusInterface allCons(service,
-// NM_DBUS_PATH_SETTINGS,
-// NM_DBUS_IFACE_SETTINGS,
-// dbc);
-//
-// if (allCons.isValid()) {
-// QDBusReply<QList<QDBusObjectPath> > reply = allCons.call("ListConnections");
-//
-// if ( reply.isValid() ) {
-// qWarning() << "Known connections:";
-// QList<QDBusObjectPath> list = reply.value();
-//
-// foreach(QDBusObjectPath path, list) {
-// qWarning() << " " << path.path();
-//
-// QDBusInterface sysIface(NM_DBUS_SERVICE_SYSTEM_SETTINGS,
-// path.path(),
-// NM_DBUS_IFACE_SETTINGS_CONNECTION,
-// dbc);
-//
-// if (sysIface.isValid()) {
-// QDBusMessage r = sysIface.call("GetSettings");
-// QDBusReply< QSettingsMap > rep = sysIface.call("GetSettings");
-//
-// qWarning() << " GetSettings:" << r.arguments() << r.signature() << rep.isValid() << sysIface.lastError();
-//
-// QMap< QString, QMap<QString,QVariant> > map = rep.value();
-// QList<QString> list = map.keys();
-//
-// foreach (QString key, list) {
-// QMap<QString,QVariant> innerMap = map[key];
-// qWarning() << " Key: " << key;
-// QMap<QString,QVariant>::const_iterator i = innerMap.constBegin();
-//
-// while (i != innerMap.constEnd()) {
-// QString k = i.key();
-// qWarning() << " Key: " << k << " Entry: " << i.value();
-//
-// if (k == "addresses" && i.value().canConvert<QDBusArgument>()) {
-// QDBusArgument arg = i.value().value<QDBusArgument>();
-// arg.beginArray();
-//
-// while (!arg.atEnd()) {
-// QDBusVariant addr;
-// arg >> addr;
-// uint ip = addr.variant().toUInt();
-// qWarning() << ip;
-// qWarning() << " " << QHostAddress(htonl(ip)).toString();
-// }
-//
-// }
-// i++;
-// }
-// }
-// }
-// }
-// }
-// }
- qWarning() << "";
-}
-
-void NMView::getNetworkDevices()
-{
-
-}
-
-void NMView::connectionItemActivated( QTreeWidgetItem * item, int col )
-{
- Q_UNUSED(col);
-
- qWarning() <<__FUNCTION__<< item->text(0);
- QDBusInterface iface(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
- dbc);
- if (!iface.isValid()) {
- qWarning() << "Could not find NetworkManager";
- return;
- }
- QVariant prop = iface.property("ActiveConnections");
- QList<QDBusObjectPath> connections = prop.value<QList<QDBusObjectPath> >();
- foreach(QDBusObjectPath path, connections) {
- QDBusInterface conDetails(NM_DBUS_SERVICE,
- path.path(),
- NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
- dbc);
-
- if (conDetails.isValid()) {
- QString desc = path.path();
- qWarning() << desc;
- if ( item->text(0) == conDetails.property("Connection").value<QDBusObjectPath>().path() ) {
-// QListWidgetItem* item = new QTreeWidgetItem( desc,
-// cons);
-// item->setData(Qt::UserRole, desc);
-// activeItemActivated( item );
- }
- }
- }
-}
-
-
-
-void NMView::deviceItemActivated( QTreeWidgetItem * item , int section)
-{
- Q_UNUSED(item);
- Q_UNUSED(section);
-
- // qWarning() << item->text(section) << item->text(4);
- //if(item->text(4) == "Wireless") findAccessPoints(item->text(0));
-}
-
-
-void NMView::netconfig()
-{
-// qWarning() << __FUNCTION__;
-
-// qDBusRegisterMetaType<SettingsMap>();
- QDBusConnection dbc = QDBusConnection::systemBus();
- if (!dbc.isConnected()) {
- qWarning() << "Unable to connect to D-Bus:" << dbc.lastError();
- return;
- }
-
- QDBusInterface iface(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_IFACE_SETTINGS_CONNECTION,
- dbc);
- if (!iface.isValid()) {
- qWarning() << "Could not find NetworkManager Settings";
- return;
- } else {
- QDBusReply<QList<QDBusObjectPath> > reply = iface.call("ListConnections");
- QList<QDBusObjectPath> list = reply.value();
-// qWarning() << reply.value();
- foreach(QDBusObjectPath path, list) {
- qWarning() << " " << path.path();
- }
- }
-}
-
-
-void NMView::findAccessPoints()
-{
- accessPointsTreeWidget->clear();
-
- QDBusInterface iface(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
- dbc);
-
- QDBusReply<QList<QDBusObjectPath> > reply = iface.call("GetDevices");
- if ( reply.isValid() ) {
- QList<QDBusObjectPath> list = reply.value();
- foreach(QDBusObjectPath path, list) {
- QDBusInterface devIface(NM_DBUS_SERVICE,
- path.path(),
- NM_DBUS_INTERFACE_DEVICE,
- dbc);
- if (devIface.isValid()) {
-
- if( devIface.property("DeviceType").toUInt() == DEVICE_TYPE_802_11_WIRELESS) {
-
-// qWarning() <<"deviface"<< devIface.path();
- QDBusInterface wififace(NM_DBUS_SERVICE,
- devIface.path(),
- NM_DBUS_INTERFACE_DEVICE_WIRELESS,
- dbc);
- if (!wififace.isValid()) {
- qWarning() << "Could not find NetworkManager wireless interface";
- return;
- }
-
-/////////////////////////
-// if(dbc.connect(NM_DBUS_SERVICE,
-// path.path(),
-// NM_DBUS_INTERFACE_DEVICE_WIRELESS,
-// "PropertiesChanged",
-// this,SLOT(aPPropertiesChanged( QMap<QString,QVariant>))) ) {
-// qWarning() << "PropertiesChanged connect";
-// } else {
-// qWarning() << "NOT connect";
-
-// }
-/////////////////////////
- qWarning() <<"wififace"<< wififace.path();
- QDBusReply<QList<QDBusObjectPath> > reply2 = wififace.call("GetAccessPoints");
- if ( reply2.isValid() ) {
- QTreeWidgetItem *item;
- QList<QDBusObjectPath> list2 = reply2.value();
- foreach(QDBusObjectPath path2, list2) {
- QDBusInterface accessPointIface(NM_DBUS_SERVICE,
- path2.path(),
- NM_DBUS_INTERFACE_ACCESS_POINT,
- dbc);
- if (accessPointIface.isValid()) {
-//// qWarning() <<"path2" << path2.path();
-
-// if(dbc.connect(NM_DBUS_SERVICE, //signal strength
-// path2.path(),
-// NM_DBUS_INTERFACE_ACCESS_POINT,
-// "PropertiesChanged",
-// this,SLOT(aPPropertiesChanged( QMap<QString,QVariant>))) ) {
-// qWarning() << "PropertiesChanged connect";
-// } else {
-// qWarning() << "NOT connect";
-//
-// }
-
- QStringList accessPoints;
- accessPoints << accessPointIface.property("Ssid").toString();
- accessPoints << QString::number(accessPointIface.property("Strength").toInt());
- accessPoints << securityCapabilitiesToString(accessPointIface.property("WpaFlags" ).toInt());
- accessPoints << securityCapabilitiesToString(accessPointIface.property("RsnFlags" ).toInt());
- accessPoints << accessPointIface.property("Frequency" ).toString();
- accessPoints << accessPointIface.property("HwAddress" ).toString();
- accessPoints << deviceModeToString(accessPointIface.property("Mode" ).toInt());
- accessPoints << accessPointIface.property("MaxBitrate" ).toString();
- //HwAddress
- // if(accessPointIface.property("Flags" ).toInt() == NM_802_11_AP_FLAGS_PRIVACY ) {
- // qWarning() << "Secure";
- // }
- item = new QTreeWidgetItem(accessPoints);
- accessPointsTreeWidget->insertTopLevelItem(0, item);
- }
- }
- }
- }
- }
- }
- }
-}
-
-QString NMView::deviceStateToString(int state)
-{
- QString ret;
- switch(state) {
- case NM_DEVICE_STATE_UNKNOWN:
- ret = "Unknown";
- break;
- case NM_DEVICE_STATE_UNMANAGED:
- ret = "Unmanaged";
- break;
- case NM_DEVICE_STATE_UNAVAILABLE:
- ret = "Unavailable";
- break;
- case NM_DEVICE_STATE_DISCONNECTED:
- ret = "Disconnected";
- break;
- case NM_DEVICE_STATE_PREPARE:
- ret = "Preparing to connect";
- break;
- case NM_DEVICE_STATE_CONFIG:
- ret = "Being configured";
- break;
- case NM_DEVICE_STATE_NEED_AUTH:
- ret = "Awaiting secrets";
- break;
- case NM_DEVICE_STATE_IP_CONFIG:
- ret = "IP requested";
- break;
- case NM_DEVICE_STATE_ACTIVATED:
- ret = "Activated";
- break;
- case NM_DEVICE_STATE_FAILED:
- ret = "FAILED";
- break;
- };
- return ret;
-}
-
-QString NMView::deviceTypeToString(int device)
-{
- QString ret;
- switch(device) {
- case DEVICE_TYPE_UNKNOWN:
- ret = "Unknown";
- break;
- case DEVICE_TYPE_802_3_ETHERNET:
- ret = "Ethernet";
- break;
- case DEVICE_TYPE_802_11_WIRELESS:
- ret = "Wireless";
- break;
- case DEVICE_TYPE_GSM:
- ret = "GSM";
- break;
- case DEVICE_TYPE_CDMA:
- ret = "CDMA";
- break;
- };
- return ret;
-}
-
-QString NMView::securityCapabilitiesToString(int caps)
-{
- int check = caps;
-// qWarning() << __FUNCTION__<< caps;
- QString ret;
- if( check == 0 )
- ret += "None.";
- if( (check & NM_802_11_AP_SEC_PAIR_WEP40))
- ret += " 40-bit WEP encryption. ";
- if( (check & NM_802_11_AP_SEC_PAIR_WEP104) )
- ret += " 104-bit WEP encryption. ";
- if( (check & NM_802_11_AP_SEC_PAIR_TKIP) )
- ret += " TKIP encryption. ";
- if( (check & NM_802_11_AP_SEC_PAIR_CCMP) )
- ret += " CCMP encryption. ";
- if( (check & NM_802_11_AP_SEC_GROUP_WEP40))
- ret += " 40-bit WEP cipher. ";
- if( (check & NM_802_11_AP_SEC_GROUP_WEP104))
- ret += " 104-bit WEP cipher. ";
- if( (check & NM_802_11_AP_SEC_GROUP_TKIP) )
- ret += " TKIP cipher. ";
- if( (check & NM_802_11_AP_SEC_GROUP_CCMP) )
- ret += " CCMP cipher. ";
- if( (check & NM_802_11_AP_SEC_KEY_MGMT_PSK))
- ret += " PSK key management. ";
- if( (check & NM_802_11_AP_SEC_KEY_MGMT_802_1X) )
- ret += " 802.1x key management. ";
- return ret;
-}
-
-QString NMView::deviceModeToString(int mode)
-{
- QString ret;
- switch (mode) {
- case NM_802_11_MODE_UNKNOWN:
- ret = "Unknown";
- break;
- case NM_802_11_MODE_ADHOC:
- ret = " (Adhoc).";
- break;
- case NM_802_11_MODE_INFRA:
- ret = " (Infrastructure)";
- };
- return ret;
-}
-
-void NMView::netManagerState(quint32 state)
-{
- qWarning() << __FUNCTION__ << state;// << old << reason;
- switch(state) {
- case NM_STATE_UNKNOWN:
- qWarning() << "The NetworkManager daemon is in an unknown state. ";
- break;
- case NM_STATE_ASLEEP:
- qWarning() << "The NetworkManager daemon is asleep and all interfaces managed by it are inactive. ";
- break;
- case NM_STATE_CONNECTING:
- qWarning() << "The NetworkManager daemon is connecting a device. FIXME: What does this mean when one device is active and another is connecting? ";
- break;
- case NM_STATE_CONNECTED:
- qWarning() <<"The NetworkManager daemon is connected. ";
- break;
- case NM_STATE_DISCONNECTED:
- qWarning() << "The NetworkManager daemon is disconnected.";
- break;
-
- };
-}
-
-void NMView::deviceStateChanged(quint32 state)
-{
- qWarning() << __FUNCTION__ << state;
- switch(state) {
- case NM_DEVICE_STATE_UNKNOWN :
- qWarning() <<"The device is in an unknown state. ";
- break;
- case NM_DEVICE_STATE_UNMANAGED:
- qWarning() <<"The device is not managed by NetworkManager.";
- break;
- case NM_DEVICE_STATE_UNAVAILABLE:
- qWarning() <<"The device cannot be used (carrier off, rfkill, etc).";
- break;
- case NM_DEVICE_STATE_DISCONNECTED:
- qWarning() <<"The device is not connected.";
- break;
- case NM_DEVICE_STATE_PREPARE:
- qWarning() <<"The device is preparing to connect.";
- break;
- case NM_DEVICE_STATE_CONFIG:
- qWarning() <<"The device is being configured.";
- break;
- case NM_DEVICE_STATE_NEED_AUTH:
- qWarning() <<"The device is awaiting secrets necessary to continue connection.";
- break;
- case NM_DEVICE_STATE_IP_CONFIG:
- qWarning() <<"The IP settings of the device are being requested and configured.";
- break;
- case NM_DEVICE_STATE_ACTIVATED:
- qWarning() <<"The device is active.";
- break;
- case NM_DEVICE_STATE_FAILED:
- qWarning() <<"The device is in a failure state following an attempt to activate it.";
- break;
- };
-}
-
-void NMView::updateCompleted()
-{
- qWarning() << __FUNCTION__;
-}
-
-void NMView::newConfigurationActivated()
-{
- qWarning() << __FUNCTION__;
- getActiveConnections();
-}
-
-void NMView::stateChanged(QNetworkSession::State state)
-{
- // QString stateStringstr;
- switch (state) {
- case QNetworkSession::Invalid:
- stateString = "Invalid session";
- break;
- case QNetworkSession::NotAvailable:
- stateString = "Session is defined but not yet discovered";
- break;
- case QNetworkSession::Connecting:
- stateString = "Session is being established";
- break;
- case QNetworkSession::Connected:
- stateString = "Session is active and can be used for socket operations";
- cons->currentItem()->setText(1, "Active");
- break;
- case QNetworkSession::Closing:
- stateString = "Session is being shutdown";
- break;
- case QNetworkSession::Disconnected:
- qWarning() << __FUNCTION__;
- manager->updateConfigurations();
- stateString = "Session disconnected";
- cons->currentItem()->setText(1,"Discovered") ;
- break;
- case QNetworkSession::Roaming:
- stateString = "session is roaming from one AP to another";
- break;
- };
- qWarning() << __FUNCTION__ << state << stateString;
-}
-
-QString NMView::stateToString(int state)
-{
- switch (state) {
- case QNetworkConfiguration::Undefined:
- return "Undefined";
- break;
- case QNetworkConfiguration::Defined:
- return "Defined";
- break;
- case QNetworkConfiguration::Discovered:
- return "Discovered";
- break;
- case QNetworkConfiguration::Active:
- return "Active";
- break;
- };
- return "";
-}
-
-void NMView::configurationAdded(const QNetworkConfiguration &config)
-{
- qWarning() << __FUNCTION__<< config.name() << config.identifier();
-}
-
-QString NMView::typeToString(int type)
-{
- switch(type) {
- case QNetworkConfiguration::InternetAccessPoint:
- return "Internet AccessPoint";
- break;
- case QNetworkConfiguration::ServiceNetwork:
- return "Service Network";
- break;
- };
- return QString();
-}
-
-void NMView::aPPropertiesChanged( QMap<QString,QVariant> map)
-{
- //QMap<QString, QVariant>::const_iterator iterator = d->values.find(type + QLatin1String("Path"))
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
- if( i.key() == "State") {
- qWarning() << __FUNCTION__ << i.key() << ": " << i.value().toUInt();
-// deviceStateChanged(i.value().toUInt());
- } else if( i.key() == "ActiveAccessPoint") {
- qWarning() << __FUNCTION__ << i.key() << ": " << i.value().value<QDBusObjectPath>().path();
- } else if( i.key() == "Strength")
- qWarning() << __FUNCTION__ << i.key() << ": " << i.value().toUInt();
- else
- qWarning() << __FUNCTION__ << i.key() << ": " << i.value();
- }
-}
-
-void NMView::networkSessionError(QNetworkSession::SessionError error)
-{
- QString errorStr;
- switch(error) {
- case QNetworkSession::RoamingError:
- errorStr = "Roaming error";
- break;
- case QNetworkSession::SessionAbortedError:
- errorStr = "Session aborted by user or system";
- break;
- default:
- case QNetworkSession::UnknownSessionError:
- errorStr = "Unidentified Error";
- break;
- };
-
- QMessageBox::warning(this, tr("NMView"), errorStr, QMessageBox::Ok);
-}
diff --git a/tests/manual/networkmanager/nmview.h b/tests/manual/networkmanager/nmview.h
deleted file mode 100644
index 41ee04f..0000000
--- a/tests/manual/networkmanager/nmview.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QWidget>
-#include <QDBusConnection>
-#include <qnetworkconfigmanager.h>
-#include <qnetworksession.h>
-#include <qnetworkconfiguration.h>
-
-#include "ui_dialog.h"
-
-QT_USE_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-class QListWidget;
-class QTreeWidget;
-class QTreeWidgetItem;
-QT_END_NAMESPACE
-
-class NMView : public QDialog, private Ui::Dialog
-{
- Q_OBJECT
-public:
- NMView(QDialog* parent = 0);
- virtual ~NMView();
-
-private:
- void init();
- QString stateString;
-
- QDBusConnection dbc;
- void printConnectionDetails(const QString&);
-
- QString deviceStateToString(int state);
- QString deviceTypeToString(int device);
- QString securityCapabilitiesToString(int caps);
- QString deviceModeToString(int mode);
-//QDBusInterface getInterface();
- QNetworkConfigurationManager *manager;
- QNetworkSession *sess;
- QString stateToString(int state);
- QString typeToString(int type);
-
-private slots:
- void update();
- void deactivate();
- void activate();
- void getActiveConnections();
- void updateConnections();
- void getDevices();
- // void readConnectionManagerDetails();
- void getNetworkDevices();
- void connectionItemActivated( QTreeWidgetItem *, int);
-// void activeItemActivated( QListWidgetItem *);
- void deviceItemActivated( QTreeWidgetItem *, int);
- void netconfig();
- void findAccessPoints();
-
- void netManagerState(quint32);
- void readSettings();
- void updateCompleted();
- void newConfigurationActivated();
-
- void stateChanged(QNetworkSession::State);
- void deviceStateChanged(quint32 state);
-
- void configurationAdded(const QNetworkConfiguration &config);
- void aPPropertiesChanged( QMap<QString,QVariant> map);
- void networkSessionError(QNetworkSession::SessionError);
-
-};
diff --git a/tests/manual/networkmanager/startdlg.cpp b/tests/manual/networkmanager/startdlg.cpp
deleted file mode 100644
index e34b5e9..0000000
--- a/tests/manual/networkmanager/startdlg.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "startdlg.h"
-#include <NetworkManager/NetworkManager.h>
-
-
-StartDialog::StartDialog(QWidget * parent)
- :QDialog(parent)
-{
- QVBoxLayout *layout = new QVBoxLayout(this);
- box = new QComboBox();
- layout->addWidget(box);
-
- QHBoxLayout* hbox = new QHBoxLayout();
- QPushButton* start = new QPushButton("Start");
- connect(start, SIGNAL(clicked()), this, SLOT(accept()));
- QPushButton* cancel = new QPushButton("Cancel");
- connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
-
-
- hbox->addWidget(start);
- hbox->addWidget(cancel);
-
- layout->addLayout(hbox);
-
- QDBusConnection dbc = QDBusConnection::systemBus();
- if (!dbc.isConnected()) {
- qWarning() << "Unable to connect to D-Bus:" << dbc.lastError();
- return;
- }
- QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc);
- if (!iface.isValid()) {
- qWarning() << "Could not find NetworkManager";
- return;
- }
- QDBusReply<QList<QDBusObjectPath> > reply = iface.call("GetDevices");
- if ( reply.isValid() ) {
- QList<QDBusObjectPath> list = reply.value();
- foreach(QDBusObjectPath path, list) {
- QDBusInterface devIface(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_DEVICE, dbc);
- if ( devIface.isValid() ) {
- box->addItem(devIface.property("Interface").toString(), QVariant(path.path()));
- }
- }
- }
-}
-
-QString StartDialog::device() const
-{
- return dev;
-}
-
-void StartDialog::accept()
-{
- dev = box->itemData(box->currentIndex(), Qt::UserRole).toString();
- QDialog::accept();
-}
diff --git a/tests/manual/repaint/mainwindow/main.cpp b/tests/manual/repaint/mainwindow/main.cpp
new file mode 100644
index 0000000..c8524b8
--- /dev/null
+++ b/tests/manual/repaint/mainwindow/main.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "../shared/shared.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QMainWindow mainWindow;
+
+ mainWindow.setCentralWidget(new StaticWidget());
+ mainWindow.setStatusBar(new QStatusBar());
+
+ QDockWidget *dockWidget = new QDockWidget();
+ dockWidget->setWidget(new StaticWidget());
+ mainWindow.addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
+
+ QToolBar *toolBar = new QToolBar();
+
+ toolBar->addWidget(new StaticWidget())->setVisible(true);;
+
+ toolBar->addWidget(new QSpinBox())->setVisible(true);;
+ mainWindow.addToolBar(toolBar);
+
+ mainWindow.resize(600, 400);
+ mainWindow.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/repaint/mainwindow/mainwindow.pro b/tests/manual/repaint/mainwindow/mainwindow.pro
new file mode 100644
index 0000000..c269d57
--- /dev/null
+++ b/tests/manual/repaint/mainwindow/mainwindow.pro
@@ -0,0 +1,15 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Nov 8 15:46:28 2006
+######################################################################
+
+TEMPLATE = app
+TARGET = mainwindow
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += ../shared/shared.h
+SOURCES += main.cpp
+CONFIG += qt warn_on debug create_prl link_prl
+OBJECTS_DIR = .obj/debug-shared
+MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/scrollarea/main.cpp b/tests/manual/repaint/scrollarea/main.cpp
new file mode 100644
index 0000000..33a0a1f
--- /dev/null
+++ b/tests/manual/repaint/scrollarea/main.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "../shared/shared.h"
+
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QScrollArea scrollView;
+
+ QWidget * staticWidget = new StaticWidget();
+ staticWidget->resize(400, 200);
+ scrollView.setWidget(staticWidget);
+
+ scrollView.setAttribute(Qt::WA_StaticContents);
+
+ scrollView.resize(600, 400);
+ scrollView.show();
+
+
+ return app.exec();
+}
+
+
diff --git a/tests/manual/repaint/scrollarea/scrollarea.pro b/tests/manual/repaint/scrollarea/scrollarea.pro
new file mode 100644
index 0000000..e1a40ad
--- /dev/null
+++ b/tests/manual/repaint/scrollarea/scrollarea.pro
@@ -0,0 +1,15 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Nov 8 15:28:57 2006
+######################################################################
+
+TEMPLATE = app
+TARGET = scrollarea
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += ../shared/shared.h
+SOURCES += main.cpp
+CONFIG += qt warn_on debug create_prl link_prl
+OBJECTS_DIR = .obj/debug-shared
+MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/shared/shared.h b/tests/manual/repaint/shared/shared.h
new file mode 100644
index 0000000..d1caf30
--- /dev/null
+++ b/tests/manual/repaint/shared/shared.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+class StaticWidget : public QWidget
+{
+Q_OBJECT
+public:
+ int hue;
+ bool pressed;
+ StaticWidget(QWidget *parent = 0)
+ :QWidget(parent)
+ {
+ setAttribute(Qt::WA_StaticContents);
+ setAttribute(Qt::WA_OpaquePaintEvent);
+ hue = 200;
+ pressed = false;
+ }
+
+ // Update 4 rects in a checkerboard pattern, using either
+ // a QRegion or separate rects (see the useRegion switch)
+ void updatePattern(QPoint pos)
+ {
+ const int rectSize = 10;
+ QRect rect(pos.x() - rectSize, pos.y() - rectSize, rectSize *2, rectSize * 2);
+
+ QVector<QRect> updateRects;
+ updateRects.append(rect.translated(rectSize * 2, rectSize * 2));
+ updateRects.append(rect.translated(rectSize * 2, -rectSize * 2));
+ updateRects.append(rect.translated(-rectSize * 2, rectSize * 2));
+ updateRects.append(rect.translated(-rectSize * 2, -rectSize * 2));
+
+
+ bool useRegion = false;
+ if (useRegion) {
+ QRegion region;
+ region.setRects(updateRects.data(), 4);
+ update(region);
+ } else {
+ foreach (QRect rect, updateRects)
+ update(rect);
+ }
+ }
+
+
+ void resizeEvent(QResizeEvent *)
+ {
+ // qDebug() << "static widget resize from" << e->oldSize() << "to" << e->size();
+ }
+
+ void mousePressEvent(QMouseEvent *event)
+ {
+// qDebug() << "mousePress at" << event->pos();
+ pressed = true;
+ updatePattern(event->pos());
+ }
+
+ void mouseReleaseEvent(QMouseEvent *)
+ {
+ pressed = false;
+ }
+
+ void mouseMoveEvent(QMouseEvent *event)
+ {
+ if (pressed)
+ updatePattern(event->pos());
+ }
+
+ void paintEvent(QPaintEvent *e)
+ {
+ QPainter p(this);
+ static int color = 200;
+ color = (color + 41) % 205 + 50;
+// color = ((color + 45) %150) + 100;
+ qDebug() << "static widget repaint" << e->rect();
+ if (pressed)
+ p.fillRect(e->rect(), QColor::fromHsv(100, 255, color));
+ else
+ p.fillRect(e->rect(), QColor::fromHsv(hue, 255, color));
+ p.setPen(QPen(QColor(Qt::white)));
+
+ for (int y = e->rect().top(); y <= e->rect().bottom() + 1; ++y) {
+ if (y % 20 == 0)
+ p.drawLine(e->rect().left(), y, e->rect().right(), y);
+ }
+
+ for (int x = e->rect().left(); x <= e->rect().right() +1 ; ++x) {
+ if (x % 20 == 0)
+ p.drawLine(x, e->rect().top(), x, e->rect().bottom());
+ }
+ }
+};
diff --git a/tests/manual/repaint/splitter/main.cpp b/tests/manual/repaint/splitter/main.cpp
new file mode 100644
index 0000000..626e826
--- /dev/null
+++ b/tests/manual/repaint/splitter/main.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "../shared/shared.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QSplitter splitter;
+
+ splitter.addWidget(new StaticWidget());
+ splitter.addWidget(new StaticWidget());
+
+ splitter.resize(600, 400);
+ splitter.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/repaint/splitter/splitter.pro b/tests/manual/repaint/splitter/splitter.pro
new file mode 100644
index 0000000..0afc063
--- /dev/null
+++ b/tests/manual/repaint/splitter/splitter.pro
@@ -0,0 +1,15 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Nov 8 15:39:53 2006
+######################################################################
+
+TEMPLATE = app
+TARGET = splitter
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += ../shared/shared.h
+SOURCES += main.cpp
+CONFIG += qt warn_on debug create_prl link_prl
+OBJECTS_DIR = .obj/debug-shared
+MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/tableview/main.cpp b/tests/manual/repaint/tableview/main.cpp
new file mode 100644
index 0000000..80d71bc
--- /dev/null
+++ b/tests/manual/repaint/tableview/main.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "../shared/shared.h"
+
+class CellWidget : public QWidget
+{
+public:
+ CellWidget (QWidget *parent = 0) : QWidget(parent) { }
+ void paintEvent(QPaintEvent * event)
+ {
+ static int value = 200;
+ value = (value + 41) % 205 + 50;
+ QPainter p(this);
+ p.fillRect(event->rect(), QColor::fromHsv(100, 255, value));
+ }
+};
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ QTableWidget tableWidget;
+// tableWidget.setAttribute(Qt::WA_StaticContents);
+ tableWidget.viewport()->setAttribute(Qt::WA_StaticContents);
+ tableWidget.setRowCount(15);
+ tableWidget.setColumnCount(4);
+ for (int row = 0; row < 15; ++row)
+ for (int col = 0; col < 4; ++col)
+// tableWidget.setCellWidget(row, col, new StaticWidget());
+ tableWidget.setCellWidget(row, col, new CellWidget());
+ tableWidget.resize(400, 600);
+ tableWidget.show();
+
+
+ return app.exec();
+}
+
+
diff --git a/tests/manual/repaint/tableview/tableview.pro b/tests/manual/repaint/tableview/tableview.pro
new file mode 100644
index 0000000..4fccf4a
--- /dev/null
+++ b/tests/manual/repaint/tableview/tableview.pro
@@ -0,0 +1,8 @@
+HEADERS +=../shared/shared.h
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += main.cpp
diff --git a/tests/manual/repaint/task141091/main.cpp b/tests/manual/repaint/task141091/main.cpp
new file mode 100644
index 0000000..3987bfa
--- /dev/null
+++ b/tests/manual/repaint/task141091/main.cpp
@@ -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 test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QDebug>
+
+class MyWidget : public QWidget
+{
+public:
+ MyWidget() : QWidget() {
+
+
+ setAttribute(Qt::WA_OpaquePaintEvent);
+ setAttribute(Qt::WA_StaticContents); }
+protected:
+ void paintEvent(QPaintEvent *e) { qDebug() << e->rect(); }
+};
+
+int main(int argc, char **argv)
+{
+ QApplication a(argc, argv);
+ MyWidget w;
+ w.show();
+ return a.exec();
+} \ No newline at end of file
diff --git a/tests/manual/repaint/task141091/task141091.pro b/tests/manual/repaint/task141091/task141091.pro
new file mode 100644
index 0000000..db89bd3
--- /dev/null
+++ b/tests/manual/repaint/task141091/task141091.pro
@@ -0,0 +1,12 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue Mar 6 13:44:00 2007
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+CONFIG+=console
+
+# Input
+SOURCES += main.cpp
diff --git a/tests/manual/networkmanager/startdlg.h b/tests/manual/repaint/toplevel/main.cpp
index 32c8557..aa7cab3 100644
--- a/tests/manual/networkmanager/startdlg.h
+++ b/tests/manual/repaint/toplevel/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,21 +39,14 @@
**
****************************************************************************/
-#include <QDialog>
-#include <QtDBus>
#include <QtGui>
+#include "../shared/shared.h"
-class StartDialog : public QDialog
+int main(int argc, char **argv)
{
- Q_OBJECT
-public:
- StartDialog(QWidget* parent = 0);
+ QApplication app(argc, argv);
+ StaticWidget widget;
+ widget.show();
+ return app.exec();
+}
- QString device() const;
-
-public slots:
- void accept();
-private:
- QString dev;
- QComboBox* box;
-};
diff --git a/tests/manual/repaint/toplevel/toplevel.pro b/tests/manual/repaint/toplevel/toplevel.pro
new file mode 100644
index 0000000..568ea8e
--- /dev/null
+++ b/tests/manual/repaint/toplevel/toplevel.pro
@@ -0,0 +1,16 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue Nov 7 10:15:42 2006
+######################################################################
+
+TEMPLATE = app
+TARGET = toplevel
+DEPENDPATH += .
+INCLUDEPATH += .
+CONFIG += console
+
+# Input
+HEADERS += ../shared/shared.h
+SOURCES += main.cpp
+CONFIG += qt warn_on debug create_prl link_prl
+OBJECTS_DIR = .obj/debug-shared
+MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/widget/main.cpp b/tests/manual/repaint/widget/main.cpp
new file mode 100644
index 0000000..8c86b2a
--- /dev/null
+++ b/tests/manual/repaint/widget/main.cpp
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "../shared/shared.h"
+
+class Child : public StaticWidget
+{
+Q_OBJECT
+public:
+ Child(QWidget *parent)
+ :StaticWidget(parent)
+ {
+ hue = 0;
+ }
+};
+
+QWidget *c;
+
+class TopLevel : public StaticWidget
+{
+Q_OBJECT
+public:
+ TopLevel()
+ {
+ resizeButton = new QPushButton("resize", this);
+ connect(resizeButton, SIGNAL(clicked()), SLOT(buttonResizeClicked()));
+
+ movebutton = new QPushButton("move", this);
+ connect(movebutton, SIGNAL(clicked()), SLOT(buttonMoveClicked()));
+ movebutton->move(70, 0);
+
+ moveResizebutton = new QPushButton("move + resize", this);
+ connect(moveResizebutton, SIGNAL(clicked()), SLOT(buttonMoveResizeClicked()));
+ moveResizebutton->move(150, 0);
+
+ scrollbutton = new QPushButton("scroll", this);
+ connect(scrollbutton, SIGNAL(clicked()), SLOT(buttonScrollClicked()));
+ scrollbutton->move(280, 0);
+ }
+
+public slots:
+ void buttonResizeClicked()
+ {
+ c->resize(c->size() + QSize(15, 15));
+ qDebug() << "child new size" << c->size();
+ }
+
+ void buttonMoveClicked()
+ {
+ c->move(c->pos() + QPoint(15, 15));
+ qDebug() << "child moved" << c->pos();
+ }
+
+ void buttonMoveResizeClicked()
+ {
+ QRect g = c->geometry();
+ g.adjust(15,15,30,30);
+ c->setGeometry(g);
+ qDebug() << "child moved" << c->pos() << "rezied" << c->size();
+ }
+
+
+ void buttonScrollClicked()
+ {
+ c->scroll(10, 10);
+ }
+
+protected:
+ QPushButton * resizeButton;
+ QPushButton * movebutton;
+ QPushButton * moveResizebutton;
+ QPushButton * scrollbutton;
+};
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ TopLevel bc;
+ bc.resize(500, 500);
+
+ c = new Child(&bc);
+ c->move(100, 100);
+ c->resize(100, 100);
+
+ QWidget *gc = new StaticWidget(c);
+ gc->move(20, 20);
+ gc->resize(50,50);
+
+
+ bc.show();
+ return app.exec();
+}
+
+#include "main.moc"
+
diff --git a/tests/manual/repaint/widget/widget.pro b/tests/manual/repaint/widget/widget.pro
new file mode 100644
index 0000000..c9d8f87
--- /dev/null
+++ b/tests/manual/repaint/widget/widget.pro
@@ -0,0 +1,15 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue Nov 7 11:16:05 2006
+######################################################################
+
+TEMPLATE = app
+TARGET = widget
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += ../shared/shared.h
+SOURCES += main.cpp
+CONFIG += qt warn_on debug create_prl link_prl
+OBJECTS_DIR = .obj/debug-shared
+MOC_DIR = .moc/debug-shared