• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mcallegari / qlcplus / 11388022654

17 Oct 2024 03:21PM UTC coverage: 31.573% (-0.4%) from 31.983%
11388022654

Pull #1422

github

web-flow
Merge 4147c937e into 5f77fc96f
Pull Request #1422: RgbScript make stage colors available to scripts

56 of 908 new or added lines in 11 files covered. (6.17%)

12 existing lines in 8 files now uncovered.

14057 of 44522 relevant lines covered (31.57%)

26666.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

14.58
/engine/src/rgbplain.cpp
1
/*
2
  Q Light Controller Plus
3
  rgbplain.cpp
4

5
  Copyright (c) Massimo Callegari
6

7
  Licensed under the Apache License, Version 2.0 (the "License");
8
  you may not use this file except in compliance with the License.
9
  You may obtain a copy of the License at
10

11
      http://www.apache.org/licenses/LICENSE-2.0.txt
12

13
  Unless required by applicable law or agreed to in writing, software
14
  distributed under the License is distributed on an "AS IS" BASIS,
15
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
  See the License for the specific language governing permissions and
17
  limitations under the License.
18
*/
19

20
#include <QXmlStreamReader>
21
#include <QXmlStreamWriter>
22
#include <QDebug>
23

24
#include "rgbplain.h"
25
#include "doc.h"
26

27
RGBPlain::RGBPlain(Doc * doc)
7✔
28
    : RGBAlgorithm(doc)
7✔
29
{
30
}
7✔
31

32
RGBPlain::RGBPlain(const RGBPlain& a, QObject *parent)
×
33
    : QObject(parent)
34
    , RGBAlgorithm(a.doc())
×
35
{
36
}
×
37

38
RGBPlain::~RGBPlain()
7✔
39
{
40
}
7✔
41

42
RGBAlgorithm* RGBPlain::clone() const
×
43
{
44
    RGBPlain* plain = new RGBPlain(*this);
×
45
    return static_cast<RGBAlgorithm*> (plain);
×
46
}
47

48
/****************************************************************************
49
 * RGBAlgorithm
50
 ****************************************************************************/
51

52
int RGBPlain::rgbMapStepCount(const QSize& size)
×
53
{
54
    Q_UNUSED(size);
55
    return 1;
×
56
}
57

NEW
58
void RGBPlain::rgbMapSetColors(QVector<uint> &colors)
×
59
{
60
    Q_UNUSED(colors);
NEW
61
}
×
62

UNCOV
63
void RGBPlain::rgbMap(const QSize& size, uint rgb, int step, RGBMap &map)
×
64
{
65
    Q_UNUSED(step);
66
    map.resize(size.height());
×
67
    for (int y = 0; y < size.height(); y++)
×
68
    {
69
        map[y].resize(size.width());
×
70
        map[y].fill(rgb);
×
71
    }
72
}
×
73

74
QString RGBPlain::name() const
6✔
75
{
76
    return QString("Plain Color");
6✔
77
}
78

79
QString RGBPlain::author() const
×
80
{
81
    return QString("Massimo Callegari");
×
82
}
83

84
int RGBPlain::apiVersion() const
×
85
{
86
    return 1;
×
87
}
88

NEW
89
void RGBPlain::setColors(QVector<QColor> colors)
×
90
{
NEW
91
    RGBAlgorithm::setColors(colors);
×
92
}
×
93

94
RGBAlgorithm::Type RGBPlain::type() const
×
95
{
96
    return RGBAlgorithm::Plain;
×
97
}
98

99
int RGBPlain::acceptColors() const
×
100
{
101
    return 1; // only start color is accepted
×
102
}
103

104
bool RGBPlain::loadXML(QXmlStreamReader &root)
×
105
{
106
    if (root.name() != KXMLQLCRGBAlgorithm)
×
107
    {
108
        qWarning() << Q_FUNC_INFO << "RGB Algorithm node not found";
×
109
        return false;
×
110
    }
111

112
    if (root.attributes().value(KXMLQLCRGBAlgorithmType).toString() != KXMLQLCRGBPlain)
×
113
    {
114
        qWarning() << Q_FUNC_INFO << "RGB Algorithm is not Plain";
×
115
        return false;
×
116
    }
117

118
    root.skipCurrentElement();
×
119

120
    return true;
×
121
}
122

123
bool RGBPlain::saveXML(QXmlStreamWriter *doc) const
×
124
{
125
    Q_ASSERT(doc != NULL);
126

127
    doc->writeStartElement(KXMLQLCRGBAlgorithm);
×
128
    doc->writeAttribute(KXMLQLCRGBAlgorithmType, KXMLQLCRGBPlain);
×
129
    doc->writeEndElement();
×
130

131
    return true;
×
132
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc