GCC Code Coverage Report


Directory: src/gate/
File: src/gate/ui/tests/gateui_cpp_test/gateui_cpp_tests.cpp
Date: 2026-02-03 22:06:38
Exec Total Coverage
Lines: 372 410 90.7%
Functions: 14 22 63.6%
Branches: 420 860 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
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 ui::Graphics imageGraph(*this->uihost, image);
242 2 ui::Graphics virtualGraph(*this->uihost,
243 4 static_cast<uint32_t>(imageGraph.getWidth()),
244
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 static_cast<uint32_t>(imageGraph.getHeight()));
245
1/2
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 virtualGraph.drawEx(imageGraph);
246
1/2
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 arg->Context.draw(imageGraph, ui::Point(mx, my));
247
248
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 ui::Font font = this->uihost->getDefaultFont(ui::Host::FontType_Standard);
249
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 font.setColor(ui::Color::White);
250
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
2 static StaticString text = "Hello";
251
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 ui::Size sz = arg->Context.getTextSize(font, text);
252 2 ui::Position pos(mx - sz.width, my - sz.height, sz.width, sz.height);
253
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 arg->Context.print(font, text, pos);
254 2 }
255
256 void handleMenuAction(gate_uint16_t menuid)
257 {
258 if (menuid == MenuKey_FileExit) { this->commandExit(); }
259 else if (menuid == MenuKey_FileInfo) { this->commandHelp(); }
260 else if (menuid == MenuKey_HelpAbout) { this->commandHelp(); }
261 }
262
263 void Form_Menu(ui::Form* sender, ui::MenuArg* arg)
264 {
265 this->handleMenuAction(arg->MenuEntry.id);
266 }
267
268 3 void useControlProperties(ui::Control& ctrl)
269 {
270
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 if (ctrl.isCreated())
271 {
272
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 ui::Position pos = ctrl.getPosition();
273
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 ui::Size sz = ctrl.getSize();
274
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 ctrl.setPosition(pos);
275
276
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());
277
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 ctrl.isVisible();
278
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 ctrl.setVisible(true);
279
2/4
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
3 if (ctrl.isFocused())
280 {
281 ctrl.setFocus();
282 }
283 }
284 3 }
285
286 4 void timer1_Elapsed(ui::Timer* sender, ui::Timer::TimerArg* arg)
287 {
288 4 gate::enumint_t const state = ++this->testState;
289
290
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
4 if (state == 1)
291 {
292
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 useControlProperties(this->txtSimple);
293
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 useControlProperties(this->btn);
294
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 useControlProperties(this->chk);
295
296
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");
297
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String lblText = this->lbl.getText();
298
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lbl.setText(lblText);
299
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lbl.performAction(ui::Label::Action_Activate);
300
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->btn.performAction(ui::Button::Action_Activate);
301
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");
302
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.getCurrentColumn();
303
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.getCurrentLine();
304
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.setSelection(2, 5);
305 1 gate_uint32_t l = 0, r = 0;
306
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.getSelection(l, r);
307
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.getSelectionText();
308
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_");
309
310 {
311 uint32_t mini, maxi;
312
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mini = this->pgb.getMinimum();
313
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 maxi = this->pgb.getMaximum();
314
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.getMinMax(mini, maxi);
315
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.getValue();
316
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.setValue((mini + maxi) / 2);
317
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.setPercent(50.0f);
318 }
319
320 {
321
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());
322
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->chk.performAction(ui::Checkbox::Action_Activate);
323 }
324
325 {
326
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t const cnt = this->cmb.getItemCount();
327
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.setSelectedItem(cnt - 1);
328 1 gate_size_t selIndex = 0;
329 2 String selText;
330 1 void* selParam = NULL;
331 1 this->cmb.getSelectedItem(&selIndex, &selText, &selParam);
332
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 selParam = this->cmb.getItemParam(selIndex);
333
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 selText = this->cmb.getItemText(selIndex);
334
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String const newText = selText + "!";
335
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.setItemText(selIndex, newText);
336
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.setSelectedItem(cnt - 1);
337
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.performAction(ui::Combobox::Action_Activate);
338
339 1 gate_size_t foundIndex = 0;
340
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.findItemParam(selParam, foundIndex);
341 }
342
343 {
344
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_size_t index = this->lstbox.getItemCount();
345
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.setSelectedItem(1);
346
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.getSelectedItem(index);
347
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String const text = this->lstbox.getItemText(index);
348
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String const newText = text + "!";
349
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.setItemText(index, newText);
350
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 void* const param = this->lstbox.getItemParam(index);
351
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.findItemParam(param);
352 }
353
354 {
355
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)
356 {
357 1 size_t ndx = 0;
358
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.setItemSelected(ndx, true);
359
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.getSelectedItem(ndx);
360
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String oldText = this->listview.getItemText(ndx, 1);
361
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 String newText = oldText + "!";
362
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.setItemText(ndx, newText, 1);
363
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.getSelectedItems();
364
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.setItemChecked(ndx, false);
365
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.getCheckedItems();
366
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 void* param = this->listview.getItemParam(ndx);
367
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.findItemParam(param);
368
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");
369 }
370 }
371
372 {
373
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.setFocus();
374
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Array<ui::Treeview::item_t> children = this->treeview.getItemChildren(0);
375
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 for(size_t ndx = 0; ndx != children.length(); ++ndx)
376 {
377 1 ui::Treeview::item_t parent = 0;
378 1 ui::Treeview::item_t child = children[ndx];
379
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String oldText = this->treeview.getItemText(child);
380
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 String newText = oldText + "!";
381
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.setItemText(child, newText);
382
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.getItemParam(child);
383
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.getParentItem(child, parent);
384
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.isItemExpanded(child);
385
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.selectItem(child);
386
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.getSelectedItem(child);
387
388
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.performAction(ui::Treeview::Action_Activate);
389
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.performAction(ui::Treeview::Action_ContextMenu);
390 }
391 }
392
393 {
394
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->iv.setFocus();
395
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t cnt = this->iv.getItemCount();
396
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (size_t ndx = 0; ndx != cnt; ++ndx)
397 {
398
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 this->iv.getItemTitle(ndx);
399
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 this->iv.getItemSubtitle(ndx);
400
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 this->iv.getItemAddiontialText(ndx);
401
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 void* param = this->iv.getItemParam(ndx);
402
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 gate::size_t index = this->iv.findItemParam(param);
403 }
404 }
405
406
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->form.refresh();
407 }
408
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
3 else if (state == 2)
409 {
410 1 size_t const tabCount = this->tabs.getTabCount();
411
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (tabCount > 0)
412 {
413 1 this->tabs.setSelected(0);
414
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (size_t ndx = 0; ndx != tabCount; ++ndx)
415 {
416
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
8 String oldText = this->tabs.getTabText(ndx);
417
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
8 String newText = oldText + "!";
418
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 this->tabs.setTabText(ndx, newText);
419 }
420 1 size_t selected = this->tabs.getSelected();
421
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (selected < tabCount)
422 {
423 1 this->tabs.setSelected(selected + 1);
424 }
425 }
426 }
427
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 else if (state == 3)
428 {
429 1 this->tabs.setSelected(3);
430 1 this->painter.redraw();
431 }
432 else
433 {
434 1 sender->stop();
435
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (!run_app_tests_no_close)
436 {
437 1 this->uihost->quit();
438 }
439 }
440 4 }
441
442 public:
443 1 VTest()
444
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)
445 {
446
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menuFile.add("Info", MenuKey_FileInfo);
447
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menuFile.addSeparator();
448
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menuFile.add("Exit", MenuKey_FileExit);
449
450
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menuHelp.add("About", MenuKey_HelpAbout);
451
452
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menu.add("File", 0, 0, &menuFile);
453
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 menu.add("Help", 0, 0, &menuHelp);
454
455
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);
456
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);
457
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);
458
459
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);
460
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);
461
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);
462
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);
463
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);
464
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);
465 1 }
466 2 ~VTest() noexcept
467 2 {
468 2 }
469
470 1 virtual void onInit()
471 {
472
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());
473
474
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.clear();
475
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setBorder(1);
476
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setRowSpace(3);
477
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setColumnSpace(3);
478
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t colLeft = this->layout.addColumn(ui::Layout::Type_UnitScale, 8.0f);
479
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t colMid = this->layout.addColumn();
480
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t colRight = this->layout.addColumn(ui::Layout::Type_Percent, 25.0f);
481
482
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t rowTop = this->layout.addRow(ui::Layout::Type_UnitScale, 2.00f);
483
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t rowData1 = this->layout.addRow();
484
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t rowData2 = this->layout.addRow();
485
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t rowBottom = this->layout.addRow(ui::Layout::Type_UnitScale, 1.00f);
486
487
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->tb, rowTop, colLeft, 1, 3);
488
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->treeview, rowData1, colLeft);
489
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->listview, rowData2, colLeft);
490
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->tabs, rowData1, colMid, 2, 1);
491
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->lstbox, rowData1, colRight);
492
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->txtMulti, rowData2, colRight);
493
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->layout.setControl(this->sbStatus, rowBottom, colLeft, 1, 3);
494
495
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);
496
497
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->form.create(*this->uihost, NULL, String::createStaticFrom("vTest"),
498 1 ui::Form::Flag_Enabled | ui::Form::Flag_Resizable | ui::Form::Flag_Maximizable | ui::Form::Flag_Minimizable
499 //| ui::Form::Flag_Visible
500 );
501
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->form.setMenu(&this->menu);
502
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ui::Host::getHost(this->form);
503
504
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->uihost->getLineHeight();
505
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->uihost->getControlHeight();
506
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->uihost->getUnitLength();
507
508 1 ui::Position stdPos(10, 10, 10, 10);
509
510
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tb.create(this->form, stdPos);
511 {
512
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ui::RasterImage& image = this->getAppImage();
513
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tb.add(image, NULL);
514
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tb.addSeparator();
515 }
516
517
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");
518
519
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->txtMulti.create(this->form, stdPos, "Hello" GATE_STR_NEWLINE "world",
520
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ui::Textbox::Flag_Enabled | ui::Textbox::Flag_Visible | ui::Textbox::Flag_Multiline);
521
522 {
523
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.create(this->form, stdPos);
524
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->lstbox.removeAllItems();
525
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");
526
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");
527
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 1 times.
26 for (uint32_t n = 0; n < 25; ++n)
528 {
529
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));
530 }
531
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
6 for (uint32_t n = 0; n < 5; ++n)
532 {
533
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 size_t count = this->lstbox.getItemCount();
534
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 this->lstbox.removeItem(count - 1);
535 }
536 }
537
538 {
539
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.create(this->form,
540 ui::Position(10, 10, 10, 10),
541 1 gate::ui::Treeview::Flag_Visible | gate::ui::Treeview::Flag_Enabled | gate::ui::Treeview::Flag_Icons
542 );
543
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 graph::RasterImage& folderImage = this->getFolderImage();
544
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 intptr_t folderIconIndex = this->treeview.addIcon(folderImage);
545
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);
546
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");
547
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");
548
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");
549
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.removeItem(s3);
550
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.collapseItem(root);
551
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->treeview.expandItem(root);
552 }
553
554 {
555
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.create(this->form,
556 ui::Position(10, 10, 10, 10),
557 1 gate::ui::Listview::Flag_Visible | gate::ui::Listview::Flag_Enabled | gate::ui::Listview::Flag_Icons
558 );
559
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.removeAllItems();
560
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ui::RasterImage& appImage = this->getAppImage();
561
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate::intptr_t appIconIndex = this->listview.addIcon(appImage);
562
563
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ArrayList<ui::Listview::Column> cols;
564
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));
565
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));
566
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));
567
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());
568
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.beginTransaction();
569
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 1 times.
26 for (uint32_t n = 0; n < 25; ++n)
570 {
571 25 void* param = reinterpret_cast<void*>(static_cast<uintptr_t>(n));
572
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;
573
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);
574
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);
575 }
576
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.endTransaction();
577
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t cntCols = this->listview.getColumnCount();
578
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
4 for (size_t n = 0; n != cntCols; ++n)
579 {
580 6 String text;
581 3 uint32_t width = 0;
582
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 this->listview.getColumn(n, text, width);
583 }
584
585
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.setItemSelected(0, true);
586
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->listview.isItemSelected(0);
587
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
6 for (uint32_t n = 0; n < 5; ++n)
588 {
589
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 size_t count = this->listview.getItemCount();
590
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 this->listview.removeItem(count - 1);
591 }
592 }
593
594 {
595
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->tabs.create(this->form, ui::Position(10, 10, 10, 10));
596
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");
597
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");
598
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");
599
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");
600
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");
601
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);
602 }
603
604 {
605
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ui::TabPanel panel1 = this->tabs.getTabPanel(0);
606
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");
607
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);
608
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->iv.create(panel1, ui::Position(0, 70, 128, 256));
609
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");
610
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->iv.removeAllItems();
611
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);
612
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);
613
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");
614
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");
615
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");
616
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");
617
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->iv.removeItem(ndx3);
618
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->iv.setItemSelected(ndx2);
619 1 gate::size_t selIndex = 10;
620
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))
621 {
622
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->iv.isItemSelected(selIndex);
623 }
624 }
625
626 {
627
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ui::TabPanel panel2 = this->tabs.getTabPanel(1);
628
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout.clear();
629
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t tabLeft = this->tabLayout.addColumn();
630
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t tabRight = this->tabLayout.addColumn();
631
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 uint32_t tabTop = this->tabLayout.addRow(ui::Layout::Type_UnitScale, 1.0f);
632
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout.setControl(this->txtSimple, tabTop, tabLeft);
633
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout.setControl(this->btn, tabTop, tabRight);
634
635
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");
636
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");
637
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 panel2.setLayout(&this->tabLayout);
638 }
639
640 {
641
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ui::TabPanel panel3 = this->tabs.getTabPanel(2);
642
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2.clear();
643
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2.addColumn();
644
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2.addRow();
645
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2.setControl(this->frame, 0, 0);
646
647
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");
648
649
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");
650
651 {
652
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->cmb.create(this->frame, ui::Position(0, 64, 128, 32));
653 //this->cmb.removeAllItems();
654
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.removeAllItems();
655
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");
656
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");
657
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");
658
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.getItemParam(index2);
659
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.removeItem(index3);
660
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.setSelectedItem(index1);
661
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->cmb.getSelectedIndex();
662 }
663
664 {
665
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->pgb.create(this->frame, ui::Position(0, 100, 128, 24));
666
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.setMinMax(0, 100);
667
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.setValue(75);
668
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->pgb.setValue(33);
669 }
670
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 panel3.setLayout(&this->tabLayout2);
671
672 {
673
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.clear();
674
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t c = this->tabLayout2Frame.addColumn();
675
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t r1 = this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 1.5);
676
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 0.5);
677
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t r2 = this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 1.5);
678
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 0.5);
679
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t r3 = this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 1.5);
680
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.addRow(ui::Layout::Type_UnitScale, 0.5);
681
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.setControl(this->btn2, r1, c);
682
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.setControl(this->cmb, r2, c);
683
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->tabLayout2Frame.setControl(this->pgb, r3, c);
684
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->frame.setLayout(&this->tabLayout2Frame);
685 }
686 }
687
688 {
689
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ui::TabPanel panel3 = this->tabs.getTabPanel(3);
690
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 this->painter.create(panel3, ui::Position(0, 0, 160, 120));
691 }
692
693
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->form.setLayout(&this->layout);
694
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->form.setVisible(true);
695
696
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->form.getChildren();
697
698
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if(run_app_tests)
699 {
700
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->testTimer1.create(this->form);
701
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->testTimer1.start(1000);
702 }
703 1 }
704
705 1 void onUninit()
706 {
707
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 if(this->testTimer1.isCreated())
708 {
709 1 this->testTimer1.destroy();
710 }
711 1 this->form.destroy();
712 1 this->uihost.reset();
713 1 }
714
715 1 virtual void run()
716 {
717 1 this->uihost->run();
718 1 this->onUninit();
719 1 }
720 };
721
722 } // end of namespace apps
723 } // end of namespace gate
724
725 1 int gate_main(char const* program, char const* const* arguments, gate_size_t argcount, gate_uintptr_t apphandle)
726 {
727
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate::apps::VTest vtest;
728
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (argcount > 0)
729 {
730
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"))
731 {
732 1 run_app_tests = true;
733 }
734
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (argcount > 1)
735 {
736 if (0 == gate_str_comp_ic(arguments[1], "--noclose"))
737 {
738 run_app_tests_no_close = true;
739 }
740 }
741 }
742
743
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 int exitcode = gate::App::runApp(vtest, program, arguments, argcount, apphandle);
744 2 return exitcode;
745 }
746