File indexing completed on 2024-05-12 16:45:27
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr 0003 * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 ***************************************************************************/ 0006 /** @file 0007 * This file is a test for SKGWidgetCollectionDesignerPlugin component. 0008 * 0009 * @author Stephane MANKOWSKI / Guillaume DE BURE 0010 */ 0011 #include "skgtestwidgetcollection.h" 0012 0013 #include <qicon.h> 0014 0015 #include "skggraphicsscene.h" 0016 #include "skgtestmacro.h" 0017 #include "skgwebview.h" 0018 #include "skgwidgetcollectiondesignerplugin.h" 0019 #include "skgzoomselector.h" 0020 0021 void SKGTESTWidgetCollection::Test() 0022 { 0023 KLocalizedString::setApplicationDomain("skrooge"); 0024 0025 SKGWidgetCollectionDesignerPlugin col(this); 0026 QList<QDesignerCustomWidgetInterface*> widgets = col.customWidgets(); 0027 for (int i = 0; i < widgets.count(); ++i) { 0028 QDesignerCustomWidgetInterface* widget = widgets.at(i); 0029 QCOMPARE(widget != nullptr, true); 0030 0031 widget->isContainer(); 0032 QCOMPARE(widget->isInitialized(), false); 0033 widget->initialize(nullptr); 0034 QCOMPARE(widget->isInitialized(), true); 0035 widget->icon(); 0036 QCOMPARE(widget->domXml() != QLatin1String(""), true); 0037 QCOMPARE(widget->group(), QStringLiteral("SKG Widgets")); 0038 QCOMPARE(widget->includeFile() != QLatin1String(""), true); 0039 QCOMPARE(widget->name() != QLatin1String(""), true); 0040 QCOMPARE(widget->toolTip() != QLatin1String(""), true); 0041 QCOMPARE(widget->whatsThis() != QLatin1String(""), true); 0042 QCOMPARE(widget->createWidget(nullptr) != nullptr, true); 0043 } 0044 0045 // Test zoom 0046 SKGZoomSelector zoom(nullptr); 0047 zoom.zoomIn(); 0048 zoom.zoomOut(); 0049 zoom.initializeZoom(); 0050 0051 // Test web view 0052 SKGWebView web(nullptr); 0053 web.onZoomIn(); 0054 web.onZoomOut(); 0055 web.exportInFile(SKGTest::getTestPath(QStringLiteral("OUT")) % "/skgtestwidgetcollection/export.pdf"); 0056 web.exportInFile(SKGTest::getTestPath(QStringLiteral("OUT")) % "/skgtestwidgetcollection/export.html"); 0057 web.exportInFile(SKGTest::getTestPath(QStringLiteral("OUT")) % "/skgtestwidgetcollection/export.jpg"); 0058 0059 SKGGraphicsScene graphScene; 0060 } 0061 0062 QTEST_MAIN(SKGTESTWidgetCollection) 0063