| Index: Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
|
| ===================================================================
|
| --- Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp (revision 143745)
|
| +++ Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp (working copy)
|
| @@ -186,6 +186,7 @@
|
| void renderOnRepaintRequestedShouldNotRecurse();
|
| void loadSignalsOrder_data();
|
| void loadSignalsOrder();
|
| + void openWindowDefaultSize();
|
|
|
| #ifdef Q_OS_MAC
|
| void macCopyUnicodeToClipboard();
|
| @@ -410,10 +411,13 @@
|
| QCOMPARE(page.lineNumbers.at(0), 1);
|
| }
|
|
|
| -class TestPage : public QWebPage
|
| -{
|
| +class TestPage : public QWebPage {
|
| + Q_OBJECT
|
| public:
|
| - TestPage(QObject* parent = 0) : QWebPage(parent) {}
|
| + TestPage(QObject* parent = 0) : QWebPage(parent)
|
| + {
|
| + connect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect)));
|
| + }
|
|
|
| struct Navigation {
|
| QPointer<QWebFrame> frame;
|
| @@ -422,7 +426,8 @@
|
| };
|
|
|
| QList<Navigation> navigations;
|
| - QList<QWebPage*> createdWindows;
|
| + QList<TestPage*> createdWindows;
|
| + QRect requestedGeometry;
|
|
|
| virtual bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type) {
|
| Navigation n;
|
| @@ -434,10 +439,15 @@
|
| }
|
|
|
| virtual QWebPage* createWindow(WebWindowType) {
|
| - QWebPage* page = new TestPage(this);
|
| + TestPage* page = new TestPage(this);
|
| createdWindows.append(page);
|
| return page;
|
| }
|
| +
|
| +private Q_SLOTS:
|
| + void slotGeometryChangeRequested(const QRect& geom) {
|
| + requestedGeometry = geom;
|
| + }
|
| };
|
|
|
| void tst_QWebPage::popupFormSubmission()
|
| @@ -3253,5 +3263,29 @@
|
| QVERIFY(typingActionText != alignActionText);
|
| }
|
|
|
| +void tst_QWebPage::openWindowDefaultSize()
|
| +{
|
| + TestPage page;
|
| + page.settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
|
| + // Open a default window.
|
| + page.mainFrame()->evaluateJavaScript("window.open()");
|
| + // Open a too small window.
|
| + page.mainFrame()->evaluateJavaScript("window.open('', '', 'width=10,height=10')");
|
| +
|
| + QTest::qWait(500);
|
| + // The number of popups created should be two.
|
| + QVERIFY(page.createdWindows.size() == 2);
|
| +
|
| + QRect requestedGeometry = page.createdWindows[0]->requestedGeometry;
|
| + // Check default size has been requested.
|
| + QVERIFY(requestedGeometry.width() == 0);
|
| + QVERIFY(requestedGeometry.height() == 0);
|
| +
|
| + requestedGeometry = page.createdWindows[1]->requestedGeometry;
|
| + // Check minimum size has been requested.
|
| + QVERIFY(requestedGeometry.width() == 100);
|
| + QVERIFY(requestedGeometry.height() == 100);
|
| +}
|
| +
|
| QTEST_MAIN(tst_QWebPage)
|
| #include "tst_qwebpage.moc"
|
|
|