GCC Code Coverage Report


Directory: ./
File: channeltester/RGBFill.cpp
Date: 2026-10-29 08:11:58
Exec Total Coverage
Lines: 53 54 98.1%
Functions: 5 5 100.0%
Branches: 30 46 65.2%

Line Branch Exec Source
1 /*
2 * This file is part of the Falcon Player (FPP) and is Copyright (C)
3 * 2013-2022 by the Falcon Player Developers.
4 *
5 * The Falcon Player (FPP) is free software, and is covered under
6 * multiple Open Source licenses. Please see the included 'LICENSES'
7 * file for descriptions of what files are covered by each license.
8 *
9 * This source file is covered under the LGPL v2.1 as described in the
10 * included LICENSE.LGPL file.
11 */
12
13 #include "fpp-pch.h"
14
15 #include "fpp-json.h"
16
17 #include "../log.h"
18
19 #include "RGBFill.h"
20
21 /*
22 *
23 */
24 55 TestPatternRGBFill::TestPatternRGBFill() :
25 55 m_color1(0),
26 55 m_color2(0),
27 55 m_color3(0),
28 55 m_color4(0),
29 55 m_channelsPerNode(3) {
30
1/2
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
55 LogExcess(VB_CHANNELOUT, "TestPatternRGBFill::TestPatternRGBFill()\n");
31
32
1/2
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
55 m_testPatternName = "RGBFill";
33 55 }
34
35 /*
36 *
37 */
38 100 TestPatternRGBFill::~TestPatternRGBFill() {
39 50 LogExcess(VB_CHANNELOUT, "TestPatternRGBFill::~TestPatternRGBFill()\n");
40 100 }
41
42 /*
43 *
44 */
45 58 int TestPatternRGBFill::Init(Json::Value config) {
46 58 m_configChanged = 0;
47
48
2/4
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
58 int color1 = JsonInt(config, "color1");
49
2/2
✓ Branch 0 taken 55 times.
✓ Branch 1 taken 3 times.
58 if (m_color1 != color1) {
50 55 m_color1 = color1;
51 55 m_configChanged = 1;
52 }
53
54
2/4
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
58 int color2 = JsonInt(config, "color2");
55
2/2
✓ Branch 0 taken 51 times.
✓ Branch 1 taken 7 times.
58 if (m_color2 != color2) {
56 51 m_color2 = color2;
57 51 m_configChanged = 1;
58 }
59
60
2/4
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
58 int color3 = JsonInt(config, "color3");
61
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 8 times.
58 if (m_color3 != color3) {
62 50 m_color3 = color3;
63 50 m_configChanged = 1;
64 }
65
66
2/4
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
58 int color4 = JsonInt(config, "color4");
67
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 53 times.
58 if (m_color4 != color4) {
68 5 m_color4 = color4;
69 5 m_configChanged = 1;
70 }
71
72
2/4
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
58 int cpn = JsonInt(config, "channelsPerNode", 3);
73
3/4
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
58 if (cpn != 3 && cpn != 4) {
74 ✗ cpn = 3;
75 }
76
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 52 times.
58 if (m_channelsPerNode != cpn) {
77 6 m_channelsPerNode = cpn;
78 6 m_configChanged = 1;
79 }
80
81
2/4
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
58 return TestPatternBase::Init(config);
82 }
83
84 /*
85 *
86 */
87 60 int TestPatternRGBFill::SetupTest(void) {
88 60 bzero(m_testData, m_channelCount);
89
90 60 char* c = m_testData;
91
92 // Stride is driven by the model/color order (3 for RGB, 4 for RGBW), not by
93 // whether the white value happens to be non-zero, so RGBW pixels stay aligned
94 // even when filling a pure color (W = 0).
95 //
96 // The channel set need not be a whole number of pixels - eight discrete
97 // channels ("151;167;...;263") tested as RGB is a channelCount of 8 with a
98 // stride of 3 - so the trailing partial pixel is filled too rather than
99 // left at the bzero() value, which used to leave those channels dark for
100 // the whole test.
101 60 const char colors[4] = { (char)m_color1, (char)m_color2, (char)m_color3, (char)m_color4 };
102 60 const int stride = m_channelsPerNode;
103
104
2/2
✓ Branch 0 taken 61620 times.
✓ Branch 1 taken 60 times.
61680 for (int i = 0; i < m_channelCount; i++) {
105 61620 *(c++) = colors[i % stride];
106 }
107
108
1/2
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
120 return TestPatternBase::SetupTest();
109 }
110
111 /*
112 *
113 */
114 58 void TestPatternRGBFill::DumpConfig(void) {
115 58 LogDebug(VB_CHANNELOUT, "TestPatternRGBFill::DumpConfig\n");
116 58 LogDebug(VB_CHANNELOUT, " color1 : %02x\n", m_color1);
117 58 LogDebug(VB_CHANNELOUT, " color2 : %02x\n", m_color2);
118 58 LogDebug(VB_CHANNELOUT, " color3 : %02x\n", m_color3);
119 58 LogDebug(VB_CHANNELOUT, " color4 : %02x\n", m_color4);
120 58 LogDebug(VB_CHANNELOUT, " channelsPerNode : %d\n", m_channelsPerNode);
121
122 58 TestPatternBase::DumpConfig();
123 58 }
124