diff options
author | Jonatan Pålsson <jonatan.palsson@pelagicore.com> | 2014-02-05 19:28:18 +0100 |
---|---|---|
committer | Jonatan Pålsson <jonatan.palsson@pelagicore.com> | 2014-02-05 19:28:18 +0100 |
commit | 31254b583364bb14204584d24ce5eb02356d4479 (patch) | |
tree | c2510fd40648da80659aed1fe59ac318c01ad002 | |
parent | bbf5d657eeb376b0bfaec73493734117ec2b6ce0 (diff) | |
download | browser-poc-31254b583364bb14204584d24ce5eb02356d4479.tar.gz |
Implemented onLinkHovered
-rw-r--r-- | browser/browser.cpp | 1 | ||||
-rw-r--r-- | browser/browserview.cpp | 1 | ||||
-rw-r--r-- | browser/browserview.h | 1 | ||||
-rw-r--r-- | browser/unit-tests/browserdbus/testbrowserdbus.cpp | 20 | ||||
-rw-r--r-- | browser/unit-tests/browserdbus/testbrowserdbus.h | 1 | ||||
-rw-r--r-- | browser/webpagewindow.h | 1 | ||||
-rw-r--r-- | common/browserdbus.cpp | 1 | ||||
-rw-r--r-- | common/browserdbus.h | 1 |
8 files changed, 27 insertions, 0 deletions
diff --git a/browser/browser.cpp b/browser/browser.cpp index 706e510..29783b4 100644 --- a/browser/browser.cpp +++ b/browser/browser.cpp @@ -49,6 +49,7 @@ conn::brw::ERROR_IDS browser::createPageWindow(int a_eDeviceId, const conn::brw: connect(bvi, SIGNAL(onSelectionChanged(void)), wpw, SIGNAL(onSelectionChanged(void))); connect(bvi, SIGNAL(onStatusTextChanged(QString)), wpw, SIGNAL(onStatusTextChanged(QString))); connect(bvi, SIGNAL(onZoomFactorChanged(double)), wpw, SIGNAL(onZoomFactorChanged(double))); + connect(bvi, SIGNAL(onLinkHovered(QString)), wpw, SIGNAL(onLinkHovered(QString))); connect(bvi, SIGNAL(onInputText(QString, QString, int, int, int, int, int)), ui, SLOT(inputTextReceived(QString, QString, int, int, int, int, int))); connect(this,SIGNAL(onPageWindowDestroyed(qlonglong)), wpw, SIGNAL(onClose())); connect(bvi, SIGNAL(onScrollPositionChanged(uint,uint)), wpw, SIGNAL(onScrollPositionChanged(uint,uint))); diff --git a/browser/browserview.cpp b/browser/browserview.cpp index 9d4b359..9be9659 100644 --- a/browser/browserview.cpp +++ b/browser/browserview.cpp @@ -45,6 +45,7 @@ BrowserView::BrowserView() connect(&m_webview, SIGNAL (linkClicked(QUrl)), this, SLOT (linkClicked(QUrl))); connect(m_webview.page(), SIGNAL (selectionChanged(void)), this, SIGNAL(onSelectionChanged(void))); + connect(m_webview.page(), SIGNAL (linkHovered(const QString&,const QString&,const QString&)), this, SIGNAL(onLinkHovered(QString))); connect(&m_inputHandler, SIGNAL (onInputText(QString, QString, int, int, int, int, int)), this, SIGNAL (onInputText(QString, QString, int, int, int, int, int))); diff --git a/browser/browserview.h b/browser/browserview.h index bcd45e5..a488c0e 100644 --- a/browser/browserview.h +++ b/browser/browserview.h @@ -93,6 +93,7 @@ signals: void onVisibilityChanged(bool); void onScrollPositionChanged(uint,uint); void onZoomFactorChanged(double); + void onLinkHovered(QString); protected: virtual void resizeEvent (QResizeEvent *event); diff --git a/browser/unit-tests/browserdbus/testbrowserdbus.cpp b/browser/unit-tests/browserdbus/testbrowserdbus.cpp index f6aef6c..f790dc2 100644 --- a/browser/unit-tests/browserdbus/testbrowserdbus.cpp +++ b/browser/unit-tests/browserdbus/testbrowserdbus.cpp @@ -81,6 +81,26 @@ void TestBrowserDBus::testGetsNotifiedWhenLinkIsClicked() { QVERIFY(spy.wait(10000)); } +void TestBrowserDBus::testGetsNotifiedWhenLinkIsHovered() { + m_bdb->createPageWindow(1,0,0,800,600); + QSignalSpy spy (m_bdb, SIGNAL (linkHovered (QString))); + m_bdb->loadurl(testFileUrl()); + + QTest::qSleep(200); + QProcess::execute("xdotool mousemove 100 100"); + + bool success = false; + for (int i = 0; i < 10; i++){ + spy.wait(1000); + if (spy.last().value(0).toString().contains("google")) { + success = true; + break; + } + } + + QVERIFY(success); +} + void TestBrowserDBus::testGetsNotifiedWhenSelectionChanges() { m_bdb->createPageWindow(1,0,0,800,600); QSignalSpy spy (m_bdb, SIGNAL (selectionChanged ())); diff --git a/browser/unit-tests/browserdbus/testbrowserdbus.h b/browser/unit-tests/browserdbus/testbrowserdbus.h index af66c31..d112bbf 100644 --- a/browser/unit-tests/browserdbus/testbrowserdbus.h +++ b/browser/unit-tests/browserdbus/testbrowserdbus.h @@ -28,6 +28,7 @@ private slots: void testGetsNotifiedOnUrlChange(); void testGetsNotifiedOnTitleChange(); void testGetsNotifiedWhenLinkIsClicked(); + void testGetsNotifiedWhenLinkIsHovered(); void testGetsNotifiedWhenSelectionChanges(); void testGetsNotifiedWhenStatusBarChanges(); void testGetsNotifiedWhenVisibilityChanges(); diff --git a/browser/webpagewindow.h b/browser/webpagewindow.h index 72a570b..24edbb1 100644 --- a/browser/webpagewindow.h +++ b/browser/webpagewindow.h @@ -45,6 +45,7 @@ signals: void onVisibilityChanged(bool); void onScrollPositionChanged(uint,uint); void onZoomFactorChanged(double); + void onLinkHovered(QString); public Q_SLOTS: diff --git a/common/browserdbus.cpp b/common/browserdbus.cpp index a870389..186c77e 100644 --- a/common/browserdbus.cpp +++ b/common/browserdbus.cpp @@ -199,6 +199,7 @@ void BrowserDbus::createPageWindow(int deviceid, int x, int y, int width, int he connect(actualtab, SIGNAL(onVisibilityChanged(bool)), this, SIGNAL(onVisibilityChanged(bool))); connect(actualtab, SIGNAL(onScrollPositionChanged(uint,uint)), this, SIGNAL(onScrollPositionChanged(uint,uint))); connect(actualtab, SIGNAL(onZoomFactorChanged(double)), this, SIGNAL(onZoomFactorChanged(double))); + connect(actualtab, SIGNAL(onLinkHovered(QString)), this, SIGNAL(linkHovered(QString))); QString *userinputservice = new QString(*webpagewindowservice + "/IUserInput"); diff --git a/common/browserdbus.h b/common/browserdbus.h index d3abc1b..8a11710 100644 --- a/common/browserdbus.h +++ b/common/browserdbus.h @@ -95,6 +95,7 @@ signals: void onVisibilityChanged(bool); void onScrollPositionChanged(uint,uint); void onZoomFactorChanged(double); + void linkHovered(QString); public slots: void pageloadingstarted(); |