File indexing completed on 2025-01-19 04:47:00
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #include "adblockpluginurlinterceptoraddadblocklistwidgettest.h" 0007 #include "adblockpluginurlinterceptoraddadblocklistwidget.h" 0008 #include <QFormLayout> 0009 #include <QLineEdit> 0010 #include <QTest> 0011 QTEST_MAIN(AdblockPluginUrlInterceptorAddAdblockListWidgetTest) 0012 0013 AdblockPluginUrlInterceptorAddAdblockListWidgetTest::AdblockPluginUrlInterceptorAddAdblockListWidgetTest(QObject *parent) 0014 : QObject{parent} 0015 { 0016 } 0017 0018 void AdblockPluginUrlInterceptorAddAdblockListWidgetTest::shouldHaveDefaultValues() 0019 { 0020 AdblockPluginUrlInterceptorAddAdblockListWidget w; 0021 0022 auto mainLayout = w.findChild<QFormLayout *>(QStringLiteral("mainLayout")); 0023 QVERIFY(mainLayout); 0024 QCOMPARE(mainLayout->contentsMargins(), QMargins{}); 0025 0026 auto mName = w.findChild<QLineEdit *>(QStringLiteral("mName")); 0027 QVERIFY(mName); 0028 QVERIFY(mName->text().isEmpty()); 0029 0030 auto mUrl = w.findChild<QLineEdit *>(QStringLiteral("mUrl")); 0031 QVERIFY(mUrl); 0032 QVERIFY(mUrl->text().isEmpty()); 0033 } 0034 0035 void AdblockPluginUrlInterceptorAddAdblockListWidgetTest::shouldVerifyAdBlockListInfo() 0036 { 0037 AdblockPluginUrlInterceptorAddAdblockListWidget::AdBlockListInfo info; 0038 QVERIFY(!info.isValid()); 0039 0040 info.name = QStringLiteral("bla"); 0041 QVERIFY(!info.isValid()); 0042 0043 info.url = QStringLiteral("bli"); 0044 QVERIFY(info.isValid()); 0045 0046 info.name.clear(); 0047 QVERIFY(!info.isValid()); 0048 } 0049 0050 #include "moc_adblockpluginurlinterceptoraddadblocklistwidgettest.cpp"