GCC Code Coverage Report


Directory: src/gate/
File: src/gate/ui/tests/gateui_cpp_test/gateui_cpp_tests.cpp
Date: 2026-08-06 22:46:24
Exec Total Coverage
Lines: 377 416 90.6%
Functions: 14 22 63.6%
Branches: 430 882 48.8%

Line Branch Exec Source
1 /* GATE PROJECT LICENSE:
2 +----------------------------------------------------------------------------+
3 | Copyright(c) 2018-2026, Stefan Meislinger |
4 | All rights reserved. |
5 | |
6 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met:|
8 | |
9 | 1. Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. |
11 | 2. Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. |
14 | |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"|
16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
25 | THE POSSIBILITY OF SUCH DAMAGE. |
26 +----------------------------------------------------------------------------+
27 */
28
29
30 #include "gate/gatemain.h"
31 #include "gate/results.h"
32
33 #include "gate/applications.hpp"
34 #include "gate/maps.hpp"
35 #include "gate/strings.hpp"
36 #include "gate/streams.hpp"
37 #include "gate/times.hpp"
38 #include "gate/files.hpp"
39 #include "gate/wrappers.hpp"
40 #include "gate/utilities.hpp"
41 #include "gate/numbers.hpp"
42 #include "gate/system/os.hpp"
43
44 #include "gate/ui/gateui.hpp"
45 #include "gate/ui/forms.hpp"
46 #include "gate/ui/buttons.hpp"
47 #include "gate/ui/labels.hpp"
48 #include "gate/ui/panels.hpp"
49 #include "gate/ui/textboxes.hpp"
50 #include "gate/ui/treeviews.hpp"
51 #include "gate/ui/listviews.hpp"
52 #include "gate/ui/splitters.hpp"
53 #include "gate/ui/paintsurfaces.hpp"
54 #include "gate/ui/dialogs.hpp"
55 #include "gate/ui/toolbars.hpp"
56 #include "gate/ui/statusbars.hpp"
57 #include "gate/ui/checkboxes.hpp"
58 #include "gate/ui/comboboxes.hpp"
59 #include "gate/ui/timers.hpp"
60 #include "gate/ui/tabs.hpp"
61
62 #include "gate/graphics/pixmapimages.hpp"
63 #include "gate/icons/application.xpm"
64 #include "gate/icons/refresh.xpm"
65 #include "gate/icons/folder.xpm"
66 #include "gate/icons/cut.xpm"
67 #include "gate/icons/copy.xpm"
68 #include "gate/icons/paste.xpm"
69 #include "gate/icons/cancel.xpm"
70
71 #if defined(GATE_COMPILER_MSVC) && defined(GATE_LEAK_DETECTION) && defined(GATE_SYS_WIN) && !defined(GATE_SYS_WINCE) && (GATE_ARCH != GATE_ARCH_ARM32) && (GATE_ARCH != GATE_ARCH_ARM64)
72 # include <vld.h>
73 #endif
74
75 static gate::bool_t run_app_tests = false;
76 static gate::bool_t run_app_tests_no_close = false;
77
78 namespace gate
79 {
80 namespace apps
81 {
82
83 class GATE_API_LOCAL VTest : public App
84 {
85 private:
86 Optional<ui::Host> uihost;
87
88 ui::Form form;
89 ui::Menu menu;
90 ui::Menu menuFile;
91 ui::Menu menuHelp;
92
93 ui::Toolbar tb;
94 ui::Treeview treeview;
95 ui::Listview listview;
96 ui::TabControl tabs;
97 ui::Listbox lstbox;
98 ui::Textbox txtMulti;
99 ui::Statusbar sbStatus;
100
101 ui::Label lbl;
102 ui::Button btn;
103 ui::Textbox txtSimple;
104 ui::Checkbox chk;
105 ui::Itemview iv;
106 ui::Combobox cmb;
107 ui::Progressbar pgb;
108 ui::PaintSurface painter;
109
110 ui::FramePanel frame;
111 ui::Button btn2;
112
113 ui::Layout layout;
114
115 ui::Layout tabLayout;
116 ui::Layout tabLayout2;
117 ui::Layout tabLayout2Frame;
118
119 ui::Timer testTimer1;
120 gate::enumint_t testState;
121
122 graph::RasterImage imageApplication;
123 graph::RasterImage imageFolder;
124
125 static gate::uint16_t const MenuKey_FileInfo = 0x01;
126 static gate::uint16_t const MenuKey_FileExit = 0x0f;
127 static gate::uint16_t const MenuKey_HelpAbout = 0x91;
128
129 4 graph::RasterImage& getAppImage()
130 {
131
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 3 times.
4 if (this->imageApplication.empty())
132 {
133 1 graph::PixmapImages::parse(this->imageApplication, gate_icon_application_xpm);
134 }
135 4 return this->imageApplication;
136 }
137
138 1 graph::RasterImage& getFolderImage()
139 {
140
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 if (this->imageFolder.empty())
141 {
142 1 graph::PixmapImages::parse(this->imageFolder, gate_icon_folder_xpm);
143 }
144 1 return this->imageFolder;
145 }
146
147 void commandExit()
148 {
149 this->uihost->quit();
150 }
151
152 void commandHelp()
153 {
154 ui::MessageDialog msg;
155 msg.show(this->form, "Sample message text", "Sample title");
156 }
157
158 void Form_Closed(ui::Form* sender, ui::EventArg* arg)
159 {
160 this->commandExit();
161 }
162
163 1 void btn_Clicked(ui::Button* sender, ui::EventArg* arg)
164 {
165
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String oldText = this->btn.getText();
166
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String txt = this->txtSimple.getText();
167
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 if (txt != oldText)
168 {
169
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->btn.setText(txt);
170 }
171 1 }
172
173 1 void chk_Clicked(ui::Checkbox* sender, ui::EventArg* arg)
174 {
175
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 static StaticString const checkedText = "Checkbox is checked";
176
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 static StaticString const uncheckedText = "Checkbox is unchecked";
177
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 bool_t const checked = this->chk.isChecked();
178
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
2 String const newText = checked ? checkedText : uncheckedText;
179
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String oldText = this->chk.getText();
180
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 if (oldText != newText)
181 {
182
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->chk.setText(newText);
183 }
184 1 }
185
186 void btn2_Clicked(ui::Button* sender, ui::EventArg* arg)
187 {
188 ui::MessageDialog msgDlg;
189 ui::InputDialog inDlg;
190 Optional<String> inputText = inDlg.show(this->form, "Tell me:", "Input Dialog");
191 if(inputText.empty())
192 {
193 msgDlg.show(this->form, "No Input!", "Warning");
194 }
195 else
196 {
197 msgDlg.show(this->form, *inputText, "Your Input:");
198 }
199 }
200
201 void tb_Clicked(ui::Toolbar* sender, ui::Toolbar::ToolbarEventArg* arg)
202 {
203 }
204 2 void treeview_Select(ui::Treeview* sender, ui::Treeview::ItemArg* arg)
205 {
206
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 String text = this->treeview.getItemText(arg->Item);
207
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 this->treeview.getItemParam(arg->Item);
208
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 this->sbStatus.setText(text);
209 2 }
210 void listview_Select(ui::Listview* sender, ui::Listview::IndexArg* arg)
211 {
212 String text = this->listview.getItemText(arg->ListIndex);
213 this->listview.getItemParam(arg->ListIndex);
214 this->sbStatus.setText(text);
215 }
216
217 2 void painter_Paint(ui::PaintSurface* sender, ui::PaintSurface::PaintEventArg* arg)
218 {
219
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 arg->Context.rect(arg->DrawRectangle, ui::Color::Blue, 0, ui::Color::Blue);
220 2 int32_t w = arg->DrawRectangle.getWidth();
221 2 int32_t h = arg->DrawRectangle.getHeight();
222 2 int32_t mx = w / 2;
223 2 int32_t my = h / 2;
224
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 ArrayList<ui::Point> points;
225 points
226
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 << ui::Point(0, my)
227
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 << ui::Point(mx, 0)
228
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 << ui::Point(w, my)
229
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 << ui::Point(mx, h)
230
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 << ui::Point(0, my)
231 ;
232
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 arg->Context.polygon(points.toArray(), ui::Color::Yellow, 2);
233 try {
234
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 arg->Context.getPixel(ui::Point(mx, my));
235
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 } catch(...) { }
236
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 arg->Context.setPixel(ui::Point(mx, my), ui::Color::White);
237
1/2
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 arg->Context.line(ui::Point(0, my), ui::Point(w, my), ui::Color::Yellow, 2);
238
1/2
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 arg->Context.line(ui::Point(mx, 0), ui::Point(mx, h), ui::Color::Yellow, 2);
239
240
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 graph::RasterImage& image = this->getAppImage();
241 {
242
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 ui::Graphics imageGraph(*this->uihost, image);
243 2 ui::Graphics virtualGraph(*this->uihost,
244 4 static_cast<uint32_t>(imageGraph.getWidth()),
245
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
2 static_cast<uint32_t>(imageGraph.getHeight()));
246
1/2
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 virtualGraph.drawEx(imageGraph);
247
1/2
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 arg->Context.draw(imageGraph, ui::Point(mx, my));
248 }
249 {
250
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 ui::Graphics controlGraph(*sender);
251 }
252
253
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 ui::Font font = this->uihost->getDefaultFont(ui::Host::FontType_Standard);
254
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 font.setColor(ui::Color::White);
255
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
2 static const StaticString text = "Hello";
256 static const char_32_t c32 = 'A';
257
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 arg->Context.getCharWidths(font, &c32, 1);
258
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 ui::Size sz = arg->Context.getTextSize(font, text);
259 2 ui::Position pos(mx - sz.width, my - sz.height, sz.width, sz.height);
260
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 arg->Context.print(font, text, pos);
261
262 {
263
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
4 ui::Graphics virtualGraph(*this->uihost, image.getWidth(), image.getHeight(), 24);
264
1/2
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 virtualGraph.drawImage(image);
265
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
2 virtualGraph.rect(ui::Position(0, 0, image.getWidth() - 1, image.getHeight() - 1), ui::Color::Red, 2);
266
1/4
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
2 virtualGraph.polygon(points.toArray(), ui::Color::Red, 1, ui::Color::Yellow);
267 }
268 }
269
270 void handleMenuAction(gate_uint16_t menuid)
271 {
272 if (menuid == MenuKey_FileExit) { this->commandExit(); }
273 else if (menuid == MenuKey_FileInfo) { this->commandHelp(); }
274 else if (menuid == MenuKey_HelpAbout) { this->commandHelp(); }
275 }
276
277 void Form_Menu(ui::Form* sender, ui::MenuArg* arg)
278 {
279 this->handleMenuAction(arg->MenuEntry.id);
280 }
281
282 3 void useControlProperties(ui::Control& ctrl)
283 {
284
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 if (ctrl.isCreated())
285 {
286
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 ui::Position pos = ctrl.getPosition();
287
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 ui::Size sz = ctrl.getSize();
288
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 ctrl.setPosition(pos);
289
290
2/4
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
3 ctrl.setEnabled(ctrl.isEnabled());
291
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 ctrl.isVisible();
292
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 ctrl.setVisible(true);
293
2/4
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
3 if (ctrl.isFocused())
294 {
295 ctrl.setFocus();
296 }
297 }
298 3 }
299
300 4 void timer1_Elapsed(ui::Timer* sender, ui::Timer::TimerArg* arg)
301 {
302 4 gate::enumint_t const state = ++this->testState;
303
304
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
4 if (state == 1)
305 {
306
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 useControlProperties(this->txtSimple);
307
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 useControlProperties(this->btn);
308
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 useControlProperties(this->chk);
309
310
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->txtSimple.setText("Hello");
311
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String lblText = this->lbl.getText();
312
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lbl.setText(lblText);
313
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lbl.performAction(ui::Label::Action_Activate);
314
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->btn.performAction(ui::Button::Action_Activate);
315
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->txtMulti.setText("Hello World");
316
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.getCurrentColumn();
317
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.getCurrentLine();
318
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.setSelection(2, 5);
319 1 gate_uint32_t l = 0, r = 0;
320
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.getSelection(l, r);
321
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.getSelectionText();
322
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->txtMulti.replaceSelection("110_");
323
324 {
325 uint32_t mini, maxi;
326
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mini = this->pgb.getMinimum();
327
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 maxi = this->pgb.getMaximum();
328
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.getMinMax(mini, maxi);
329
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.getValue();
330
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.setValue((mini + maxi) / 2);
331
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.setPercent(50.0f);
332 }
333
334 {
335
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->chk.setChecked(!this->chk.isChecked());
336
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->chk.performAction(ui::Checkbox::Action_Activate);
337 }
338
339 {
340
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t const cnt = this->cmb.getItemCount();
341
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.setSelectedItem(cnt - 1);
342 1 gate_size_t selIndex = 0;
343 2 String selText;
344 1 void* selParam = NULL;
345 1 this->cmb.getSelectedItem(&selIndex, &selText, &selParam);
346
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 selParam = this->cmb.getItemParam(selIndex);
347
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 selText = this->cmb.getItemText(selIndex);
348
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String const newText = selText + "!";
349
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.setItemText(selIndex, newText);
350
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.setSelectedItem(cnt - 1);
351
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.performAction(ui::Combobox::Action_Activate);
352
353 1 gate_size_t foundIndex = 0;
354
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.findItemParam(selParam, foundIndex);
355 }
356
357 {
358
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_size_t index = this->lstbox.getItemCount();
359
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.setSelectedItem(1);
360
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.getSelectedItem(index);
361
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String const text = this->lstbox.getItemText(index);
362
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String const newText = text + "!";
363
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.setItemText(index, newText);
364
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 void* const param = this->lstbox.getItemParam(index);
365
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.findItemParam(param);
366 }
367
368 {
369
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 if (this->listview.getItemCount() > 0)
370 {
371 1 size_t ndx = 0;
372
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.setItemSelected(ndx, true);
373
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.getSelectedItem(ndx);
374
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String oldText = this->listview.getItemText(ndx, 1);
375
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 String newText = oldText + "!";
376
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.setItemText(ndx, newText, 1);
377
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.getSelectedItems();
378
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.setItemChecked(ndx, false);
379
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.getCheckedItems();
380
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 void* param = this->listview.getItemParam(ndx);
381
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.findItemParam(param);
382
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->listview.insertItem(0, "Prequel");
383 }
384 }
385
386 {
387
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.setFocus();
388
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Array<ui::Treeview::item_t> children = this->treeview.getItemChildren(0);
389
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 for(size_t ndx = 0; ndx != children.length(); ++ndx)
390 {
391 1 ui::Treeview::item_t parent = 0;
392 1 ui::Treeview::item_t child = children[ndx];
393
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String oldText = this->treeview.getItemText(child);
394
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String newText = oldText + "!";
395
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.setItemText(child, newText);
396
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.getItemParam(child);
397
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.getParentItem(child, parent);
398
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.isItemExpanded(child);
399
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.selectItem(child);
400
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.getSelectedItem(child);
401
402
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.performAction(ui::Treeview::Action_Activate);
403
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.performAction(ui::Treeview::Action_ContextMenu);
404 }
405 }
406
407 {
408
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->iv.setFocus();
409
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t cnt = this->iv.getItemCount();
410
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (size_t ndx = 0; ndx != cnt; ++ndx)
411 {
412
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 this->iv.getItemTitle(ndx);
413
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 this->iv.getItemSubtitle(ndx);
414
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 this->iv.getItemAddiontialText(ndx);
415
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 void* param = this->iv.getItemParam(ndx);
416
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 gate::size_t index = this->iv.findItemParam(param);
417 }
418 }
419
420
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->form.refresh();
421 }
422
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
3 else if (state == 2)
423 {
424 1 size_t const tabCount = this->tabs.getTabCount();
425
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (tabCount > 0)
426 {
427 1 this->tabs.setSelected(0);
428
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (size_t ndx = 0; ndx != tabCount; ++ndx)
429 {
430
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
8 String oldText = this->tabs.getTabText(ndx);
431
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
8 String newText = oldText + "!";
432
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 this->tabs.setTabText(ndx, newText);
433 }
434 1 size_t selected = this->tabs.getSelected();
435
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (selected < tabCount)
436 {
437 1 this->tabs.setSelected(selected + 1);
438 }
439 }
440 }
441
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 else if (state == 3)
442 {
443 1 this->tabs.setSelected(3);
444 1 this->painter.redraw();
445 }
446 else
447 {
448 1 sender->stop();
449
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (!run_app_tests_no_close)
450 {
451 1 this->uihost->quit();
452 }
453 }
454 4 }
455
456 public:
457 1 VTest()
458
28/56
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 1 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 1 times.
✗ Branch 37 not taken.
✓ Branch 39 taken 1 times.
✗ Branch 40 not taken.
✓ Branch 42 taken 1 times.
✗ Branch 43 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 1 times.
✗ Branch 49 not taken.
✓ Branch 51 taken 1 times.
✗ Branch 52 not taken.
✓ Branch 54 taken 1 times.
✗ Branch 55 not taken.
✓ Branch 57 taken 1 times.
✗ Branch 58 not taken.
✓ Branch 60 taken 1 times.
✗ Branch 61 not taken.
✓ Branch 63 taken 1 times.
✗ Branch 64 not taken.
✓ Branch 66 taken 1 times.
✗ Branch 67 not taken.
✓ Branch 69 taken 1 times.
✗ Branch 70 not taken.
✓ Branch 72 taken 1 times.
✗ Branch 73 not taken.
✓ Branch 75 taken 1 times.
✗ Branch 76 not taken.
✓ Branch 78 taken 1 times.
✗ Branch 79 not taken.
✓ Branch 81 taken 1 times.
✗ Branch 82 not taken.
✓ Branch 84 taken 1 times.
✗ Branch 85 not taken.
1 : testState(0)
459 {
460
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menuFile.add("Info", MenuKey_FileInfo);
461
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menuFile.addSeparator();
462
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menuFile.add("Exit", MenuKey_FileExit);
463
464
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menuHelp.add("About", MenuKey_HelpAbout);
465
466
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menu.add("File", 0, 0, &menuFile);
467
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menu.add("Help", 0, 0, &menuHelp);
468
469
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->form.MenuEvent += ui::Form::MenuEventHandler(this, &VTest::Form_Menu);
470
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->btn.ClickEvent += ui::Button::ClickEventHandler(this, &VTest::btn_Clicked);
471
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->chk.ClickEvent += ui::Checkbox::ClickEventHandler(this, &VTest::chk_Clicked);
472
473
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->btn2.ClickEvent += ui::Button::ClickEventHandler(this, &VTest::btn2_Clicked);
474
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->tb.ClickEvent += ui::Toolbar::ClickEventHandler(this, &VTest::tb_Clicked);
475
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->treeview.SelectEvent += ui::Treeview::SelectEventHandler(this, &VTest::treeview_Select);
476
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->listview.SelectEvent += ui::Listview::SelectEventHandler(this, &VTest::listview_Select);
477
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->painter.PaintEvent += ui::PaintSurface::PaintEventHandler(this, &VTest::painter_Paint);
478
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->testTimer1.IntervalEvent += ui::Timer::IntervalEventHandler(this, &VTest::timer1_Elapsed);
479 1 }
480 2 ~VTest() noexcept
481 2 {
482 2 }
483
484 1 virtual void onInit()
485 {
486
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->uihost.emplace<uintptr_t const>(this->getHandle());
487
488
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.clear();
489
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setBorder(1);
490
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setRowSpace(3);
491
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setColumnSpace(3);
492
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t colLeft = this->layout.addColumn(ui::Layout::Type_UnitScale, 8.0f);
493
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t colMid = this->layout.addColumn();
494
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t colRight = this->layout.addColumn(ui::Layout::Type_Percent, 25.0f);
495
496
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t rowTop = this->layout.addRow(ui::Layout::Type_UnitScale, 2.00f);
497
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t rowData1 = this->layout.addRow();
498
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t rowData2 = this->layout.addRow();
499
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t rowBottom = this->layout.addRow(ui::Layout::Type_UnitScale, 1.00f);
500
501
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->tb, rowTop, colLeft, 1, 3);
502
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->treeview, rowData1, colLeft);
503
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->listview, rowData2, colLeft);
504
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->tabs, rowData1, colMid, 2, 1);
505
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->lstbox, rowData1, colRight);
506
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->txtMulti, rowData2, colRight);
507
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->sbStatus, rowBottom, colLeft, 1, 3);
508
509
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->form.CloseEvent += ui::Form::CloseEventHandler(this, &VTest::Form_Closed);
510
511
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->form.create(*this->uihost, NULL, String::createStaticFrom("vTest"),
512 1 ui::Form::Flag_Enabled | ui::Form::Flag_Resizable | ui::Form::Flag_Maximizable | ui::Form::Flag_Minimizable
513 //| ui::Form::Flag_Visible
514 );
515
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->form.setMenu(&this->menu);
516
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ui::Host::getHost(this->form);
517
518
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->uihost->getLineHeight();
519
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->uihost->getControlHeight();
520
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->uihost->getUnitLength();
521
522 1 ui::Position stdPos(10, 10, 10, 10);
523
524
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tb.create(this->form, stdPos);
525 {
526
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ui::RasterImage& image = this->getAppImage();
527
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tb.add(image, NULL);
528
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tb.addSeparator();
529 }
530
531
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 this->sbStatus.create(this->form, ui::Position(10, 10, 10, 10), "StatusBAR");
532
533
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.create(this->form, stdPos, "Hello" GATE_STR_NEWLINE "world",
534
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ui::Textbox::Flag_Enabled | ui::Textbox::Flag_Visible | ui::Textbox::Flag_Multiline);
535
536 {
537
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.create(this->form, stdPos);
538
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.removeAllItems();
539
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->lstbox.addItem("Hello");
540
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->lstbox.addItem("World");
541
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 1 times.
26 for (uint32_t n = 0; n < 25; ++n)
542 {
543
3/6
✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 25 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 25 times.
✗ Branch 8 not taken.
25 this->lstbox.addItem("Entry #" + numbers::to_string(n));
544 }
545
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
6 for (uint32_t n = 0; n < 5; ++n)
546 {
547
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 size_t count = this->lstbox.getItemCount();
548
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 this->lstbox.removeItem(count - 1);
549 }
550 }
551
552 {
553
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.create(this->form,
554 ui::Position(10, 10, 10, 10),
555 1 gate::ui::Treeview::Flag_Visible | gate::ui::Treeview::Flag_Enabled | gate::ui::Treeview::Flag_Icons
556 );
557
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 graph::RasterImage& folderImage = this->getFolderImage();
558
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 intptr_t folderIconIndex = this->treeview.addIcon(folderImage);
559
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 ui::Treeview::item_t root = this->treeview.addItem(NULL, "MyRoot", NULL, folderIconIndex);
560
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->treeview.addItem(&root, "Sub1");
561
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->treeview.addItem(&root, "Sub2");
562
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 ui::Treeview::item_t s3 = this->treeview.addItem(&root, "Sub3");
563
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.removeItem(s3);
564
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.collapseItem(root);
565
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.expandItem(root);
566 }
567
568 {
569
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.create(this->form,
570 ui::Position(10, 10, 10, 10),
571 1 gate::ui::Listview::Flag_Visible | gate::ui::Listview::Flag_Enabled | gate::ui::Listview::Flag_Icons
572 );
573
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.removeAllItems();
574
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ui::RasterImage& appImage = this->getAppImage();
575
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate::intptr_t appIconIndex = this->listview.addIcon(appImage);
576
577
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ArrayList<ui::Listview::Column> cols;
578
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 cols.add(ui::Listview::Column("First", 60));
579
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 cols.add(ui::Listview::Column("Second", 100));
580
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 cols.add(ui::Listview::Column("Third", 200));
581
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->listview.setColumns(cols.toArray());
582
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.beginTransaction();
583
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 1 times.
26 for (uint32_t n = 0; n < 25; ++n)
584 {
585 25 void* param = reinterpret_cast<void*>(static_cast<uintptr_t>(n));
586
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 12 times.
25 intptr_t const iconIndex = (n % 2 == 0) ? appIconIndex : gate::ui::Listview::InvalidIcon;
587
3/6
✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 25 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 25 times.
✗ Branch 8 not taken.
25 size_t const index = this->listview.addItem("Entry #" + numbers::to_string(n), param, iconIndex);
588
3/6
✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 25 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 25 times.
✗ Branch 8 not taken.
25 this->listview.setItemText(index, "SubItem " + numbers::to_string(n), 1);
589 }
590
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.endTransaction();
591
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t cntCols = this->listview.getColumnCount();
592
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
4 for (size_t n = 0; n != cntCols; ++n)
593 {
594 6 String text;
595 3 uint32_t width = 0;
596
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 this->listview.getColumn(n, text, width);
597 }
598
599
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.setItemSelected(0, true);
600
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.isItemSelected(0);
601
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
6 for (uint32_t n = 0; n < 5; ++n)
602 {
603
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 size_t count = this->listview.getItemCount();
604
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 this->listview.removeItem(count - 1);
605 }
606 }
607
608 {
609
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->tabs.create(this->form, ui::Position(10, 10, 10, 10));
610
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->tabs.addTab("Tab1");
611
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->tabs.addTab("Tab2");
612
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->tabs.addTab("Tab3");
613
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->tabs.addTab("Tab4");
614
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->tabs.addTab("Tab5");
615
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->tabs.removeTab(this->tabs.getTabCount() - 1);
616 }
617
618 {
619
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ui::TabPanel panel1 = this->tabs.getTabPanel(0);
620
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 this->lbl.create(panel1, ui::Position(0, 0, 128, 28), "Label");
621
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 this->chk.create(panel1, ui::Position(0, 32, 128, 32), "CheckMe", true);
622
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->iv.create(panel1, ui::Position(0, 70, 128, 256));
623
4/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
1 this->iv.addItem("Hello", "World", "from Me");
624
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->iv.removeAllItems();
625
4/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
1 gate::size_t ndx1 = this->iv.addItem("Hello", "World", "from Me", ui::Itemview::InvalidIcon, (void*)111);
626
4/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
1 gate::size_t ndx2 = this->iv.addItem("This", "is a", "test", ui::Itemview::InvalidIcon, (void*)222);
627
4/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
1 gate::size_t ndx3 = this->iv.addItem("To", "be", "removed");
628
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->iv.setItemTitle(ndx3, "TO");
629
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->iv.setItemSubtitle(ndx3, "BE");
630
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->iv.setItemAdditionalText(ndx3, "DELETED");
631
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->iv.removeItem(ndx3);
632
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->iv.setItemSelected(ndx2);
633 1 gate::size_t selIndex = 10;
634
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 if(this->iv.getSelectedItem(selIndex))
635 {
636
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->iv.isItemSelected(selIndex);
637 }
638 }
639
640 {
641
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ui::TabPanel panel2 = this->tabs.getTabPanel(1);
642
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout.clear();
643
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t tabLeft = this->tabLayout.addColumn();
644
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t tabRight = this->tabLayout.addColumn();
645
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t tabTop = this->tabLayout.addRow(ui::Layout::Type_UnitScale, 1.0f);
646
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout.setControl(this->txtSimple, tabTop, tabLeft);
647
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout.setControl(this->btn, tabTop, tabRight);
648
649
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 this->btn.create(panel2, ui::Position(0, 0, 120, 28), "PushButton");
650
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 this->txtSimple.create(panel2, ui::Position(0, 32, 120, 32), "TextField");
651
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 panel2.setLayout(&this->tabLayout);
652 }
653
654 {
655
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ui::TabPanel panel3 = this->tabs.getTabPanel(2);
656
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2.clear();
657
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2.addColumn();
658
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2.addRow();
659
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2.setControl(this->frame, 0, 0);
660
661
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 this->frame.create(panel3, ui::Position(0, 0, 140, 96), "Frame");
662
663
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 this->btn2.create(this->frame, ui::Position(0, 0, 120, 64), "Test Input Dialog");
664
665 {
666
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->cmb.create(this->frame, ui::Position(0, 64, 128, 32));
667 //this->cmb.removeAllItems();
668
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.removeAllItems();
669
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 size_t index1 = this->cmb.addItem("entry_1");
670
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 size_t index2 = this->cmb.addItem("entry_2");
671
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 size_t index3 = this->cmb.addItem("entry_3");
672
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.getItemParam(index2);
673
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.removeItem(index3);
674
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.setSelectedItem(index1);
675
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.getSelectedIndex();
676 }
677
678 {
679
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->pgb.create(this->frame, ui::Position(0, 100, 128, 24));
680
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.setMinMax(0, 100);
681
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.setValue(75);
682
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.setValue(33);
683 }
684
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 panel3.setLayout(&this->tabLayout2);
685
686 {
687
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.clear();
688
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t c = this->tabLayout2Frame.addColumn();
689
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t r1 = this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 1.5);
690
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 0.5);
691
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t r2 = this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 1.5);
692
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 0.5);
693
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t r3 = this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 1.5);
694
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 0.5);
695
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.setControl(this->btn2, r1, c);
696
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.setControl(this->cmb, r2, c);
697
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.setControl(this->pgb, r3, c);
698
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->frame.setLayout(&this->tabLayout2Frame);
699 }
700 }
701
702 {
703
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ui::TabPanel panel3 = this->tabs.getTabPanel(3);
704
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->painter.create(panel3, ui::Position(0, 0, 160, 120));
705 }
706
707
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->form.setLayout(&this->layout);
708
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->form.setVisible(true);
709
710
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->form.getChildren();
711
712
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if(run_app_tests)
713 {
714
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->testTimer1.create(this->form);
715
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->testTimer1.start(1000);
716 }
717 1 }
718
719 1 void onUninit()
720 {
721
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 if(this->testTimer1.isCreated())
722 {
723 1 this->testTimer1.destroy();
724 }
725 1 this->form.destroy();
726 1 this->uihost.reset();
727 1 }
728
729 1 virtual void run()
730 {
731 1 this->uihost->run();
732 1 this->onUninit();
733 1 }
734 };
735
736 } // end of namespace apps
737 } // end of namespace gate
738
739 1 int gate_main(char const* program, char const* const* arguments, gate_size_t argcount, gate_uintptr_t apphandle)
740 {
741
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate::apps::VTest vtest;
742
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (argcount > 0)
743 {
744
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 if (0 == gate_str_comp_ic(arguments[0], "--runtests"))
745 {
746 1 run_app_tests = true;
747 }
748
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (argcount > 1)
749 {
750 if (0 == gate_str_comp_ic(arguments[1], "--noclose"))
751 {
752 run_app_tests_no_close = true;
753 }
754 }
755 }
756
757
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 int exitcode = gate::App::runApp(vtest, program, arguments, argcount, apphandle);
758 2 return exitcode;
759 }
760