GCC Code Coverage Report


Directory: ./
File: backends/qscreen/qscreenscreen.cpp
Date: 2023-04-20 22:59:23
Exec Total Coverage
Lines: 18 20 90.0%
Branches: 3 4 75.0%

Line Branch Exec Source
1 /*************************************************************************************
2 * Copyright 2014 Sebastian K├╝gler <sebas@kde.org> *
3 * *
4 * This library is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
8 * *
9 * This library is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with this library; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
17 *************************************************************************************/
18 #include "qscreenscreen.h"
19
20 #include "qscreenbackend.h"
21 #include "qscreenoutput.h"
22
23 #include <configmonitor.h>
24 #include <mode.h>
25
26 #include <QGuiApplication>
27 #include <QScreen>
28
29 using namespace Disman;
30
31 3 QScreenScreen::QScreenScreen(QScreenConfig* config)
32 3 : QObject(config)
33 {
34 3 }
35
36 QScreenScreen::~QScreenScreen()
37 {
38 }
39
40 20 ScreenPtr QScreenScreen::toDismanScreen() const
41 {
42 20 Disman::ScreenPtr dismanScreen(new Disman::Screen);
43 20 updateDismanScreen(dismanScreen);
44 20 return dismanScreen;
45 }
46
47 20 void QScreenScreen::updateDismanScreen(ScreenPtr& screen) const
48 {
49
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
20 if (!screen) {
50 return;
51 }
52
53 20 auto primary = QGuiApplication::primaryScreen();
54
55
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 4 times.
20 if (primary) {
56 16 QSize _s = primary->availableVirtualGeometry().size();
57
58 16 screen->set_current_size(_s);
59 16 screen->set_id(1);
60 16 screen->set_max_size(_s);
61 16 screen->set_min_size(_s);
62 16 screen->set_current_size(_s);
63 16 screen->set_max_outputs_count(QGuiApplication::screens().count());
64 }
65 }
66