summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonatan Pålsson <jonatan.palsson@pelagicore.com>2014-03-13 15:13:10 +0100
committerJonatan Pålsson <jonatan.palsson@pelagicore.com>2014-03-13 16:11:33 +0100
commit994affbe6faa76592f824f0c87147c07979334e7 (patch)
tree16ee5c474ee9c68e9c43303b6c22a447963831aa
parent1b84e9ce4335fcf86e837b101e6499823a06f980 (diff)
downloadbrowser-poc-994affbe6faa76592f824f0c87147c07979334e7.tar.gz
Fixed bug where inputTextReceived does not contain currently entered text value
-rw-r--r--browser/browserview.cpp1
-rw-r--r--browser/unit-tests/browserdbus/testbrowserdbus.cpp20
-rw-r--r--browser/unit-tests/browserdbus/testbrowserdbus.h1
-rw-r--r--common/browserdbus.cpp1
-rw-r--r--common/browserdbus.h1
5 files changed, 24 insertions, 0 deletions
diff --git a/browser/browserview.cpp b/browser/browserview.cpp
index 7c45883..8a24280 100644
--- a/browser/browserview.cpp
+++ b/browser/browserview.cpp
@@ -112,6 +112,7 @@ void BrowserView::loadFinished(bool ok)
"var pocCurrentElement = null;"
"document.addEventListener('focus', function(e){"
" if (pocCurrentElement != e.target) {"
+ " e.target.setAttribute('value', e.target.value);"
" window.inputHandler.setCurrentFocus(e.target);"
" pocCurrentElement = e.target;"
" }"
diff --git a/browser/unit-tests/browserdbus/testbrowserdbus.cpp b/browser/unit-tests/browserdbus/testbrowserdbus.cpp
index acf7e43..4bb79a5 100644
--- a/browser/unit-tests/browserdbus/testbrowserdbus.cpp
+++ b/browser/unit-tests/browserdbus/testbrowserdbus.cpp
@@ -419,4 +419,24 @@ void TestBrowserDBus::testCanSelectOptionsInSelectList() {
m_bdb->selectOption(options);
}
+void TestBrowserDBus::testGetOldInputText() {
+ QSignalSpy spy (m_bdb, SIGNAL (onInputTextReceived(QString, QString, conn::brw::INPUT_ELEMENT_TYPE, int, int, int, int)));
+ m_bdb->createPageWindow(1,0,0,800,600);
+ m_bdb->loadurl(testFileUrl());
+ QTest::qSleep(300);
+ QProcess::execute("xdotool mousemove 200 350");
+ QProcess::execute("xdotool click 1");
+ QVERIFY(spy.wait(1000));
+ m_bdb->inputText(conn::brw::DR_OK, "Hello world");
+ QTest::qSleep(300);
+ QProcess::execute("xdotool mousemove 200 300");
+ QProcess::execute("xdotool click 1");
+ QTest::qSleep(300);
+ QProcess::execute("xdotool mousemove 200 350");
+ QProcess::execute("xdotool click 1");
+ QVERIFY(spy.wait(1000));
+ QString prevValue = spy.last().at(1).value<QString>();
+ QVERIFY(prevValue == "Hello world");
+}
+
QTEST_MAIN (TestBrowserDBus);
diff --git a/browser/unit-tests/browserdbus/testbrowserdbus.h b/browser/unit-tests/browserdbus/testbrowserdbus.h
index 823a9dc..f5530cf 100644
--- a/browser/unit-tests/browserdbus/testbrowserdbus.h
+++ b/browser/unit-tests/browserdbus/testbrowserdbus.h
@@ -56,6 +56,7 @@ private slots:
void testCanCancelAuth();
void testCanCloseAuthDialog();
void testCanSelectOptionsInSelectList();
+ void testGetOldInputText();
private:
QString testFileUrl() {
diff --git a/common/browserdbus.cpp b/common/browserdbus.cpp
index 2cf8967..696a4ac 100644
--- a/common/browserdbus.cpp
+++ b/common/browserdbus.cpp
@@ -230,6 +230,7 @@ void BrowserDbus::createPageWindow(int deviceid, int x, int y, int width, int he
qDebug() << "failed create object /Browser/IWebPageWindow*/IUserInput";
connect(actualuserinput, SIGNAL(onInputText(QString,QString,conn::brw::INPUT_ELEMENT_TYPE,int,int,int,int)), this, SLOT(InputTextReceived(QString,QString,conn::brw::INPUT_ELEMENT_TYPE,int,int,int,int)));
+ connect(actualuserinput, SIGNAL(onInputText(QString,QString,conn::brw::INPUT_ELEMENT_TYPE,int,int,int,int)), this, SIGNAL(onInputTextReceived(QString,QString,conn::brw::INPUT_ELEMENT_TYPE,int,int,int,int)));
QString *networkmanagerservice = new QString("/Browser/INetworkManager");
diff --git a/common/browserdbus.h b/common/browserdbus.h
index e88efef..e9f01a4 100644
--- a/common/browserdbus.h
+++ b/common/browserdbus.h
@@ -119,6 +119,7 @@ signals:
void onSslErrorDialog(const conn::brw::SslError&);
void onSslErrorDialogCancel(const conn::brw::SslError&);
void onAuthenticationDialogCancel(const conn::brw::AuthenticationData&);
+ void onInputTextReceived(QString a_strInputName, QString a_strDefaultInputValue, conn::brw::INPUT_ELEMENT_TYPE a_i32InputValueType, int a_s32MaxLength, int a_s32Max, int a_s32Min, int a_s32Step);
public slots:
void pageloadingstarted();