File indexing completed on 2024-05-19 05:57:11

0001 /*
0002     This file is part of the Okteta KPart module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2016 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #include "oktetaparttest.hpp"
0010 
0011 // test object
0012 #include <partfactory.hpp>
0013 #include <part.hpp>
0014 // Qt
0015 #include <QTest>
0016 
0017 void OktetaPartTest::testPartReuseWithAnotherUrl()
0018 {
0019     KPluginFactory* factory = new OktetaPartFactory();
0020     auto* part = factory->create<KParts::ReadOnlyPart>(nullptr, nullptr, QVariantList());
0021     QVERIFY(part != nullptr);
0022 
0023     const QUrl url1 = QUrl::fromLocalFile(QStringLiteral(TESTPATH1));
0024     part->openUrl(url1);
0025     QCOMPARE(part->url(), url1);
0026 
0027     const QUrl url2 = QUrl::fromLocalFile(QStringLiteral(TESTPATH2));
0028     part->openUrl(url2);
0029     QCOMPARE(part->url(), url2);
0030 
0031     delete part;
0032     delete factory;
0033 }
0034 
0035 QTEST_MAIN(OktetaPartTest)
0036 
0037 #include "moc_oktetaparttest.cpp"