File indexing completed on 2025-03-09 04:54:33
0001 /* 0002 SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-only 0005 */ 0006 0007 #include "webengineembedparttest.h" 0008 #include "../webengineembedpart.h" 0009 #include <QTest> 0010 0011 WebEngineEmbedPartTest::WebEngineEmbedPartTest(QObject *parent) 0012 : QObject(parent) 0013 { 0014 } 0015 0016 WebEngineEmbedPartTest::~WebEngineEmbedPartTest() = default; 0017 0018 void WebEngineEmbedPartTest::shouldHaveDefaultValue() 0019 { 0020 MessageViewer::WebEngineEmbedPart part; 0021 QVERIFY(part.isEmpty()); 0022 } 0023 0024 void WebEngineEmbedPartTest::shouldClearValue() 0025 { 0026 MessageViewer::WebEngineEmbedPart part; 0027 part.addEmbedPart(QByteArrayLiteral("foo"), QStringLiteral("bla")); 0028 QVERIFY(!part.isEmpty()); 0029 QCOMPARE(part.embeddedPartMap().count(), 1); 0030 0031 part.clear(); 0032 QVERIFY(part.isEmpty()); 0033 } 0034 0035 void WebEngineEmbedPartTest::shouldAddValues() 0036 { 0037 MessageViewer::WebEngineEmbedPart part; 0038 part.addEmbedPart(QByteArrayLiteral("foo"), QStringLiteral("bla")); 0039 QVERIFY(!part.isEmpty()); 0040 QCOMPARE(part.embeddedPartMap().count(), 1); 0041 part.addEmbedPart(QByteArrayLiteral("foo1"), QStringLiteral("bla")); 0042 QCOMPARE(part.embeddedPartMap().count(), 2); 0043 } 0044 0045 void WebEngineEmbedPartTest::shouldAddTwoIdenticalValues() 0046 { 0047 MessageViewer::WebEngineEmbedPart part; 0048 part.addEmbedPart(QByteArrayLiteral("foo"), QStringLiteral("bla")); 0049 QVERIFY(!part.isEmpty()); 0050 QCOMPARE(part.embeddedPartMap().count(), 1); 0051 part.addEmbedPart(QByteArrayLiteral("foo"), QStringLiteral("bla")); 0052 QCOMPARE(part.embeddedPartMap().count(), 1); 0053 } 0054 0055 QTEST_MAIN(WebEngineEmbedPartTest) 0056 0057 #include "moc_webengineembedparttest.cpp"