1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

[Qt5] Fixed failing FormCompleter tests.

This commit is contained in:
nowrep 2013-02-18 13:37:33 +01:00
parent 4f53179752
commit f3c7f5a3ba
4 changed files with 11 additions and 22 deletions

View File

@ -214,27 +214,17 @@ PageFormCompleter::QueryItem PageFormCompleter::findUsername(const QWebElement &
return QueryItem();
}
PageFormCompleter::QueryItems PageFormCompleter::createQueryItems(const QByteArray &data) const
PageFormCompleter::QueryItems PageFormCompleter::createQueryItems(QByteArray data) const
{
/* Why not to use encodedQueryItems = QByteArrays ?
* Because we need to filter "+" characters that must be spaces
* (not real "+" characters "%2B")
*
* DO NOT TOUCH! It works now with both Qt 4 & Qt 5 ...
*/
#if QT_VERSION >= 0x050000
QueryItems arguments = QUrlQuery(QUrl::fromEncoded("http://foo.com/?" + data)).queryItems();
#else
QByteArray dataCopy = data;
dataCopy.replace('+', ' ');
QueryItems arguments = QUrl::fromEncoded("http://foo.com/?" + dataCopy).queryItems();
#endif
// QUrlQuery/QUrl never encodes/decodes + and spaces
data.replace('+', ' ');
#if QT_VERSION >= 0x050000
for (int i = 0; i < arguments.count(); i++) {
arguments[i].first.replace(QLatin1Char('+'), QLatin1Char(' '));
arguments[i].second.replace(QLatin1Char('+'), QLatin1Char(' '));
}
QUrlQuery query;
query.setQuery(data);
QueryItems arguments = query.queryItems(QUrl::FullyDecoded);
#else
QueryItems arguments = QUrl::fromEncoded("http://foo.com/?" + data).queryItems();
#endif
return arguments;

View File

@ -51,7 +51,7 @@ private:
const QString &attributeValue) const;
QByteArray convertWebKitFormBoundaryIfNecessary(const QByteArray &data) const;
QueryItem findUsername(const QWebElement &form) const;
QueryItems createQueryItems(const QByteArray &data) const;
QueryItems createQueryItems(QByteArray data) const;
QWebElementCollection getAllElementsFromPage(QWebPage* page, const QString &selector) const;
QWebPage* m_page;

View File

@ -111,7 +111,6 @@ WebPage::WebPage(QupZilla* mainClass)
this, SLOT(appCacheQuotaExceeded(QWebSecurityOrigin*, quint64)));
#endif
s_livingPages.append(this);
}

View File

@ -1,11 +1,11 @@
isEqual(QT_MAJOR_VERSION, 5) {
QT += webkitwidgets network widgets printsupport sql script gui-private
QT += webkitwidgets network widgets printsupport sql script gui-private testlib
} else {
QT += core gui webkit sql network script
CONFIG += qtestlib
}
TARGET = autotests
CONFIG += qtestlib
!unix|mac: LIBS += -L$$PWD/../../bin -lQupZilla
!mac:unix: LIBS += $$PWD/../../bin/libQupZilla.so