| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* GATE PROJECT LICENSE: | ||
| 2 | +----------------------------------------------------------------------------+ | ||
| 3 | | Copyright(c) 2018-2025, 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::Combobox cmb; | ||
| 106 | ui::Progressbar pgb; | ||
| 107 | ui::PaintSurface painter; | ||
| 108 | |||
| 109 | ui::FramePanel frame; | ||
| 110 | ui::Button btn2; | ||
| 111 | |||
| 112 | ui::Layout layout; | ||
| 113 | |||
| 114 | ui::Layout tabLayout; | ||
| 115 | ui::Layout tabLayout2; | ||
| 116 | |||
| 117 | ui::Timer testTimer1; | ||
| 118 | gate::enumint_t testState; | ||
| 119 | |||
| 120 | graph::RasterImage imageApplication; | ||
| 121 | |||
| 122 | static gate::uint16_t const MenuKey_FileInfo = 0x01; | ||
| 123 | static gate::uint16_t const MenuKey_FileExit = 0x0f; | ||
| 124 | static gate::uint16_t const MenuKey_HelpAbout = 0x91; | ||
| 125 | |||
| 126 | 3 | graph::RasterImage& getAppImage() | |
| 127 | { | ||
| 128 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 2 times.
|
3 | if (this->imageApplication.empty()) |
| 129 | { | ||
| 130 | 1 | graph::PixmapImages::parse(this->imageApplication, gate_icon_application_xpm); | |
| 131 | } | ||
| 132 | 3 | return this->imageApplication; | |
| 133 | } | ||
| 134 | |||
| 135 | ✗ | void commandExit() | |
| 136 | { | ||
| 137 | ✗ | this->uihost->quit(); | |
| 138 | ✗ | } | |
| 139 | |||
| 140 | ✗ | void commandHelp() | |
| 141 | { | ||
| 142 | ✗ | ui::MessageDialog msg; | |
| 143 | ✗ | msg.show(this->form, "Sample message text", "Sample title"); | |
| 144 | ✗ | } | |
| 145 | |||
| 146 | ✗ | void Form_Closed(ui::Form* sender, ui::EventArg* arg) | |
| 147 | { | ||
| 148 | ✗ | this->commandExit(); | |
| 149 | ✗ | } | |
| 150 | |||
| 151 | 1 | void btn_Clicked(ui::Button* sender, ui::EventArg* arg) | |
| 152 | { | ||
| 153 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | String oldText = this->btn.getText(); |
| 154 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | String txt = this->txtSimple.getText(); |
| 155 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | if (txt != oldText) |
| 156 | { | ||
| 157 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->btn.setText(txt); |
| 158 | } | ||
| 159 | 1 | } | |
| 160 | |||
| 161 | 1 | void chk_Clicked(ui::Checkbox* sender, ui::EventArg* arg) | |
| 162 | { | ||
| 163 |
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"; |
| 164 |
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"; |
| 165 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | bool_t const checked = this->chk.isChecked(); |
| 166 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
2 | String const newText = checked ? checkedText : uncheckedText; |
| 167 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | String oldText = this->chk.getText(); |
| 168 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | if (oldText != newText) |
| 169 | { | ||
| 170 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->chk.setText(newText); |
| 171 | } | ||
| 172 | 1 | } | |
| 173 | |||
| 174 | ✗ | void btn2_Clicked(ui::Button* sender, ui::EventArg* arg) | |
| 175 | { | ||
| 176 | ✗ | ui::MessageDialog msgDlg; | |
| 177 | ✗ | ui::InputDialog inDlg; | |
| 178 | ✗ | Optional<String> inputText = inDlg.show(this->form, "Tell me:", "Input Dialog"); | |
| 179 | ✗ | if(inputText.empty()) | |
| 180 | { | ||
| 181 | ✗ | msgDlg.show(this->form, "No Input!", "Warning"); | |
| 182 | } | ||
| 183 | else | ||
| 184 | { | ||
| 185 | ✗ | msgDlg.show(this->form, *inputText, "Your Input:"); | |
| 186 | } | ||
| 187 | ✗ | } | |
| 188 | |||
| 189 | ✗ | void tb_Clicked(ui::Toolbar* sender, ui::Toolbar::ToolbarEventArg* arg) | |
| 190 | { | ||
| 191 | ✗ | } | |
| 192 | ✗ | void treeview_Select(ui::Treeview* sender, ui::Treeview::ItemArg* arg) | |
| 193 | { | ||
| 194 | ✗ | String text = this->treeview.getItemText(arg->Item); | |
| 195 | ✗ | this->treeview.getItemParam(arg->Item); | |
| 196 | ✗ | this->sbStatus.setText(text); | |
| 197 | ✗ | } | |
| 198 | ✗ | void listview_Select(ui::Listview* sender, ui::Listview::IndexArg* arg) | |
| 199 | { | ||
| 200 | ✗ | String text = this->listview.getItemText(arg->ListIndex); | |
| 201 | ✗ | this->listview.getItemParam(arg->ListIndex); | |
| 202 | ✗ | this->sbStatus.setText(text); | |
| 203 | ✗ | } | |
| 204 | |||
| 205 | 2 | void painter_Paint(ui::PaintSurface* sender, ui::PaintSurface::PaintEventArg* arg) | |
| 206 | { | ||
| 207 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | arg->Context.rect(arg->DrawRectangle, ui::Color::Blue, 0, ui::Color::Blue); |
| 208 | 2 | int32_t w = arg->DrawRectangle.getWidth(); | |
| 209 | 2 | int32_t h = arg->DrawRectangle.getHeight(); | |
| 210 | 2 | int32_t mx = w / 2; | |
| 211 | 2 | int32_t my = h / 2; | |
| 212 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | ArrayList<ui::Point> points; |
| 213 | points | ||
| 214 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | << ui::Point(0, my) |
| 215 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | << ui::Point(mx, 0) |
| 216 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | << ui::Point(w, my) |
| 217 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | << ui::Point(mx, h) |
| 218 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | << ui::Point(0, my) |
| 219 | ; | ||
| 220 |
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); |
| 221 | try { | ||
| 222 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
2 | arg->Context.getPixel(ui::Point(mx, my)); |
| 223 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | } catch(...) { } |
| 224 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | arg->Context.setPixel(ui::Point(mx, my), ui::Color::White); |
| 225 |
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); |
| 226 |
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); |
| 227 | |||
| 228 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | graph::RasterImage& image = this->getAppImage(); |
| 229 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
4 | ui::Graphics imageGraph(*this->uihost, image); |
| 230 | 2 | ui::Graphics virtualGraph(*this->uihost, | |
| 231 | 4 | static_cast<uint32_t>(imageGraph.getWidth()), | |
| 232 |
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())); |
| 233 |
1/2✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | virtualGraph.drawEx(imageGraph); |
| 234 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | arg->Context.draw(imageGraph, ui::Point(mx, my)); |
| 235 | |||
| 236 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | ui::Font font = this->uihost->getDefaultFont(ui::Host::FontType_Standard); |
| 237 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | font.setColor(ui::Color::White); |
| 238 |
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"; |
| 239 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | ui::Size sz = arg->Context.getTextSize(font, text); |
| 240 | 2 | ui::Position pos(mx - sz.width, my - sz.height, sz.width, sz.height); | |
| 241 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | arg->Context.print(font, text, pos); |
| 242 | 2 | } | |
| 243 | |||
| 244 | ✗ | void handleMenuAction(gate_uint16_t menuid) | |
| 245 | { | ||
| 246 | ✗ | if (menuid == MenuKey_FileExit) { this->commandExit(); } | |
| 247 | ✗ | else if (menuid == MenuKey_FileInfo) { this->commandHelp(); } | |
| 248 | ✗ | else if (menuid == MenuKey_HelpAbout) { this->commandHelp(); } | |
| 249 | ✗ | } | |
| 250 | |||
| 251 | ✗ | void Form_Menu(ui::Form* sender, ui::MenuArg* arg) | |
| 252 | { | ||
| 253 | ✗ | this->handleMenuAction(arg->MenuEntry.id); | |
| 254 | ✗ | } | |
| 255 | |||
| 256 | 3 | void useControlProperties(ui::Control& ctrl) | |
| 257 | { | ||
| 258 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | if (ctrl.isCreated()) |
| 259 | { | ||
| 260 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | ui::Position pos = ctrl.getPosition(); |
| 261 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | ui::Size sz = ctrl.getSize(); |
| 262 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | ctrl.setPosition(pos); |
| 263 | |||
| 264 |
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()); |
| 265 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | ctrl.isVisible(); |
| 266 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | ctrl.setVisible(true); |
| 267 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
3 | if (ctrl.isFocused()) |
| 268 | { | ||
| 269 | ✗ | ctrl.setFocus(); | |
| 270 | } | ||
| 271 | } | ||
| 272 | 3 | } | |
| 273 | |||
| 274 | 4 | void timer1_Elapsed(ui::Timer* sender, ui::Timer::TimerArg* arg) | |
| 275 | { | ||
| 276 | 4 | gate::enumint_t const state = ++this->testState; | |
| 277 | |||
| 278 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
|
4 | if (state == 1) |
| 279 | { | ||
| 280 | 1 | useControlProperties(this->txtSimple); | |
| 281 | 1 | useControlProperties(this->btn); | |
| 282 | 1 | useControlProperties(this->chk); | |
| 283 | |||
| 284 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | this->txtSimple.setText("Hello"); |
| 285 | 1 | this->lbl.performAction(ui::Label::Action_Activate); | |
| 286 | 1 | this->btn.performAction(ui::Button::Action_Activate); | |
| 287 | |||
| 288 | { | ||
| 289 | uint32_t mini, maxi; | ||
| 290 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mini = this->pgb.getMinimum(); |
| 291 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | maxi = this->pgb.getMaximum(); |
| 292 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->pgb.getMinMax(mini, maxi); |
| 293 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->pgb.getValue(); |
| 294 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->pgb.setValue((mini + maxi) / 2); |
| 295 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->pgb.setPercent(50.0f); |
| 296 | } | ||
| 297 | |||
| 298 | { | ||
| 299 | 1 | this->chk.setChecked(!this->chk.isChecked()); | |
| 300 | 1 | this->chk.performAction(ui::Checkbox::Action_Activate); | |
| 301 | } | ||
| 302 | |||
| 303 | { | ||
| 304 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | size_t const cnt = this->cmb.getItemCount(); |
| 305 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->cmb.setSelectedItem(cnt - 1); |
| 306 | 1 | gate_size_t selIndex = 0; | |
| 307 | 2 | String selText; | |
| 308 | 1 | void* selParam = NULL; | |
| 309 | 1 | this->cmb.getSelectedItem(&selIndex, &selText, &selParam); | |
| 310 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | selParam = this->cmb.getItemParam(selIndex); |
| 311 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | selText = this->cmb.getItemText(selIndex); |
| 312 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | String const newText = selText + "!"; |
| 313 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->cmb.setItemText(selIndex, newText); |
| 314 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->cmb.setSelectedItem(cnt - 1); |
| 315 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->cmb.performAction(ui::Combobox::Action_Activate); |
| 316 | |||
| 317 | 1 | gate_size_t foundIndex = 0; | |
| 318 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->cmb.findItemParam(selParam, foundIndex); |
| 319 | } | ||
| 320 | |||
| 321 | { | ||
| 322 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | gate_size_t index = this->lstbox.getItemCount(); |
| 323 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->lstbox.setSelectedItem(1); |
| 324 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->lstbox.getSelectedItem(index); |
| 325 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | String const text = this->lstbox.getItemText(index); |
| 326 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | String const newText = text + "!"; |
| 327 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->lstbox.setItemText(index, newText); |
| 328 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | void* const param = this->lstbox.getItemParam(index); |
| 329 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->lstbox.findItemParam(param); |
| 330 | } | ||
| 331 | |||
| 332 | { | ||
| 333 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | if (this->listview.getItemCount() > 0) |
| 334 | { | ||
| 335 | 1 | size_t ndx = 0; | |
| 336 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->listview.setItemSelected(ndx, true); |
| 337 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->listview.getSelectedItem(ndx); |
| 338 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | String oldText = this->listview.getItemText(ndx, 1); |
| 339 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | String newText = oldText + "!"; |
| 340 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->listview.setItemText(ndx, newText, 1); |
| 341 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->listview.getSelectedItems(); |
| 342 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->listview.setItemChecked(ndx, false); |
| 343 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->listview.getCheckedItems(); |
| 344 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | void* param = this->listview.getItemParam(ndx); |
| 345 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | ndx = this->listview.findItemParam(param); |
| 346 |
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"); |
| 347 | } | ||
| 348 | } | ||
| 349 | |||
| 350 | { | ||
| 351 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | Array<ui::Treeview::item_t> children = this->treeview.getItemChildren(0); |
| 352 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
|
2 | for(size_t ndx = 0; ndx != children.length(); ++ndx) |
| 353 | { | ||
| 354 | 1 | ui::Treeview::item_t parent = 0; | |
| 355 | 1 | ui::Treeview::item_t child = children[ndx]; | |
| 356 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | String oldText = this->treeview.getItemText(child); |
| 357 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | String newText = oldText + "!"; |
| 358 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->treeview.setItemText(child, newText); |
| 359 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->treeview.getItemParam(child); |
| 360 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->treeview.getParentItem(child, parent); |
| 361 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->treeview.getSelectedItem(parent); |
| 362 | } | ||
| 363 | } | ||
| 364 | } | ||
| 365 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | else if (state == 2) |
| 366 | { | ||
| 367 | 1 | size_t const tabCount = this->tabs.getTabCount(); | |
| 368 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (tabCount > 0) |
| 369 | { | ||
| 370 | 1 | this->tabs.setSelected(0); | |
| 371 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
|
5 | for (size_t ndx = 0; ndx != tabCount; ++ndx) |
| 372 | { | ||
| 373 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | String oldText = this->tabs.getTabText(ndx); |
| 374 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | String newText = oldText + "!"; |
| 375 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | this->tabs.setTabText(ndx, newText); |
| 376 | } | ||
| 377 | 1 | size_t selected = this->tabs.getSelected(); | |
| 378 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (selected < tabCount) |
| 379 | { | ||
| 380 | 1 | this->tabs.setSelected(selected + 1); | |
| 381 | } | ||
| 382 | } | ||
| 383 | } | ||
| 384 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | else if (state == 3) |
| 385 | { | ||
| 386 | 1 | this->tabs.setSelected(3); | |
| 387 | 1 | this->painter.redraw(); | |
| 388 | } | ||
| 389 | else | ||
| 390 | { | ||
| 391 | 1 | sender->stop(); | |
| 392 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (!run_app_tests_no_close) |
| 393 | { | ||
| 394 | 1 | this->uihost->quit(); | |
| 395 | } | ||
| 396 | } | ||
| 397 | 4 | } | |
| 398 | |||
| 399 | public: | ||
| 400 | 1 | VTest() | |
| 401 |
25/50✓ 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.
|
1 | : testState(0) |
| 402 | { | ||
| 403 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | menuFile.add("Info", MenuKey_FileInfo); |
| 404 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | menuFile.addSeparator(); |
| 405 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | menuFile.add("Exit", MenuKey_FileExit); |
| 406 | |||
| 407 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | menuHelp.add("About", MenuKey_HelpAbout); |
| 408 | |||
| 409 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | menu.add("File", 0, 0, &menuFile); |
| 410 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | menu.add("Help", 0, 0, &menuHelp); |
| 411 | |||
| 412 |
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); |
| 413 |
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); |
| 414 |
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); |
| 415 | |||
| 416 |
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); |
| 417 |
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); |
| 418 |
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); |
| 419 |
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); |
| 420 |
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); |
| 421 |
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); |
| 422 | 1 | } | |
| 423 | 2 | ~VTest() noexcept | |
| 424 | 2 | { | |
| 425 | 2 | } | |
| 426 | |||
| 427 | 1 | virtual void onInit() | |
| 428 | { | ||
| 429 |
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()); |
| 430 | |||
| 431 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->layout.clear(); |
| 432 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->layout.setBorder(1); |
| 433 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->layout.setRowSpace(3); |
| 434 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->layout.setColumnSpace(3); |
| 435 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | uint32_t colLeft = this->layout.addColumn(ui::Layout::Type_UnitScale, 8.0f); |
| 436 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | uint32_t colMid = this->layout.addColumn(); |
| 437 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | uint32_t colRight = this->layout.addColumn(ui::Layout::Type_Percent, 25.0f); |
| 438 | |||
| 439 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | uint32_t rowTop = this->layout.addRow(ui::Layout::Type_UnitScale, 2.00f); |
| 440 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | uint32_t rowData1 = this->layout.addRow(); |
| 441 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | uint32_t rowData2 = this->layout.addRow(); |
| 442 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | uint32_t rowBottom = this->layout.addRow(ui::Layout::Type_UnitScale, 1.00f); |
| 443 | |||
| 444 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->layout.setControl(this->tb, rowTop, colLeft, 1, 3); |
| 445 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->layout.setControl(this->treeview, rowData1, colLeft); |
| 446 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->layout.setControl(this->listview, rowData2, colLeft); |
| 447 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->layout.setControl(this->tabs, rowData1, colMid, 2, 1); |
| 448 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->layout.setControl(this->lstbox, rowData1, colRight); |
| 449 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->layout.setControl(this->txtMulti, rowData2, colRight); |
| 450 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->layout.setControl(this->sbStatus, rowBottom, colLeft, 1, 3); |
| 451 | |||
| 452 |
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); |
| 453 | |||
| 454 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | this->form.create(*this->uihost, NULL, String::createStaticFrom("vTest"), |
| 455 | 1 | ui::Form::Flag_Enabled | ui::Form::Flag_Resizable | ui::Form::Flag_Maximizable | ui::Form::Flag_Minimizable | |
| 456 | //| ui::Form::Flag_Visible | ||
| 457 | ); | ||
| 458 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->form.setMenu(&this->menu); |
| 459 | |||
| 460 | |||
| 461 | 1 | ui::Position stdPos(10, 10, 10, 10); | |
| 462 | |||
| 463 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->tb.create(this->form, stdPos); |
| 464 | { | ||
| 465 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | ui::RasterImage& image = this->getAppImage(); |
| 466 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->tb.add(image, NULL); |
| 467 | } | ||
| 468 | |||
| 469 |
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"); |
| 470 | |||
| 471 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->txtMulti.create(this->form, stdPos, "Hello" GATE_STR_NEWLINE "world", |
| 472 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | ui::Textbox::Flag_Enabled | ui::Textbox::Flag_Visible | ui::Textbox::Flag_Multiline); |
| 473 | |||
| 474 | { | ||
| 475 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->lstbox.create(this->form, stdPos); |
| 476 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->lstbox.removeAllItems(); |
| 477 |
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"); |
| 478 |
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"); |
| 479 |
2/2✓ Branch 0 taken 25 times.
✓ Branch 1 taken 1 times.
|
26 | for (uint32_t n = 0; n < 25; ++n) |
| 480 | { | ||
| 481 |
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)); |
| 482 | } | ||
| 483 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
|
6 | for (uint32_t n = 0; n < 5; ++n) |
| 484 | { | ||
| 485 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | size_t count = this->lstbox.getItemCount(); |
| 486 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | this->lstbox.removeItem(count - 1); |
| 487 | } | ||
| 488 | } | ||
| 489 | |||
| 490 | { | ||
| 491 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | this->treeview.create(this->form, ui::Position(10, 10, 10, 10)); |
| 492 |
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"); |
| 493 |
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"); |
| 494 |
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"); |
| 495 |
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"); |
| 496 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->treeview.removeItem(s3); |
| 497 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->treeview.collapseItem(root); |
| 498 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->treeview.expandItem(root); |
| 499 | } | ||
| 500 | |||
| 501 | { | ||
| 502 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | this->listview.create(this->form, ui::Position(10, 10, 10, 10)); |
| 503 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->listview.removeAllItems(); |
| 504 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | ArrayList<ui::Listview::Column> cols; |
| 505 |
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)); |
| 506 |
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)); |
| 507 |
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)); |
| 508 |
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()); |
| 509 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->listview.beginTransaction(); |
| 510 |
2/2✓ Branch 0 taken 25 times.
✓ Branch 1 taken 1 times.
|
26 | for (uint32_t n = 0; n < 25; ++n) |
| 511 | { | ||
| 512 | 25 | void* param = reinterpret_cast<void*>(static_cast<uintptr_t>(n)); | |
| 513 |
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 index = this->listview.addItem("Entry #" + numbers::to_string(n), param); |
| 514 |
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); |
| 515 | } | ||
| 516 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->listview.endTransaction(); |
| 517 | |||
| 518 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->listview.setItemSelected(0, true); |
| 519 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
|
6 | for (uint32_t n = 0; n < 5; ++n) |
| 520 | { | ||
| 521 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | size_t count = this->listview.getItemCount(); |
| 522 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | this->listview.removeItem(count - 1); |
| 523 | } | ||
| 524 | } | ||
| 525 | |||
| 526 | { | ||
| 527 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | this->tabs.create(this->form, ui::Position(10, 10, 10, 10)); |
| 528 |
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"); |
| 529 |
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"); |
| 530 |
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"); |
| 531 |
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"); |
| 532 |
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"); |
| 533 |
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); |
| 534 | } | ||
| 535 | |||
| 536 | { | ||
| 537 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | ui::TabPanel panel1 = this->tabs.getTabPanel(0); |
| 538 |
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"); |
| 539 |
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); |
| 540 | } | ||
| 541 | |||
| 542 | { | ||
| 543 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | ui::TabPanel panel2 = this->tabs.getTabPanel(1); |
| 544 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->tabLayout.clear(); |
| 545 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | uint32_t tabLeft = this->tabLayout.addColumn(); |
| 546 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | uint32_t tabRight = this->tabLayout.addColumn(); |
| 547 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | uint32_t tabTop = this->tabLayout.addRow(ui::Layout::Type_UnitScale, 1.0f); |
| 548 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->tabLayout.setControl(this->txtSimple, tabTop, tabLeft); |
| 549 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->tabLayout.setControl(this->btn, tabTop, tabRight); |
| 550 | |||
| 551 |
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"); |
| 552 |
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"); |
| 553 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | panel2.setLayout(&this->tabLayout); |
| 554 | } | ||
| 555 | |||
| 556 | { | ||
| 557 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | ui::TabPanel panel3 = this->tabs.getTabPanel(2); |
| 558 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->tabLayout2.clear(); |
| 559 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->tabLayout2.addColumn(); |
| 560 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->tabLayout2.addRow(); |
| 561 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->tabLayout2.setControl(this->frame, 0, 0); |
| 562 | |||
| 563 |
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"); |
| 564 | |||
| 565 |
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"); |
| 566 | |||
| 567 | { | ||
| 568 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | this->cmb.create(this->frame, ui::Position(0, 64, 128, 32)); |
| 569 | //this->cmb.removeAllItems(); | ||
| 570 |
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"); |
| 571 |
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"); |
| 572 |
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"); |
| 573 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->cmb.removeItem(index3); |
| 574 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->cmb.setSelectedItem(index1); |
| 575 | } | ||
| 576 | |||
| 577 | { | ||
| 578 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | this->pgb.create(this->frame, ui::Position(0, 100, 128, 24)); |
| 579 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->pgb.setMinMax(0, 100); |
| 580 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->pgb.setValue(75); |
| 581 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->pgb.setValue(33); |
| 582 | } | ||
| 583 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | panel3.setLayout(&this->tabLayout2); |
| 584 | } | ||
| 585 | |||
| 586 | { | ||
| 587 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | ui::TabPanel panel3 = this->tabs.getTabPanel(3); |
| 588 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | this->painter.create(panel3, ui::Position(0, 0, 160, 120)); |
| 589 | } | ||
| 590 | |||
| 591 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->form.setLayout(&this->layout); |
| 592 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->form.setVisible(true); |
| 593 | |||
| 594 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(run_app_tests) |
| 595 | { | ||
| 596 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->testTimer1.create(this->form); |
| 597 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | this->testTimer1.start(1000); |
| 598 | } | ||
| 599 | 1 | } | |
| 600 | |||
| 601 | 1 | void onUninit() | |
| 602 | { | ||
| 603 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | if(this->testTimer1.isCreated()) |
| 604 | { | ||
| 605 | 1 | this->testTimer1.destroy(); | |
| 606 | } | ||
| 607 | 1 | this->form.destroy(); | |
| 608 | 1 | this->uihost.reset(); | |
| 609 | 1 | } | |
| 610 | |||
| 611 | 1 | virtual void run() | |
| 612 | { | ||
| 613 | 1 | this->uihost->run(); | |
| 614 | 1 | this->onUninit(); | |
| 615 | 1 | } | |
| 616 | }; | ||
| 617 | |||
| 618 | } // end of namespace apps | ||
| 619 | } // end of namespace gate | ||
| 620 | |||
| 621 | 1 | int gate_main(char const* program, char const* const* arguments, gate_size_t argcount, gate_uintptr_t apphandle) | |
| 622 | { | ||
| 623 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | gate::apps::VTest vtest; |
| 624 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (argcount > 0) |
| 625 | { | ||
| 626 |
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")) |
| 627 | { | ||
| 628 | 1 | run_app_tests = true; | |
| 629 | } | ||
| 630 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if (argcount > 1) |
| 631 | { | ||
| 632 | ✗ | if (0 == gate_str_comp_ic(arguments[1], "--noclose")) | |
| 633 | { | ||
| 634 | ✗ | run_app_tests_no_close = true; | |
| 635 | } | ||
| 636 | } | ||
| 637 | } | ||
| 638 | |||
| 639 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | int exitcode = gate::App::runApp(vtest, program, arguments, argcount, apphandle); |
| 640 | 2 | return exitcode; | |
| 641 | } | ||
| 642 |