summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2010-03-19 09:16:43 (GMT)
committerSami Merila <sami.merila@nokia.com>2010-03-19 09:16:43 (GMT)
commitb45f6f856fe72629e2e0752fc8732de487278f41 (patch)
treea0c9795b83a7ad51e76ac57b70eb447c8c046fbe
parentac0175b839ff326f15bd4de925f9ccd0390ac4e4 (diff)
parent5334c41991c7dd26d854c26e6ae6f238e16cc4f9 (diff)
downloadQt-b45f6f856fe72629e2e0752fc8732de487278f41.zip
Qt-b45f6f856fe72629e2e0752fc8732de487278f41.tar.gz
Qt-b45f6f856fe72629e2e0752fc8732de487278f41.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6
-rw-r--r--src/gui/widgets/qlinecontrol.cpp6
-rw-r--r--src/gui/widgets/qlinecontrol_p.h2
-rw-r--r--src/script/api/qscriptvalue.cpp5
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp132
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp8
-rw-r--r--tools/runonphone/main.cpp42
-rw-r--r--tools/runonphone/serenum_stub.cpp2
-rw-r--r--tools/runonphone/serenum_unix.cpp2
-rw-r--r--tools/runonphone/trksignalhandler.cpp30
9 files changed, 99 insertions, 130 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index db099e8..9ec0feb 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
Updates the display text based of the current edit text
If the text has changed will emit displayTextChanged()
*/
-void QLineControl::updateDisplayText()
+void QLineControl::updateDisplayText(bool forceUpdate)
{
QString orig = m_textLayout.text();
QString str;
@@ -102,7 +102,7 @@ void QLineControl::updateDisplayText()
m_textLayout.endLayout();
m_ascent = qRound(l.ascent());
- if (str != orig)
+ if (str != orig || forceUpdate)
emit displayTextChanged(str);
}
@@ -476,7 +476,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
}
}
m_textLayout.setAdditionalFormats(formats);
- updateDisplayText();
+ updateDisplayText(/*force*/ true);
if (cursorPositionChanged)
emitCursorPositionChanged();
if (isGettingInput)
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h
index d6f2705..3f1bc2c 100644
--- a/src/gui/widgets/qlinecontrol_p.h
+++ b/src/gui/widgets/qlinecontrol_p.h
@@ -239,7 +239,7 @@ private:
void init(const QString &txt);
void removeSelectedText();
void internalSetText(const QString &txt, int pos = -1, bool edited = true);
- void updateDisplayText();
+ void updateDisplayText(bool forceUpdate = false);
void internalInsert(const QString &s);
void internalDelete(bool wasBackspace = false);
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index 5bfe46a..8cf01e7 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -1946,7 +1946,7 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject,
JSC::MarkedArgumentBuffer applyArgs;
if (!array.isUndefinedOrNull()) {
if (!array.isObject()) {
- return d->engine->scriptValueFromJSCValue(JSC::throwError(exec, JSC::TypeError));
+ return d->engine->scriptValueFromJSCValue(JSC::throwError(exec, JSC::TypeError, "Arguments must be an array"));
}
if (JSC::asObject(array)->classInfo() == &JSC::Arguments::info)
JSC::asArguments(array)->fillArgList(exec, applyArgs);
@@ -1957,8 +1957,7 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject,
for (unsigned i = 0; i < length; ++i)
applyArgs.append(JSC::asArray(array)->get(exec, i));
} else {
- Q_ASSERT_X(false, Q_FUNC_INFO, "implement me");
-// return JSC::throwError(exec, JSC::TypeError);
+ return d->engine->scriptValueFromJSCValue(JSC::throwError(exec, JSC::TypeError, "Arguments must be an array"));
}
}
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 00bf144..4a874be 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -461,7 +461,7 @@ void tst_QGraphicsWidget::focusWidget()
QFETCH(int, childWithFocus);
SubQGraphicsWidget *widget = children[childWithFocus];
widget->setFocus();
- QVERIFY(widget->hasFocus());
+ QTRY_VERIFY(widget->hasFocus());
QCOMPARE(parent->focusWidget(), static_cast<QGraphicsWidget*>(widget));
}
}
@@ -478,23 +478,23 @@ void tst_QGraphicsWidget::focusWidget2()
scene.addItem(widget);
- QVERIFY(!widget->hasFocus());
+ QTRY_VERIFY(!widget->hasFocus());
widget->setFocusPolicy(Qt::StrongFocus);
- QVERIFY(!widget->hasFocus());
+ QTRY_VERIFY(!widget->hasFocus());
QGraphicsWidget *subWidget = new QGraphicsWidget(widget);
- QVERIFY(!subWidget->hasFocus());
+ QTRY_VERIFY(!subWidget->hasFocus());
scene.setFocus();
- QVERIFY(!widget->hasFocus());
- QVERIFY(!subWidget->hasFocus());
+ QTRY_VERIFY(!widget->hasFocus());
+ QTRY_VERIFY(!subWidget->hasFocus());
widget->setFocus();
- QVERIFY(widget->hasFocus());
- QCOMPARE(focusInSpy.count(), 1);
- QVERIFY(!subWidget->hasFocus());
+ QTRY_VERIFY(widget->hasFocus());
+ QTRY_COMPARE(focusInSpy.count(), 1);
+ QTRY_VERIFY(!subWidget->hasFocus());
QGraphicsWidget *otherSubWidget = new QGraphicsWidget;
EventSpy otherFocusInSpy(otherSubWidget, QEvent::FocusIn);
@@ -503,18 +503,18 @@ void tst_QGraphicsWidget::focusWidget2()
otherSubWidget->setFocusPolicy(Qt::StrongFocus);
otherSubWidget->setParentItem(widget);
- QVERIFY(widget->hasFocus());
+ QTRY_VERIFY(widget->hasFocus());
QCOMPARE(scene.focusItem(), (QGraphicsItem *)widget);
- QVERIFY(!subWidget->hasFocus());
- QVERIFY(!otherSubWidget->hasFocus());
+ QTRY_VERIFY(!subWidget->hasFocus());
+ QTRY_VERIFY(!otherSubWidget->hasFocus());
widget->hide();
- QVERIFY(!widget->hasFocus()); // lose but still has subfocus
+ QTRY_VERIFY(!widget->hasFocus()); // lose but still has subfocus
QCOMPARE(focusInSpy.count(), 1);
QCOMPARE(focusOutSpy.count(), 1);
widget->show();
- QVERIFY(!widget->hasFocus()); // no regain
+ QTRY_VERIFY(!widget->hasFocus()); // no regain
QCOMPARE(focusInSpy.count(), 1);
QCOMPARE(focusOutSpy.count(), 1);
@@ -522,24 +522,24 @@ void tst_QGraphicsWidget::focusWidget2()
// try to setup subFocus on item that can't take focus
subWidget->setFocus();
- QVERIFY(!subWidget->hasFocus());
+ QTRY_VERIFY(!subWidget->hasFocus());
QVERIFY(!scene.focusItem()); // but isn't the scene's focus item
// try to setup subFocus on item that can take focus
otherSubWidget->setFocus();
- QVERIFY(!otherSubWidget->hasFocus());
+ QTRY_VERIFY(!otherSubWidget->hasFocus());
QCOMPARE(widget->focusWidget(), otherSubWidget);
QVERIFY(!scene.focusItem()); // but isn't the scene's focus item
widget->show();
- QCOMPARE(scene.focusItem(), (QGraphicsItem *)otherSubWidget); // but isn't the scene's focus item
+ QTRY_COMPARE(scene.focusItem(), (QGraphicsItem *)otherSubWidget); // but isn't the scene's focus item
QCOMPARE(otherFocusInSpy.count(), 1);
QCOMPARE(otherFocusOutSpy.count(), 0);
delete otherSubWidget;
- QCOMPARE(otherFocusOutSpy.count(), 1);
+ QTRY_COMPARE(otherFocusOutSpy.count(), 1);
QVERIFY(!scene.focusItem());
QVERIFY(!widget->focusWidget());
}
@@ -578,16 +578,16 @@ void tst_QGraphicsWidget::focusPolicy()
SubQGraphicsWidget *widget = new SubQGraphicsWidget;
scene.addItem(widget);
- QCOMPARE(Qt::NoFocus, widget->focusPolicy());
+ QTRY_COMPARE(Qt::NoFocus, widget->focusPolicy());
QFETCH(Qt::FocusPolicy, focusPolicy1);
widget->setFocusPolicy(focusPolicy1);
- QCOMPARE(widget->focusPolicy(), focusPolicy1);
+ QTRY_COMPARE(widget->focusPolicy(), focusPolicy1);
bool isFocusable = widget->flags() & QGraphicsItem::ItemIsFocusable;
bool wasFocusable = isFocusable;
- QVERIFY(isFocusable == (focusPolicy1 != Qt::NoFocus));
+ QTRY_VERIFY(isFocusable == (focusPolicy1 != Qt::NoFocus));
widget->setFocus();
- QCOMPARE(widget->hasFocus(), isFocusable);
+ QTRY_COMPARE(widget->hasFocus(), isFocusable);
QFETCH(Qt::FocusPolicy, focusPolicy2);
widget->setFocusPolicy(focusPolicy2);
@@ -690,25 +690,21 @@ void tst_QGraphicsWidget::fontChangedEvent()
EventSpy rootSpyFont(root, QEvent::FontChange);
EventSpy rootSpyPolish(root, QEvent::Polish);
- QCOMPARE(rootSpyFont.count(), 0);
- QApplication::processEvents(); //The polish event is sent
- QCOMPARE(rootSpyPolish.count(), 1);
- QApplication::processEvents(); //Process events to see if we get the font change event
+ QTRY_COMPARE(rootSpyFont.count(), 0);
+ QTRY_COMPARE(rootSpyPolish.count(), 1);
//The font is still the same so no fontChangeEvent
- QCOMPARE(rootSpyFont.count(), 0);
+ QTRY_COMPARE(rootSpyFont.count(), 0);
QFont font;
font.setPointSize(43);
root->setFont(font);
- QApplication::processEvents(); //Process events to get the font change event
//The font changed
- QCOMPARE(rootSpyFont.count(), 1);
+ QTRY_COMPARE(rootSpyFont.count(), 1);
//then roll back to the default one.
root->setFont(appFont);
- QApplication::processEvents(); //Process events to get the font change event
//The font changed
- QCOMPARE(rootSpyFont.count(), 2);
+ QTRY_COMPARE(rootSpyFont.count(), 2);
}
void tst_QGraphicsWidget::fontPropagationWidgetItemWidget()
@@ -842,7 +838,6 @@ void tst_QGraphicsWidget::initStyleOption()
qt_x11_wait_for_window_manager(&view);
#endif
QApplication::setActiveWindow(&view);
- QTest::qWait(25);
QTRY_COMPARE(QApplication::activeWindow(), &view);
view.setAlignment(Qt::AlignTop | Qt::AlignLeft);
@@ -867,7 +862,6 @@ void tst_QGraphicsWidget::initStyleOption()
view.resize(300, 300);
view.show();
QTest::qWaitForWindowShown(&view);
- QTest::qWait(20);
sendMouseMove(view.viewport(), view.mapFromScene(widget->mapToScene(widget->boundingRect().center())));
}
@@ -920,9 +914,7 @@ void tst_QGraphicsWidget::layout()
}
widget.setLayout(layout);
- QTest::qWait(25);
-
- QCOMPARE(widget.layout(), static_cast<QGraphicsLayout*>(layout));
+ QTRY_COMPARE(widget.layout(), static_cast<QGraphicsLayout*>(layout));
for (int i = 0; i < children.count(); ++i) {
SubQGraphicsWidget *item = children[i];
QCOMPARE(item->parentWidget(), (QGraphicsWidget *)&widget);
@@ -962,10 +954,9 @@ void tst_QGraphicsWidget::layoutDirection()
view->show();
QTest::qWaitForWindowShown(view);
for (int i = 0; i < children.count(); ++i) {
- QCOMPARE(children[i]->layoutDirection(), layoutDirection);
- QCOMPARE(children[i]->testAttribute(Qt::WA_SetLayoutDirection), false);
+ QTRY_COMPARE(children[i]->layoutDirection(), layoutDirection);
+ QTRY_COMPARE(children[i]->testAttribute(Qt::WA_SetLayoutDirection), false);
view->repaint();
- QApplication::processEvents();
QTRY_COMPARE(children[i]->m_painterLayoutDirection, layoutDirection);
}
delete view;
@@ -1178,7 +1169,6 @@ void tst_QGraphicsWidget::setTabOrder()
qt_x11_wait_for_window_manager(&view);
#endif
QApplication::setActiveWindow(&view);
- QTest::qWait(25);
QTRY_COMPARE(QApplication::activeWindow(), &view);
QGraphicsWidget *lastItem = 0;
@@ -1199,7 +1189,6 @@ void tst_QGraphicsWidget::setTabOrder()
if (!children.isEmpty()) {
QGraphicsWidget *first = children.first();
view.viewport()->setFocus();
- QApplication::processEvents();
QTRY_VERIFY(view.viewport()->hasFocus());
first->setFocus();
QVERIFY(first->hasFocus());
@@ -1460,18 +1449,14 @@ void tst_QGraphicsWidget::verifyFocusChain()
QTest::qWaitForWindowShown(window);
lineEdit->setFocus();
- QTest::qWait(25);
QTRY_VERIFY(lineEdit->hasFocus());
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab);
- QTest::qWait(25);
QTRY_VERIFY(w1_1->hasFocus());
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab);
- QTest::qWait(25);
QTRY_VERIFY(w1_2->hasFocus());
// remove the tabFocusFirst and insert new item
delete w1_1; // calls _q_removeItemLater
- QTest::qWait(25);
SubQGraphicsWidget *w1_3 = new SubQGraphicsWidget;
w1_3->setFocusPolicy(Qt::StrongFocus);
w1_3->setData(0, "w1_3");
@@ -1479,14 +1464,11 @@ void tst_QGraphicsWidget::verifyFocusChain()
scene.addItem(w1_3);
QTRY_VERIFY(w1_2->hasFocus());
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab);
- QTest::qWait(25);
QTRY_VERIFY(lineEdit->hasFocus());
// tabFocusFirst should now point to w1_2
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab);
- QTest::qWait(25);
QTRY_VERIFY(w1_2->hasFocus());
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab);
- QTest::qWait(25);
QTRY_VERIFY(w1_3->hasFocus());
scene.removeItem(w1_2); // does not call _q_removeItemLater
delete w1_2; // calls _q_removeItemLater
@@ -1497,16 +1479,12 @@ void tst_QGraphicsWidget::verifyFocusChain()
w1_4->setGeometry(75,0,25, 25);
scene.addItem(w1_4);
QTRY_VERIFY(w1_3->hasFocus());
- QTest::qWait(25);
QTRY_VERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4));
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab);
- QTest::qWait(25);
QTRY_VERIFY(lineEdit->hasFocus());
// tabFocusFirst should now point to w1_3
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab);
- QTest::qWait(25);
QTRY_VERIFY(w1_3->hasFocus());
- QTest::qWait(25);
QTRY_VERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4));
delete window;
}
@@ -1521,7 +1499,6 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
qt_x11_wait_for_window_manager(&view);
#endif
QApplication::setActiveWindow(&view);
- QTest::qWait(25);
QTRY_COMPARE(QApplication::activeWindow(), &view);
// delete item in focus chain with no focus and verify chain
@@ -1755,31 +1732,29 @@ void tst_QGraphicsWidget::setSizes()
widget->setPreferredSize(pref);
widget->setMaximumSize(max);
- QApplication::processEvents();
-
for (i = 0; i < compareInstructions.count(); ++i) {
Inst input = compareInstructions.at(i);
switch (input.first) {
case MinimumSize:
- QCOMPARE(widget->minimumSize(), input.second.toSizeF());
+ QTRY_COMPARE(widget->minimumSize(), input.second.toSizeF());
break;
case PreferredSize:
- QCOMPARE(widget->preferredSize(), input.second.toSizeF());
+ QTRY_COMPARE(widget->preferredSize(), input.second.toSizeF());
break;
case MaximumSize:
- QCOMPARE(widget->maximumSize(), input.second.toSizeF());
+ QTRY_COMPARE(widget->maximumSize(), input.second.toSizeF());
break;
case Size:
- QCOMPARE(widget->size(), input.second.toSizeF());
+ QTRY_COMPARE(widget->size(), input.second.toSizeF());
break;
case MinimumWidth:
- QCOMPARE(widget->minimumWidth(), qreal(input.second.toDouble()));
+ QTRY_COMPARE(widget->minimumWidth(), qreal(input.second.toDouble()));
break;
case PreferredWidth:
- QCOMPARE(widget->preferredWidth(), qreal(input.second.toDouble()));
+ QTRY_COMPARE(widget->preferredWidth(), qreal(input.second.toDouble()));
break;
case MaximumWidth:
- QCOMPARE(widget->maximumWidth(), qreal(input.second.toDouble()));
+ QTRY_COMPARE(widget->maximumWidth(), qreal(input.second.toDouble()));
break;
default:
qWarning("instruction not implemented");
@@ -1834,14 +1809,13 @@ void tst_QGraphicsWidget::task236127_bspTreeIndexFails()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
- QTest::qWait(100);
- QVERIFY(!scene.itemAt(25, 25));
+ QTRY_VERIFY(!scene.itemAt(25, 25));
widget->setGeometry(0, 112, 360, 528);
- QCOMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget);
+ QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget);
widget2->setGeometry(0, 573, 360, 67);
- QCOMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget);
- QCOMPARE(scene.itemAt(50, 585), (QGraphicsItem *)widget2);
+ QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget);
+ QTRY_COMPARE(scene.itemAt(50, 585), (QGraphicsItem *)widget2);
}
void tst_QGraphicsWidget::defaultSize()
@@ -1856,7 +1830,6 @@ void tst_QGraphicsWidget::defaultSize()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
- QTest::qWait(50);
QSizeF initialSize = widget->size();
widget->resize(initialSize);
@@ -1866,9 +1839,8 @@ void tst_QGraphicsWidget::defaultSize()
widget->setPreferredSize(60, 60);
widget->setMaximumSize(110, 110);
widget->setVisible(true);
- QTest::qWait(50);
// should still have its size set to initialsize
- QCOMPARE(widget->geometry().size(), initialSize);
+ QTRY_COMPARE(widget->geometry().size(), initialSize);
}
@@ -2390,7 +2362,6 @@ void tst_QGraphicsWidget::painterStateProtectionOnWindowFrame()
scene.addItem(widget);
view.show();
QTest::qWaitForWindowShown(&view);
- QTest::qWait(500);
}
class ProxyStyle : public QCommonStyle
@@ -2479,7 +2450,6 @@ void tst_QGraphicsWidget::task250119_shortcutContext()
view.setScene(&scene);
view.show();
QApplication::setActiveWindow(&view);
- QTest::qWait(25);
QTRY_COMPARE(QApplication::activeWindow(), &view);
@@ -2734,9 +2704,7 @@ void tst_QGraphicsWidget::respectHFW()
QTest::qWaitForWindowShown(view);
{ // here we go - simulate a interactive resize of the window
- QTest::qWait(100);
QTest::mouseMove(view, view->mapFromScene(71, 71)); // bottom right corner
- QTest::qWait(100);
QTest::mousePress(view->viewport(), Qt::LeftButton, 0, view->mapFromScene(71, 71), 200);
view->grabMouse();
@@ -2750,10 +2718,9 @@ void tst_QGraphicsWidget::respectHFW()
QApplication::sendEvent(view->viewport(), &e);
view->releaseMouse();
}
- QTest::qWait(100);
const QSizeF winSize = window->size();
qreal minHFW = window->effectiveSizeHint(Qt::MinimumSize, QSizeF(winSize.width(), -1)).height();
- QVERIFY(qAbs(minHFW - winSize.height()) < 1);
+ QTRY_VERIFY(qAbs(minHFW - winSize.height()) < 1);
#endif
}
@@ -2805,7 +2772,7 @@ void tst_QGraphicsWidget::addChildInpolishEvent()
view.resize(200, 200);
view.show();
QTest::qWaitForWindowShown(&view);
- QCOMPARE(PolishWidget::numberOfPolish, 2);
+ QTRY_COMPARE(PolishWidget::numberOfPolish, 2);
}
void tst_QGraphicsWidget::polishEvent()
@@ -2852,10 +2819,8 @@ void tst_QGraphicsWidget::polishEvent2()
widget->events.clear();
- QApplication::processEvents();
-
// Make sure the item got polish event.
- QVERIFY(widget->events.contains(QEvent::Polish));
+ QTRY_VERIFY(widget->events.contains(QEvent::Polish));
}
void tst_QGraphicsWidget::initialShow()
@@ -2875,11 +2840,9 @@ void tst_QGraphicsWidget::initialShow()
view.show();
QTest::qWaitForWindowShown(&view);
- QTest::qWait(100);
scene.addItem(widget);
- QTest::qWait(100);
- QCOMPARE(widget->repaints, 1);
+ QTRY_COMPARE(widget->repaints, 1);
}
void tst_QGraphicsWidget::initialShow2()
@@ -2908,7 +2871,6 @@ void tst_QGraphicsWidget::initialShow2()
const int expectedRepaintCount = paintSpy.count();
delete dummyView;
dummyView = 0;
- QTest::qWait(200);
MyGraphicsWidget *widget = new MyGraphicsWidget;
widget->resize(100, 100);
@@ -2921,7 +2883,7 @@ void tst_QGraphicsWidget::initialShow2()
view.show();
QTest::qWaitForWindowShown(&view);
- QCOMPARE(widget->repaints, expectedRepaintCount);
+ QTRY_COMPARE(widget->repaints, expectedRepaintCount);
}
void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems()
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index f83cf58..b2f6caf 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2571,6 +2571,10 @@ void tst_QScriptValue::call()
// call with something else as arguments
QScriptValue ret5 = fun.call(QScriptValue(), QScriptValue(&eng, 123.0));
QCOMPARE(ret5.isError(), true);
+ // call with a non-array object as arguments
+ QScriptValue ret6 = fun.call(QScriptValue(), eng.globalObject());
+ QVERIFY(ret6.isError());
+ QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array"));
}
// calling things that are not functions
@@ -2703,6 +2707,10 @@ void tst_QScriptValue::construct()
// construct with something else as arguments
QScriptValue ret5 = fun.construct(QScriptValue(&eng, 123.0));
QCOMPARE(ret5.isError(), true);
+ // construct with a non-array object as arguments
+ QScriptValue ret6 = fun.construct(eng.globalObject());
+ QVERIFY(ret6.isError());
+ QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array"));
}
// construct on things that are not functions
diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp
index 1a5cdee..65085e0 100644
--- a/tools/runonphone/main.cpp
+++ b/tools/runonphone/main.cpp
@@ -44,9 +44,9 @@
#include <QStringList>
#include <QScopedPointer>
#include <QTimer>
-#include "trkutils.h"
-#include "trkdevice.h"
-#include "launcher.h"
+#include "symbianutils/trkutils.h"
+#include "symbianutils/trkdevice.h"
+#include "symbianutils/launcher.h"
#include "trksignalhandler.h"
#include "serenum.h"
@@ -133,28 +133,28 @@ int main(int argc, char *argv[])
return 1;
}
- if(serialPortName.isEmpty()) {
- if(loglevel > 0)
+ if (serialPortName.isEmpty()) {
+ if (loglevel > 0)
outstream << "Detecting serial ports" << endl;
QList <SerialPortId> ports = enumerateSerialPorts();
foreach(SerialPortId id, ports) {
- if(loglevel > 0)
+ if (loglevel > 0)
outstream << "Port Name: " << id.portName << ", "
<< "Friendly Name:" << id.friendlyName << endl;
- if(serialPortName.isEmpty()) {
- if(!id.friendlyName.isEmpty() &&
- serialPortFriendlyName.isEmpty() &&
- (id.friendlyName.contains("symbian", Qt::CaseInsensitive) ||
- id.friendlyName.contains("s60", Qt::CaseInsensitive) ||
- id.friendlyName.contains("nokia", Qt::CaseInsensitive)))
- serialPortName = id.portName;
- else if (!id.friendlyName.isEmpty() &&
- !serialPortFriendlyName.isEmpty() &&
- id.friendlyName.contains(serialPortFriendlyName))
+ if (serialPortName.isEmpty()) {
+ if (!id.friendlyName.isEmpty()
+ && serialPortFriendlyName.isEmpty()
+ && (id.friendlyName.contains("symbian", Qt::CaseInsensitive)
+ || id.friendlyName.contains("s60", Qt::CaseInsensitive)
+ || id.friendlyName.contains("nokia", Qt::CaseInsensitive)))
serialPortName = id.portName;
+ else if (!id.friendlyName.isEmpty()
+ && !serialPortFriendlyName.isEmpty()
+ && id.friendlyName.contains(serialPortFriendlyName))
+ serialPortName = id.portName;
}
}
- if(serialPortName.isEmpty()) {
+ if (serialPortName.isEmpty()) {
errstream << "No phone found, ensure USB cable is connected or specify manually with -p" << endl;
return 1;
}
@@ -162,7 +162,7 @@ int main(int argc, char *argv[])
QScopedPointer<trk::Launcher> launcher;
- if(sisFile.isEmpty()) {
+ if (sisFile.isEmpty()) {
launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyRun));
launcher->setCopyFileName(exeFile, QString("c:\\sys\\bin\\") + exeFile);
errstream << "System TRK required to copy EXE, use --sis if using Application TRK" << endl;
@@ -172,14 +172,14 @@ int main(int argc, char *argv[])
launcher->setCopyFileName(sisFile, "c:\\data\\testtemp.sis");
launcher->setInstallFileName("c:\\data\\testtemp.sis");
}
- if(loglevel > 0)
+ if (loglevel > 0)
outstream << "Connecting to target via " << serialPortName << endl;
launcher->setTrkServerName(serialPortName);
launcher->setFileName(QString("c:\\sys\\bin\\") + exeFile);
launcher->setCommandLineArgs(cmdLine);
- if(loglevel > 1)
+ if (loglevel > 1)
launcher->setVerbose(1);
TrkSignalHandler handler;
@@ -212,7 +212,7 @@ int main(int argc, char *argv[])
}
QString errorMessage;
- if(!launcher->startServer(&errorMessage)) {
+ if (!launcher->startServer(&errorMessage)) {
errstream << errorMessage << endl;
return 1;
}
diff --git a/tools/runonphone/serenum_stub.cpp b/tools/runonphone/serenum_stub.cpp
index f39765e..6f0e1ef 100644
--- a/tools/runonphone/serenum_stub.cpp
+++ b/tools/runonphone/serenum_stub.cpp
@@ -47,7 +47,7 @@
QList<SerialPortId> enumerateSerialPorts()
{
QList<SerialPortId> list;
- qWarning() << "enumerateSerialPorts not implemented" << endl;
+ qWarning() << "enumerateSerialPorts not implemented";
return list;
}
diff --git a/tools/runonphone/serenum_unix.cpp b/tools/runonphone/serenum_unix.cpp
index ca6c437..c8ec021 100644
--- a/tools/runonphone/serenum_unix.cpp
+++ b/tools/runonphone/serenum_unix.cpp
@@ -51,7 +51,7 @@ QList<SerialPortId> enumerateSerialPorts()
QList<SerialPortId> list;
QDir dir("/dev/serial/by-id/");
QFileInfoList ports(dir.entryInfoList());
- foreach(QFileInfo info, ports) {
+ foreach (const QFileInfo &info, ports) {
if (!info.isDir()) {
SerialPortId id;
id.friendlyName = info.fileName();
diff --git a/tools/runonphone/trksignalhandler.cpp b/tools/runonphone/trksignalhandler.cpp
index 138ebc9..18a2c0c 100644
--- a/tools/runonphone/trksignalhandler.cpp
+++ b/tools/runonphone/trksignalhandler.cpp
@@ -58,13 +58,13 @@ private:
void TrkSignalHandler::copyingStarted()
{
- if(d->loglevel > 0)
+ if (d->loglevel > 0)
d->out << "Copying..." << endl;
}
void TrkSignalHandler::canNotConnect(const QString &errorMessage)
{
- d->err << "Cannot Connect - " << errorMessage << endl;
+ d->err << "Cannot connect - " << errorMessage << endl;
}
void TrkSignalHandler::canNotCreateFile(const QString &filename, const QString &errorMessage)
@@ -84,7 +84,7 @@ void TrkSignalHandler::canNotCloseFile(const QString &filename, const QString &e
void TrkSignalHandler::installingStarted()
{
- if(d->loglevel > 0)
+ if (d->loglevel > 0)
d->out << "Installing..." << endl;
}
@@ -95,19 +95,19 @@ void TrkSignalHandler::canNotInstall(const QString &packageFilename, const QStri
void TrkSignalHandler::installingFinished()
{
- if(d->loglevel > 0)
+ if (d->loglevel > 0)
d->out << "Installing finished" << endl;
}
void TrkSignalHandler::startingApplication()
{
- if(d->loglevel > 0)
+ if (d->loglevel > 0)
d->out << "Starting app..." << endl;
}
void TrkSignalHandler::applicationRunning(uint pid)
{
- if(d->loglevel > 0)
+ if (d->loglevel > 0)
d->out << "Running..." << endl;
}
@@ -118,7 +118,7 @@ void TrkSignalHandler::canNotRun(const QString &errorMessage)
void TrkSignalHandler::finished()
{
- if(d->loglevel > 0)
+ if (d->loglevel > 0)
d->out << "Done." << endl;
QCoreApplication::quit();
}
@@ -130,17 +130,17 @@ void TrkSignalHandler::applicationOutputReceived(const QString &output)
void TrkSignalHandler::copyProgress(int percent)
{
- if(d->loglevel > 0) {
+ if (d->loglevel > 0) {
d->out << percent << "% ";
d->out.flush();
- if(percent==100)
+ if (percent==100)
d->out << endl;
}
}
void TrkSignalHandler::stateChanged(int state)
{
- if(d->loglevel > 1)
+ if (d->loglevel > 1)
d->out << "State" << state << endl;
}
@@ -164,10 +164,10 @@ void TrkSignalHandler::timeout()
emit terminate();
}
-TrkSignalHandlerPrivate::TrkSignalHandlerPrivate() :
- out(stdout),
- err(stderr),
- loglevel(0)
+TrkSignalHandlerPrivate::TrkSignalHandlerPrivate()
+ : out(stdout),
+ err(stderr),
+ loglevel(0)
{
}
@@ -179,8 +179,8 @@ TrkSignalHandlerPrivate::~TrkSignalHandlerPrivate()
}
TrkSignalHandler::TrkSignalHandler()
+ : d(new TrkSignalHandlerPrivate())
{
- d = new TrkSignalHandlerPrivate();
}
TrkSignalHandler::~TrkSignalHandler()