GCC Code Coverage Report


Directory: ./
File: channeltester/OutputTester.cpp
Date: 2026-12-01 12:27:28
Exec Total Coverage
Lines: 33 37 89.2%
Functions: 5 7 71.4%
Branches: 31 52 59.6%

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 "../common.h"
18 #include "../log.h"
19
20 #include "OutputTester.h"
21 #include "channeloutput/ChannelOutputSetup.h"
22
23
1/2
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
54 OutputTester::OutputTester() {
24 54 }
25 212 OutputTester::~OutputTester() {
26 212 }
27 54 int OutputTester::Init(Json::Value config) {
28 // a test (re)started counts its cycles from 0: the string testers and the
29 // outputs key their start off cycle 0
30 54 cycleCount = 0;
31
1/2
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
54 startMS = GetMonotonicTimeMS();
32 54 outputTypes.clear();
33
2/4
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 54 times.
✗ Branch 3 not taken.
108 testType = JsonInt(config, "type");
34
3/6
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 54 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 54 times.
✗ Branch 5 not taken.
162 std::string s = JsonString(config, "outputs");
35
7/10
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 50 times.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 50 times.
54 if (s != "--ALL--" && s != "") {
36
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 outputTypes.insert(s);
37 }
38
3/4
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 50 times.
54 if (config.isMember("config")) {
39
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 extraConfig = config["config"];
40 }
41
2/4
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 54 times.
✗ Branch 3 not taken.
108 return TestPatternBase::Init(config);
42 54 }
43 ✗ int OutputTester::SetupTest(void) {
44 ✗ return TestPatternBase::SetupTest();
45 }
46 ✗ void OutputTester::CycleData(void) {
47 // cycled in OverlayTestData(): TestPatternBase only cycles a pattern with
48 // channels of its own to copy, and this one has none -- each output draws
49 // its own test
50 ✗ }
51 5238 int OutputTester::OverlayTestData(char* channelData) {
52
2/2
✓ Branch 0 taken 5082 times.
✓ Branch 1 taken 156 times.
5238 if (m_testEnabled) {
53 5082 uint64_t now = GetMonotonicTimeMS(); // the same clock as startMS, which never steps
54
3/4
✓ Branch 0 taken 5082 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4039 times.
✓ Branch 3 taken 1043 times.
5082 if (m_cycleMS > 0 && now >= startMS + m_cycleMS) {
55 4039 cycleCount++;
56 4039 startMS = now;
57 }
58 5082 int offset = now - startMS;
59 5082 float pct = offset;
60 5082 pct /= m_cycleMS;
61
2/4
✓ Branch 0 taken 5082 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5082 times.
✗ Branch 3 not taken.
5082 OverlayOutputTestData(outputTypes, (unsigned char*)channelData, cycleCount, pct, testType, extraConfig);
62 } else {
63
2/4
✓ Branch 0 taken 156 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 156 times.
✗ Branch 3 not taken.
156 OverlayOutputTestData(outputTypes, (unsigned char*)channelData, 0, 0, 0, extraConfig);
64 }
65 5238 return TestPatternBase::OverlayTestData(channelData);
66 }
67 54 void OutputTester::DumpConfig(void) {
68 54 LogDebug(VB_CHANNELOUT, "OutputTester::DumpConfig\n");
69 54 LogDebug(VB_CHANNELOUT, " testType : %d\n", testType);
70 54 TestPatternBase::DumpConfig();
71 54 }
72