File indexing completed on 2024-12-01 09:46:09

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0004 //
0005 
0006 #include <QSignalSpy>
0007 
0008 #include "MapViewWidget.h"
0009 #include "TestUtils.h"
0010 
0011 namespace Marble
0012 {
0013 
0014 class MapViewWidgetTest : public QObject
0015 {
0016     Q_OBJECT
0017 
0018 private Q_SLOTS:
0019     void initTestCase();
0020 
0021     void setMapThemeId();
0022 
0023     void setProjection();
0024 };
0025 
0026 void MapViewWidgetTest::initTestCase()
0027 {
0028     qRegisterMetaType<Projection>( "Projection" );
0029 }
0030 
0031 void MapViewWidgetTest::setMapThemeId()
0032 {
0033     MapViewWidget widget;
0034     QSignalSpy spy( &widget, SIGNAL(mapThemeIdChanged(QString)) );
0035 
0036     widget.setMapThemeId(QString());
0037 
0038     QCOMPARE( spy.count(), 0 );
0039 
0040     widget.setMapThemeId( "foo/bar/bar.dgml" );
0041 }
0042 
0043 void MapViewWidgetTest::setProjection()
0044 {
0045     MapViewWidget widget;
0046     QSignalSpy spy( &widget, SIGNAL(projectionChanged(Projection)) );
0047 
0048     widget.setProjection( Spherical );
0049 
0050     QCOMPARE( spy.count(), 0 );
0051 
0052     widget.setProjection( Mercator );
0053 }
0054 
0055 }
0056 
0057 QTEST_MAIN( Marble::MapViewWidgetTest )
0058 
0059 #include "MapViewWidgetTest.moc"