File indexing completed on 2024-04-14 04:35:56

0001 /*
0002     SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include <map/loader/mapdata.h>
0008 
0009 #include <QTest>
0010 
0011 using namespace KOSMIndoorMap;
0012 
0013 class MapLevelTest: public QObject
0014 {
0015     Q_OBJECT
0016 private Q_SLOTS:
0017     void testAboveBelow_data()
0018     {
0019         QTest::addColumn<int>("level");
0020         QTest::addColumn<int>("above");
0021         QTest::addColumn<int>("below");
0022 
0023         QTest::newRow("0.3") << 3 << 10 << 0;
0024         QTest::newRow("1.7") << 17 << 20 << 10;
0025         QTest::newRow("-0.7") << -7 << 0 << -10;
0026         QTest::newRow("-1.5") << -15 << -10 << -20;
0027     }
0028 
0029     void testAboveBelow()
0030     {
0031         QFETCH(int, level);
0032         QFETCH(int, above);
0033         QFETCH(int, below);
0034 
0035         MapLevel ml(level);
0036         QVERIFY(!ml.isFullLevel());
0037         QCOMPARE(ml.fullLevelAbove(), above);
0038         QCOMPARE(ml.fullLevelBelow(), below);
0039     }
0040 };
0041 
0042 QTEST_GUILESS_MAIN(MapLevelTest)
0043 
0044 #include "mapleveltest.moc"