29void SiteSettingsTest::initTestCase()
32 QTRY_COMPARE(
mApp->getWindow()->tabCount(), 1);
35void SiteSettingsTest::cleanupTestCase()
39void SiteSettingsTest::webAttributeTest()
50 checkInternalPage(&tab, QUrl(
QSL(
"falkon:start")));
52 checkExternalPage(&tab, QUrl(
QSL(
"https://www.falkon.org/")));
53 checkExternalPage(&tab, QUrl(
QSL(
"https://kde.org/")));
54 checkExternalPage(&tab, QUrl(
QSL(
"https://store.falkon.org/")));
56 checkInternalPage(&tab, QUrl(
QSL(
"falkon:about")));
58 checkExternalPage(&tab, QUrl(
QSL(
"https://planet.kde.org/")));
61bool SiteSettingsTest::checkWebAttributes(
WebPage *page, QHash<QWebEngineSettings::WebAttribute, bool> webAttributes)
63 for (
auto it = webAttributes.begin(); it != webAttributes.end(); ++it) {
64 if (page->settings()->testAttribute(it.key()) != it.value()) {
72void SiteSettingsTest::checkInternalPage(
WebTab *tab, QUrl url)
74 QMap<QWebEngineSettings::WebAttribute, bool> internalWebAttributes = {
75 {QWebEngineSettings::AutoLoadImages,
true}
76 ,{QWebEngineSettings::JavascriptEnabled,
true}
77 ,{QWebEngineSettings::JavascriptCanOpenWindows,
false}
78 ,{QWebEngineSettings::JavascriptCanAccessClipboard,
true}
79 ,{QWebEngineSettings::JavascriptCanPaste,
false}
80 ,{QWebEngineSettings::AllowWindowActivationFromJavaScript,
false}
81 ,{QWebEngineSettings::LocalStorageEnabled,
true}
82 ,{QWebEngineSettings::FullScreenSupportEnabled,
mApp->webSettings()->testAttribute(QWebEngineSettings::FullScreenSupportEnabled)}
83 ,{QWebEngineSettings::AllowRunningInsecureContent,
false}
84 ,{QWebEngineSettings::AllowGeolocationOnInsecureOrigins,
false}
85 ,{QWebEngineSettings::PlaybackRequiresUserGesture,
mApp->webSettings()->testAttribute(QWebEngineSettings::PlaybackRequiresUserGesture)}
86 ,{QWebEngineSettings::WebRTCPublicInterfacesOnly,
false}
89 QSignalSpy spy(tab, SIGNAL(loadingChanged(
bool)));
91 QTRY_COMPARE(spy.count(), 3);
94 for (
auto it = internalWebAttributes.begin(); it != internalWebAttributes.end(); ++it) {
95 QCOMPARE(page->settings()->testAttribute(it.key()), it.value());
99void SiteSettingsTest::checkExternalPage(
WebTab *tab, QUrl url)
103 QSignalSpy spy(tab, SIGNAL(loadingChanged(
bool)));
105 QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 3, 20000);
108 QCOMPARE(checkWebAttributes(page, siteSettings->
getWebAttributes(url)),
true);
#define FALKONTEST_MAIN(Test)
QHash< QWebEngineSettings::WebAttribute, bool > getWebAttributes(const QUrl &url)
void setOption(const QString &column, const QUrl &url, const int value)
void load(const LoadRequest &request)
TabbedWebView * webView() const