Bug 34755 - [Qt] Unit test for window.showModalDialog
Summary: [Qt] Unit test for window.showModalDialog
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2010-02-09 07:59 PST by Yael
Modified: 2010-02-09 18:30 PST (History)
1 user (show)

See Also:


Attachments
Patch v1 (1.89 KB, patch)
2010-02-09 12:02 PST, Yael
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yael 2010-02-09 07:59:53 PST
After r54550, QtWebKit supports window.runModalDialog, but it does not have a unit test yet.
Comment 1 Yael 2010-02-09 12:02:29 PST
Created attachment 48434 [details]
Patch v1

Add unit test for window.showModalDialog
Comment 2 Adam Barth 2010-02-09 12:05:44 PST
Comment on attachment 48434 [details]
Patch v1

LGTM
Comment 3 Yael 2010-02-09 18:30:14 PST
Landed as:  http://trac.webkit.org/changeset/54578
Comment 4 Yael 2010-02-09 18:30:54 PST
Comment on attachment 48434 [details]
Patch v1

> Index: WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
> ===================================================================
> --- WebKit/qt/tests/qwebpage/tst_qwebpage.cpp	(revision 54545)
> +++ WebKit/qt/tests/qwebpage/tst_qwebpage.cpp	(working copy)
> @@ -110,6 +110,7 @@
>  
>      void originatingObjectInNetworkRequests();
>      void testJSPrompt();
> +    void showModalDialog();
>  
>  private:
>      QWebView* m_view;
> @@ -1828,5 +1829,26 @@
>      QVERIFY(res);
>  }
>  
> +class TestModalPage : public QWebPage
> +{
> +    Q_OBJECT
> +public:
> +    TestModalPage(QObject* parent = 0) : QWebPage(parent) {
> +    }
> +    virtual QWebPage* createWindow(WebWindowType) {
> +        QWebPage* page = new TestModalPage();
> +        connect(page, SIGNAL(windowCloseRequested()), page, SLOT(deleteLater()));
> +        return page;
> +    }
> +};
> +
> +void tst_QWebPage::showModalDialog()
> +{
> +    TestModalPage page;
> +    page.mainFrame()->setHtml(QString("<html></html>"));
> +    QString res = page.mainFrame()->evaluateJavaScript("window.showModalDialog('javascript:window.returnValue=dialogArguments; window.close();', 'This is a test');").toString();
> +    QCOMPARE(res, QString("This is a test"));
> +}
> +
>  QTEST_MAIN(tst_QWebPage)
>  #include "tst_qwebpage.moc"
> Index: WebKit/qt/ChangeLog
> ===================================================================
> --- WebKit/qt/ChangeLog	(revision 54561)
> +++ WebKit/qt/ChangeLog	(working copy)
> @@ -1,5 +1,17 @@
>  2010-02-09  Yael Aharon  <yael.aharon@nokia.com>
>  
> +        Reviewed by NOBODY (OOPS!).
> +
> +        [Qt] Unit test for window.runModalDialog
> +        https://bugs.webkit.org/show_bug.cgi?id=34755
> +
> +        * tests/qwebpage/tst_qwebpage.cpp:
> +        (TestModalPage::TestModalPage):
> +        (TestModalPage::createWindow):
> +        (tst_QWebPage::showModalDialog):
> +
> +2010-02-09  Yael Aharon  <yael.aharon@nokia.com>
> +
>          Reviewed by Kenneth Rohde Christiansen.
>  
>          [Qt] Webkit in Qt does not have window.showModalDialog
Clearing flags.