File indexing completed on 2024-12-29 05:08:32

0001 /*
0002  * This file is part of the KDE wacomtablet project. For copyright
0003  * information and license terms see the AUTHORS and COPYING files
0004  * in the top-level directory of this distribution.
0005  *
0006  * This program is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU General Public License as
0008  * published by the Free Software Foundation; either version 2 of
0009  * the License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License
0017  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #include "common/screenspace.h"
0021 
0022 #include <QtTest>
0023 
0024 using namespace Wacom;
0025 
0026 /**
0027  * @file testtabletarea.cpp
0028  *
0029  * @test UnitTest for the tablet area model class
0030  */
0031 class TestScreenSpace : public QObject
0032 {
0033     Q_OBJECT
0034 
0035 private slots:
0036     void testDesktop();
0037     void testOutput();
0038 };
0039 
0040 QTEST_MAIN(TestScreenSpace)
0041 
0042 void TestScreenSpace::testDesktop()
0043 {
0044     QString input = QLatin1String("desktop");
0045 
0046     ScreenSpace space(input);
0047 
0048     QVERIFY(space.getType() == ScreenSpace::ScreenSpaceType::Desktop);
0049     QCOMPARE(space.toString(), input);
0050     QVERIFY(space.isDesktop());
0051 }
0052 
0053 void TestScreenSpace::testOutput()
0054 {
0055     QString input = QLatin1String("HDMI-1");
0056 
0057     ScreenSpace space(input);
0058 
0059     QVERIFY(space.getType() == ScreenSpace::ScreenSpaceType::Output);
0060     QCOMPARE(space.toString(), input);
0061     QVERIFY(!space.isDesktop());
0062     QVERIFY(space.isMonitor());
0063 }
0064 
0065 #include "testscreenspace.moc"