File indexing completed on 2025-01-26 04:57:23
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "developertoolwidgettest.h" 0008 #include "developertool/developertoolwidget.h" 0009 #include <QTest> 0010 #include <QVBoxLayout> 0011 #include <QWebEngineSettings> 0012 #include <QWebEngineView> 0013 QTEST_MAIN(DeveloperToolWidgetTest) 0014 DeveloperToolWidgetTest::DeveloperToolWidgetTest(QObject *parent) 0015 : QObject(parent) 0016 { 0017 } 0018 0019 void DeveloperToolWidgetTest::shouldHaveDefaultValues() 0020 { 0021 WebEngineViewer::DeveloperToolWidget w; 0022 auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout")); 0023 QVERIFY(mainLayout); 0024 QCOMPARE(mainLayout->contentsMargins(), QMargins(0, 0, 0, 0)); 0025 0026 auto mWebEngineView = w.findChild<QWebEngineView *>(QStringLiteral("mWebEngineView")); 0027 QVERIFY(mWebEngineView); 0028 mainLayout->addWidget(mWebEngineView); 0029 auto mEnginePage = w.findChild<QWebEnginePage *>(QStringLiteral("mEnginePage")); 0030 QVERIFY(mEnginePage); 0031 QCOMPARE(mWebEngineView->page(), mEnginePage); 0032 QVERIFY(mEnginePage->settings()->testAttribute(QWebEngineSettings::JavascriptEnabled)); 0033 } 0034 0035 #include "moc_developertoolwidgettest.cpp"