./
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
0 / 59
0.0%
Branches:
0 / 59
0.0%
Functions:
0 / 7
0.0%

libs/imgui/src/eu/imgui/debug.cc
Line Branch Exec Source
1 #include "eu/imgui/debug.h"
2
3 #include "imgui.h"
4
5 namespace eu::imgui
6 {
7
8
9 ✗ void ImLog::begin()
10 {
11 ✗ messages.clear();
12 ✗ }
13
14
15 ✗ void ImLog::add(std::string m)
16 {
17 ✗ messages.emplace_back(std::move(m));
18 ✗ }
19
20 ✗ void ImLog::draw(LogStyle style)
21 {
22
0/3
✗ Branch 2 → 3 not taken.
✗ Branch 2 → 5 not taken.
✗ Branch 2 → 7 not taken.
✗ switch (style)
23 {
24 ✗ case LogStyle::basic:
25 ✗ draw_basic();
26 ✗ break;
27 ✗ case LogStyle::filter:
28 ✗ draw_filter();
29 ✗ break;
30 ✗ default:
31
0/2
✗ Branch 8 → 9 not taken.
✗ Branch 8 → 12 not taken.
✗ DIE("Unhandled style");
32 ✗ break;
33 }
34 ✗ }
35
36 ✗ void ImLog::draw_basic() const
37 {
38
0/2
✗ Branch 17 → 4 not taken.
✗ Branch 17 → 18 not taken.
✗ for (const auto& m : messages)
39 {
40
0/2
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 19 not taken.
✗ ImGui::TextUnformatted(m.c_str());
41 }
42 ✗ }
43
44 ✗ void ImLog::draw_filter()
45 {
46 ✗ filter.Draw("filter");
47
48
0/4
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 63 not taken.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 61 not taken.
✗ if (ImGui::BeginChild("scrolling", ImVec2(0, 0), ImGuiChildFlags_None, ImGuiWindowFlags_HorizontalScrollbar))
49 {
50
0/2
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 64 not taken.
✗ ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
51
0/2
✗ Branch 9 → 10 not taken.
✗ Branch 9 → 33 not taken.
✗ if (filter.IsActive())
52 {
53
0/2
✗ Branch 31 → 12 not taken.
✗ Branch 31 → 32 not taken.
✗ for (const auto& m : messages)
54 {
55 // todo(Gustav): optimize both filtering and clipper?
56 ✗ const char* line_start = m.c_str();
57 ✗ const char* line_end = m.c_str() + m.length() + 1;
58
0/4
✗ Branch 17 → 18 not taken.
✗ Branch 17 → 65 not taken.
✗ Branch 18 → 19 not taken.
✗ Branch 18 → 22 not taken.
✗ if (filter.PassFilter(line_start, line_end))
59 {
60
0/2
✗ Branch 19 → 20 not taken.
✗ Branch 19 → 65 not taken.
✗ ImGui::TextUnformatted(line_start, line_end);
61
0/2
✗ Branch 21 → 22 not taken.
✗ Branch 21 → 65 not taken.
✗ ImGui::TextUnformatted(m.c_str());
62 }
63 }
64 }
65 else
66 {
67
0/2
✗ Branch 33 → 34 not taken.
✗ Branch 33 → 71 not taken.
✗ ImGuiListClipper clipper;
68
69 using clipper_int = int;
70
0/8
✗ Branch 37 → 38 not taken.
✗ Branch 37 → 44 not taken.
✗ Branch 38 → 39 not taken.
✗ Branch 38 → 69 not taken.
✗ Branch 39 → 40 not taken.
✗ Branch 39 → 44 not taken.
✗ Branch 41 → 42 not taken.
✗ Branch 41 → 66 not taken.
✗ ASSERT(std::cmp_less(messages.size(), std::numeric_limits<clipper_int>::max()));
71
0/2
✗ Branch 45 → 46 not taken.
✗ Branch 45 → 69 not taken.
✗ clipper.Begin(static_cast<clipper_int>(messages.size()));
72
0/4
✗ Branch 55 → 56 not taken.
✗ Branch 55 → 69 not taken.
✗ Branch 56 → 47 not taken.
✗ Branch 56 → 57 not taken.
✗ while (clipper.Step())
73 {
74
0/2
✗ Branch 54 → 48 not taken.
✗ Branch 54 → 55 not taken.
✗ for (auto line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++)
75 {
76 ✗ const auto& m = messages[line_no];
77 ✗ const char* line_start = m.c_str();
78 ✗ const char* line_end = m.c_str() + m.length() + 1;
79
0/2
✗ Branch 52 → 53 not taken.
✗ Branch 52 → 69 not taken.
✗ ImGui::TextUnformatted(line_start, line_end);
80 }
81 }
82
0/2
✗ Branch 57 → 58 not taken.
✗ Branch 57 → 69 not taken.
✗ clipper.End();
83 ✗ }
84 ✗ ImGui::PopStyleVar();
85 }
86 ✗ ImGui::EndChild();
87 ✗ }
88
89
90 ✗ bool ImTweak::get_bool(const std::string& name)
91 {
92
0/2
✗ Branch 2 → 3 not taken.
✗ Branch 2 → 12 not taken.
✗ auto found = booleans.find(name);
93
0/2
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 8 not taken.
✗ if (found != booleans.end())
94 {
95 ✗ return found->second;
96 }
97
0/2
✗ Branch 8 → 9 not taken.
✗ Branch 8 → 12 not taken.
✗ booleans[name] = false;
98 ✗ return false;
99 }
100
101 ✗ void ImTweak::draw()
102 {
103 ✗ ImGui::PushID("booleans");
104
0/2
✗ Branch 12 → 5 not taken.
✗ Branch 12 → 13 not taken.
✗ for (auto& [key, check] : booleans)
105 {
106
0/2
✗ Branch 9 → 10 not taken.
✗ Branch 9 → 15 not taken.
✗ ImGui::Checkbox(key.c_str(), &check);
107 }
108 ✗ ImGui::PopID();
109 ✗ }
110
111
112 }
113