• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gansm / finalcut / #746

31 Dec 2025 10:25PM UTC coverage: 68.505% (+0.05%) from 68.454%
#746

push

travis-ci

gansm
The "FindFinalCut.cmake" file has been added to simplify the integration of FINAL CUT into CMake projects

37261 of 54392 relevant lines covered (68.5%)

226.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.26
/test/fwidget-test.cpp
1
/***********************************************************************
2
* fwidget-test.cpp - FWidget unit tests                                *
3
*                                                                      *
4
* This file is part of the FINAL CUT widget toolkit                    *
5
*                                                                      *
6
* Copyright 2022-2025 Markus Gans                                      *
7
*                                                                      *
8
* FINAL CUT is free software; you can redistribute it and/or modify    *
9
* it under the terms of the GNU Lesser General Public License as       *
10
* published by the Free Software Foundation; either version 3 of       *
11
* the License, or (at your option) any later version.                  *
12
*                                                                      *
13
* FINAL CUT is distributed in the hope that it will be useful, but     *
14
* WITHOUT ANY WARRANTY; without even the implied warranty of           *
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
16
* GNU Lesser General Public License for more details.                  *
17
*                                                                      *
18
* You should have received a copy of the GNU Lesser General Public     *
19
* License along with this program.  If not, see                        *
20
* <http://www.gnu.org/licenses/>.                                      *
21
***********************************************************************/
22

23
#include <limits>
24

25
#include <cppunit/BriefTestProgressListener.h>
26
#include <cppunit/CompilerOutputter.h>
27
#include <cppunit/extensions/HelperMacros.h>
28
#include <cppunit/TestFixture.h>
29
#include <cppunit/TestResult.h>
30
#include <cppunit/TestResultCollector.h>
31
#include <cppunit/TestRunner.h>
32

33
#include <final/final.h>
34
#include <fvterm_check.h>
35

36
//----------------------------------------------------------------------
37
auto getLastEvent() -> finalcut::Event&
104✔
38
{
39
  static finalcut::Event event = finalcut::Event::None;
40
  return event;
104✔
41
}
42

43
//----------------------------------------------------------------------
44
void setLastEvent (finalcut::Event event)
98✔
45
{
46
  getLastEvent() = event;
98✔
47
}
98✔
48

49
//----------------------------------------------------------------------
50
void resetLastEvent()
2✔
51
{
52
  getLastEvent() = finalcut::Event::None;
2✔
53
}
2✔
54

55
//----------------------------------------------------------------------
56
// class FWidget_protected
57
//----------------------------------------------------------------------
58

59
class FWidget_protected : public finalcut::FWidget
60
{
61
  public:
62
    // Using-declarations
63
    using FWidgetList = std::vector<finalcut::FWidget*>;
64

65
    // Disable copy constructor
66
    FWidget_protected (const FWidget_protected&) = delete;
67

68
    // Disable move constructor
69
    FWidget_protected (FWidget_protected&&) noexcept = delete;
70

71
    // Constructor
72
    explicit FWidget_protected (finalcut::FWidget* = nullptr);
73

74
    // Accessor
75
    auto  getPrintArea() -> finalcut::FWidget::FTermArea* override;
76
    static auto p_getModalDialogCounter() -> uInt;
77
    static auto p_getDialogList() -> FWidgetList*&;
78
    static auto p_getAlwaysOnTopList() -> FWidgetList*&;
79
    static auto p_getWidgetCloseList() -> FWidgetList*&;
80
    void  addPreprocessingHandler ( const finalcut::FVTerm*
81
                                  , FPreprocessingFunction&& ) override;
82
    void  delPreprocessingHandler (const finalcut::FVTerm*) override;
83

84
    // Inquiry
85
    auto  p_isChildPrintArea() const -> bool;
86

87
    // Mutators
88
    void setStatusBar (finalcut::FStatusBar*) override;
89
    void setMenuBar (finalcut::FMenuBar*) override;
90
    static auto  p_setModalDialogCounter() -> uInt&;
91
    void  p_setParentOffset();
92
    void  p_setTermOffset();
93
    void  p_setTermOffsetWithPadding();
94

95
    // Methods
96
    void  initTerminal() override;
97
    void  p_initDesktop();
98
    void  initLayout() override;
99
    void  adjustSize() override;
100
    void  p_adjustSizeGlobal();
101
    void  p_hideArea (const finalcut::FSize&);
102

103
    // Event handlers
104
    auto event (finalcut::FEvent*) -> bool override;
105
    void onKeyPress (finalcut::FKeyEvent*) override;
106
    void onKeyUp (finalcut::FKeyEvent*) override;
107
    void onKeyDown (finalcut::FKeyEvent*) override;
108
    void onMouseDown (finalcut::FMouseEvent*) override;
109
    void onMouseUp (finalcut::FMouseEvent*) override;
110
    void onMouseDoubleClick (finalcut::FMouseEvent*) override;
111
    void onWheel (finalcut::FWheelEvent*) override;
112
    void onMouseMove (finalcut::FMouseEvent*) override;
113
    void onFocusIn (finalcut::FFocusEvent*) override;
114
    void onFocusOut (finalcut::FFocusEvent*) override;
115
    void onChildFocusIn (finalcut::FFocusEvent*) override;
116
    void onChildFocusOut (finalcut::FFocusEvent*) override;
117
    void onFailAtChildFocus (finalcut::FFocusEvent*) override;
118
    void onAccel (finalcut::FAccelEvent*) override;
119
    void onResize (finalcut::FResizeEvent*) override;
120
    void onShow (finalcut::FShowEvent*) override;
121
    void onHide (finalcut::FHideEvent*) override;
122
    void onClose (finalcut::FCloseEvent*) override;
123

124
    // From FObject
125
    void p_setWidgetProperty (bool);
126
};
127

128
//----------------------------------------------------------------------
129
inline FWidget_protected::FWidget_protected (finalcut::FWidget* parent)
5✔
130
  : finalcut::FWidget{parent}
5✔
131
{ }
5✔
132

133
//----------------------------------------------------------------------
134
inline auto FWidget_protected::getPrintArea() -> finalcut::FWidget::FTermArea*
×
135
{
136
  return finalcut::FWidget::getPrintArea();
×
137
}
138

139
//----------------------------------------------------------------------
140
inline auto FWidget_protected::p_getModalDialogCounter() -> uInt
141
{
142
  return finalcut::FWidget::getModalDialogCounter();
143
}
144

145
//----------------------------------------------------------------------
146
inline auto FWidget_protected::p_getDialogList() -> FWidgetList*&
147
{
148
  return finalcut::FWidget::getDialogList();
149
}
150

151
//----------------------------------------------------------------------
152
inline auto FWidget_protected::p_getAlwaysOnTopList() -> FWidgetList*&
153
{
154
  return finalcut::FWidget::getAlwaysOnTopList();
155
}
156

157
//----------------------------------------------------------------------
158
inline auto FWidget_protected::p_getWidgetCloseList() -> FWidgetList*&
159
{
160
  return finalcut::FWidget::getWidgetCloseList();
161
}
162

163
//----------------------------------------------------------------------
164
inline void FWidget_protected::addPreprocessingHandler ( const finalcut::FVTerm* instance
×
165
                                                       , FPreprocessingFunction&& function )
166
{
167
  finalcut::FWidget::addPreprocessingHandler (instance, std::move(function));
×
168
}
×
169

170
//----------------------------------------------------------------------
171
inline void FWidget_protected::delPreprocessingHandler (const finalcut::FVTerm* instance)
×
172
{
173
  finalcut::FWidget::delPreprocessingHandler (instance);
×
174
}
×
175

176
//----------------------------------------------------------------------
177
inline auto FWidget_protected::p_isChildPrintArea() const -> bool
178
{
179
  return finalcut::FWidget::isChildPrintArea();
180
}
181

182
//----------------------------------------------------------------------
183
inline void FWidget_protected::setStatusBar (finalcut::FStatusBar* sbar)
×
184
{
185
  finalcut::FWidget::setStatusBar (sbar);
×
186
}
×
187

188
//----------------------------------------------------------------------
189
inline void FWidget_protected::setMenuBar (finalcut::FMenuBar* mbar)
×
190
{
191
  finalcut::FWidget::setMenuBar (mbar);
×
192
}
×
193

194
//----------------------------------------------------------------------
195
inline auto FWidget_protected::p_setModalDialogCounter() -> uInt&
196
{
197
  return finalcut::FWidget::setModalDialogCounter();
198
}
199

200
//----------------------------------------------------------------------
201
inline void FWidget_protected::p_setParentOffset()
202
{
203
  finalcut::FWidget::setParentOffset();
204
}
205

206
//----------------------------------------------------------------------
207
inline void FWidget_protected::p_setTermOffset()
208
{
209
  finalcut::FWidget::setTermOffset();
210
}
211

212
//----------------------------------------------------------------------
213
inline void FWidget_protected::p_setTermOffsetWithPadding()
214
{
215
  finalcut::FWidget::setTermOffsetWithPadding();
216
}
217

218
//----------------------------------------------------------------------
219
inline void FWidget_protected::initTerminal()
×
220
{
221
  finalcut::FWidget::initTerminal();
×
222
}
×
223

224
//----------------------------------------------------------------------
225
inline void FWidget_protected::p_initDesktop()
226
{
227
  finalcut::FWidget::initDesktop();
228
}
229

230
//----------------------------------------------------------------------
231
inline void FWidget_protected::initLayout()
×
232
{
233
  finalcut::FWidget::initLayout();
×
234
}
×
235

236
//----------------------------------------------------------------------
237
inline void FWidget_protected::adjustSize()
×
238
{
239
  finalcut::FWidget::adjustSize();
×
240
}
×
241

242
//----------------------------------------------------------------------
243
inline void FWidget_protected::p_adjustSizeGlobal()
244
{
245
  finalcut::FWidget::adjustSizeGlobal();
246
}
247

248
//----------------------------------------------------------------------
249
inline void FWidget_protected::p_hideArea (const finalcut::FSize& size)
250
{
251
  finalcut::FWidget::hideArea (size);
252
}
253

254
//----------------------------------------------------------------------
255
inline auto FWidget_protected::event (finalcut::FEvent* ev) -> bool
98✔
256
{
257
  return finalcut::FWidget::event(ev);
98✔
258
}
259

260
//----------------------------------------------------------------------
261
inline void FWidget_protected::onKeyPress (finalcut::FKeyEvent*)
×
262
{
263
  setLastEvent (finalcut::Event::KeyPress);
×
264
}
×
265

266
//----------------------------------------------------------------------
267
inline void FWidget_protected::onKeyUp (finalcut::FKeyEvent*)
×
268
{
269
  setLastEvent (finalcut::Event::KeyUp);
×
270
}
×
271

272
//----------------------------------------------------------------------
273
inline void FWidget_protected::onKeyDown (finalcut::FKeyEvent*)
×
274
{
275
  setLastEvent (finalcut::Event::KeyDown);
×
276
}
×
277

278
//----------------------------------------------------------------------
279
inline void FWidget_protected::onMouseDown (finalcut::FMouseEvent*)
×
280
{
281
  setLastEvent (finalcut::Event::MouseDown);
×
282
}
×
283

284
//----------------------------------------------------------------------
285
inline void FWidget_protected::onMouseUp (finalcut::FMouseEvent*)
×
286
{
287
  setLastEvent (finalcut::Event::MouseUp);
×
288
}
×
289

290
//----------------------------------------------------------------------
291
inline void FWidget_protected::onMouseDoubleClick (finalcut::FMouseEvent*)
×
292
{
293
  setLastEvent (finalcut::Event::MouseDoubleClick);
×
294
}
×
295

296
//----------------------------------------------------------------------
297
inline void FWidget_protected::onWheel (finalcut::FWheelEvent*)
×
298
{
299
  setLastEvent (finalcut::Event::MouseWheel);
×
300
}
×
301

302
//----------------------------------------------------------------------
303
inline void FWidget_protected::onMouseMove (finalcut::FMouseEvent*)
×
304
{
305
  setLastEvent (finalcut::Event::MouseMove);
×
306
}
×
307

308
//----------------------------------------------------------------------
309
inline void FWidget_protected::onFocusIn (finalcut::FFocusEvent*)
24✔
310
{
311
  setLastEvent (finalcut::Event::FocusIn);
24✔
312
}
24✔
313

314
//----------------------------------------------------------------------
315
inline void FWidget_protected::onFocusOut (finalcut::FFocusEvent*)
24✔
316
{
317
  setLastEvent (finalcut::Event::FocusOut);
24✔
318
}
24✔
319

320
//----------------------------------------------------------------------
321
inline void FWidget_protected::onChildFocusIn (finalcut::FFocusEvent*)
24✔
322
{
323
  setLastEvent (finalcut::Event::ChildFocusIn);
24✔
324
}
24✔
325

326
//----------------------------------------------------------------------
327
inline void FWidget_protected::onChildFocusOut (finalcut::FFocusEvent*)
24✔
328
{
329
  setLastEvent (finalcut::Event::ChildFocusOut);
24✔
330
}
24✔
331

332
//----------------------------------------------------------------------
333
inline void FWidget_protected::onFailAtChildFocus (finalcut::FFocusEvent*)
2✔
334
{
335
  setLastEvent (finalcut::Event::FailAtChildFocus);
2✔
336
}
2✔
337

338
//----------------------------------------------------------------------
339
inline void FWidget_protected::onAccel (finalcut::FAccelEvent*)
×
340
{
341
  setLastEvent (finalcut::Event::Accelerator);
×
342
}
×
343

344
//----------------------------------------------------------------------
345
inline void FWidget_protected::onResize (finalcut::FResizeEvent*)
×
346
{
347
  setLastEvent (finalcut::Event::Resize);
×
348
}
×
349

350
//----------------------------------------------------------------------
351
inline void FWidget_protected::onShow (finalcut::FShowEvent*)
×
352
{
353
  setLastEvent (finalcut::Event::Show);
×
354
}
×
355

356
//----------------------------------------------------------------------
357
inline void FWidget_protected::onHide (finalcut::FHideEvent*)
×
358
{
359
  setLastEvent (finalcut::Event::Hide);
×
360
}
×
361

362
//----------------------------------------------------------------------
363
inline void FWidget_protected::onClose (finalcut::FCloseEvent*)
×
364
{
365
  setLastEvent (finalcut::Event::Close);
×
366
}
×
367

368
//----------------------------------------------------------------------
369
void FWidget_protected::p_setWidgetProperty (bool property)
8✔
370
{
371
  finalcut::FObject::setWidgetProperty (property);
8✔
372
}
8✔
373

374
//----------------------------------------------------------------------
375
// class FWidgetTest
376
//----------------------------------------------------------------------
377

378
class FWidgetTest : public CPPUNIT_NS::TestFixture
379
{
380
  public:
381
    FWidgetTest() = default;
10✔
382

383
  protected:
384
    void classNameTest();
385
    void noArgumentTest();
386
    void colorThemeTest();
387
    void resetColorsTest();
388
    void acceleratorTest();
389
    void PosAndSizeTest();
390
    void focusableChildrenTest();
391
    void closeWidgetTest();
392
    void adjustSizeTest();
393
    void callbackTest();
394

395
  private:
396
    class FSystemTest;
397

398
    // Adds code needed to register the test suite
399
    CPPUNIT_TEST_SUITE (FWidgetTest);
2✔
400

401
    // Add a methods to the test suite
402
    CPPUNIT_TEST (classNameTest);
2✔
403
    CPPUNIT_TEST (noArgumentTest);
2✔
404
    CPPUNIT_TEST (colorThemeTest);
2✔
405
    CPPUNIT_TEST (resetColorsTest);
2✔
406
    CPPUNIT_TEST (acceleratorTest);
2✔
407
    CPPUNIT_TEST (PosAndSizeTest);
2✔
408
    CPPUNIT_TEST (focusableChildrenTest);
2✔
409
    CPPUNIT_TEST (closeWidgetTest);
2✔
410
    CPPUNIT_TEST (adjustSizeTest);
2✔
411
    CPPUNIT_TEST (callbackTest);
2✔
412

413
    // End of test suite definition
414
    CPPUNIT_TEST_SUITE_END();
3✔
415
};
416

417

418
//----------------------------------------------------------------------
419
// class FWidgetTest::FSystemTest
420
//----------------------------------------------------------------------
421

422
class FWidgetTest::FSystemTest : public finalcut::FSystem
423
{
424
  public:
425
    // Constructor
426
    FSystemTest() = default;
3✔
427

428
    // Methods
429
    auto inPortByte (uShort) noexcept -> uChar override
×
430
    {
431
      return 0;
×
432
    }
433

434
    void outPortByte (uChar, uShort) noexcept override
×
435
    { }
×
436

437
    auto isTTY (int) const noexcept -> int override
×
438
    {
439
      return 1;
×
440
    }
441

442
    auto ioctl (int, uLong request, ...) noexcept -> int override
13✔
443
    {
444
      va_list args{};
13✔
445
      void* argp{};
13✔
446
      int ret_val{-1};
13✔
447

448
      va_start (args, request);
13✔
449
      argp = va_arg (args, void*);
13✔
450

451
      switch ( request )
13✔
452
      {
453
        case TIOCGWINSZ:
13✔
454
          auto win_size = static_cast<winsize*>(argp);
13✔
455
          win_size->ws_col = screen_size.getWidth();
13✔
456
          win_size->ws_row = screen_size.getHeight();
13✔
457
          ret_val = 0;
13✔
458
          break;
13✔
459
      }
460

461
      va_end (args);
13✔
462
      return ret_val;
13✔
463
    }
464

465
    auto pipe (finalcut::PipeData&) noexcept -> int override
×
466
    {
467
      return 0;
×
468
    }
469

470
    auto open (const char*, int, ...) noexcept -> int override
×
471
    {
472
      return 0;
×
473
    }
474

475
    auto close (int) noexcept -> int override
×
476
    {
477
      return 0;
×
478
    }
479

480
    auto fopen (const char*, const char*) noexcept -> FILE* override
×
481
    {
482
      return nullptr;
×
483
    }
484

485
    auto fputs (const char* str, FILE* stream) noexcept -> int override
×
486
    {
487
      return std::fputs(str, stream);
×
488
    }
489

490
    auto fclose (FILE*) noexcept -> int override
×
491
    {
492
      return 0;
×
493
    }
494

495
    auto putchar (int c) noexcept -> int override
×
496
    {
497
#if defined(__sun) && defined(__SVR4)
498
      return std::putchar(char(c));
499
#else
500
      return std::putchar(c);
×
501
#endif
502
    }
503

504
    auto putstring (const char* str, std::size_t len) noexcept -> int
×
505
    {
506
      return std::fwrite(str, 1, len, stdout);
×
507
    }
508

509
    auto sigaction (int, const struct sigaction*, struct sigaction*) noexcept -> int override
×
510
    {
511
      return 0;
×
512
    }
513

514
    auto timer_create (clockid_t, struct sigevent*, timer_t*) noexcept -> int override
×
515
    {
516
      return 0;
×
517
    }
518

519
    auto timer_settime ( timer_t, int
×
520
                       , const struct itimerspec*
521
                       , struct itimerspec* ) noexcept -> int override
522
    {
523
      return 0;
×
524
    }
525

526
    auto timer_delete (timer_t) noexcept -> int override
×
527
    {
528
      return 0;
×
529
    }
530

531
    auto kqueue() noexcept -> int override
×
532
    {
533
      return 0;
×
534
    }
535

536
    auto kevent ( int, const struct kevent*
×
537
                , int, struct kevent*
538
                , int, const struct timespec* ) noexcept -> int override
539
    {
540
      return 0;
×
541
    }
542

543
    auto getuid() noexcept -> uid_t override
×
544
    {
545
      return 0;
×
546
    }
547

548
    auto geteuid() noexcept -> uid_t override
×
549
    {
550
      return 0;
×
551
    }
552

553
    auto getpwuid_r ( uid_t, struct passwd*, char*
×
554
                   , size_t, struct passwd** ) noexcept -> int override
555
    {
556
      return 0;
×
557
    }
558

559
    auto realpath (const char*, char*) noexcept -> char* override
×
560
    {
561
      return const_cast<char*>("");
×
562
    }
563

564
    void setScreenSize (finalcut::FSize size) noexcept
1✔
565
    {
566
      screen_size = size;
1✔
567
    }
1✔
568

569
  private:
570
    static finalcut::FSize screen_size;
571
};
572

573
// static class attribute
574
//----------------------------------------------------------------------
575
finalcut::FSize FWidgetTest::FSystemTest::screen_size = finalcut::FSize(80, 24);
576

577
//----------------------------------------------------------------------
578
void FWidgetTest::classNameTest()
1✔
579
{
580
  finalcut::FWidget w{nullptr};
1✔
581
  const finalcut::FString& classname = w.getClassName();
1✔
582
  CPPUNIT_ASSERT ( classname == "FWidget" );
6✔
583
  CPPUNIT_ASSERT ( w.getRootWidget() == &w );
5✔
584
}
1✔
585

586
//----------------------------------------------------------------------
587
void FWidgetTest::noArgumentTest()
1✔
588
{
589
  std::unique_ptr<finalcut::FSystem> fsys = std::make_unique<FSystemTest>();
1✔
590
  finalcut::FTerm::setFSystem(fsys);
1✔
591

592
  {
593
    // First root object
594
    finalcut::FWidget wdgt1{};
1✔
595
    CPPUNIT_ASSERT ( wdgt1.getRootWidget() == &wdgt1 );
6✔
596
    CPPUNIT_ASSERT ( wdgt1.getParentWidget() == nullptr );
5✔
597

598
    // Second root object
599
    finalcut::FWidget wdgt2{};
1✔
600
    CPPUNIT_ASSERT ( wdgt2.getRootWidget() == &wdgt2 );
5✔
601

602
    std::cout << "\n-> An exit error message should be displayed:\n";
1✔
603
  }
1✔
604

605
  // Root widget
606
  finalcut::FWidget root_wdgt{};
1✔
607
  CPPUNIT_ASSERT ( root_wdgt.getRootWidget() == &root_wdgt );
6✔
608
  CPPUNIT_ASSERT ( root_wdgt.getParentWidget() == nullptr );
6✔
609
  CPPUNIT_ASSERT ( root_wdgt.getMainWidget() == nullptr );
6✔
610
  CPPUNIT_ASSERT ( root_wdgt.getActiveWindow() == nullptr );
6✔
611
  CPPUNIT_ASSERT ( root_wdgt.getFocusWidget() == nullptr );
6✔
612
  CPPUNIT_ASSERT ( root_wdgt.getClickedWidget() == nullptr );
6✔
613
  CPPUNIT_ASSERT ( root_wdgt.getOpenMenu() == nullptr );
6✔
614
  CPPUNIT_ASSERT ( root_wdgt.getMoveResizeWidget() == nullptr );
6✔
615
  CPPUNIT_ASSERT ( root_wdgt.getMenuBar() == nullptr );
6✔
616
  CPPUNIT_ASSERT ( root_wdgt.getStatusBar() == nullptr );
5✔
617

618
  // Child widget
619
  finalcut::FWidget wdgt{&root_wdgt};
1✔
620
  CPPUNIT_ASSERT ( wdgt.getRootWidget() == &root_wdgt );
6✔
621
  CPPUNIT_ASSERT ( wdgt.getParentWidget() == &root_wdgt );
6✔
622
  CPPUNIT_ASSERT ( wdgt.getMainWidget() == nullptr );
6✔
623

624
  // Set active window
625
  CPPUNIT_ASSERT ( wdgt.getActiveWindow() == nullptr );
5✔
626
  wdgt.setActiveWindow(&wdgt);
1✔
627
  CPPUNIT_ASSERT ( wdgt.getActiveWindow() == &wdgt );
6✔
628

629
  // Set focus widget
630
  CPPUNIT_ASSERT ( wdgt.getFocusWidget() == nullptr );
5✔
631
  wdgt.setFocusWidget(&wdgt);
1✔
632
  CPPUNIT_ASSERT ( wdgt.getFocusWidget() == &wdgt );
6✔
633

634
  // Set clicked widget
635
  CPPUNIT_ASSERT ( wdgt.getClickedWidget() == nullptr );
5✔
636
  wdgt.setClickedWidget(&wdgt);
1✔
637
  CPPUNIT_ASSERT ( wdgt.getClickedWidget() == &wdgt );
6✔
638

639
  // Set open menu
640
  CPPUNIT_ASSERT ( wdgt.getOpenMenu() == nullptr );
5✔
641
  wdgt.setOpenMenu(&wdgt);
1✔
642
  CPPUNIT_ASSERT ( wdgt.getOpenMenu() == &wdgt );
6✔
643

644
  // Set the moving or resizing widget
645
  CPPUNIT_ASSERT ( wdgt.getMoveResizeWidget() == nullptr );
5✔
646
  wdgt.setMoveSizeWidget(&wdgt);
1✔
647
  CPPUNIT_ASSERT ( wdgt.getMoveResizeWidget() == &wdgt );
6✔
648

649
  // Menu bar and status bar
650
  CPPUNIT_ASSERT ( wdgt.getMenuBar() == nullptr );
6✔
651
  CPPUNIT_ASSERT ( wdgt.getStatusBar() == nullptr );
5✔
652

653
  // Set main widget
654
  wdgt.setMainWidget(&wdgt);
1✔
655
  CPPUNIT_ASSERT ( wdgt.getMainWidget() != nullptr );
6✔
656
  CPPUNIT_ASSERT ( wdgt.getMainWidget() == &wdgt );
6✔
657
  CPPUNIT_ASSERT ( root_wdgt.getMainWidget() == &wdgt );
6✔
658

659
  // Test the status bar message
660
  CPPUNIT_ASSERT ( wdgt.getStatusbarMessage().isEmpty() );
5✔
661
  wdgt.setStatusbarMessage("message");
1✔
662
  CPPUNIT_ASSERT ( ! wdgt.getStatusbarMessage().isEmpty() );
6✔
663
  CPPUNIT_ASSERT ( wdgt.getStatusbarMessage() == "message" );
5✔
664
  wdgt.clearStatusbarMessage();
1✔
665
  CPPUNIT_ASSERT ( wdgt.getStatusbarMessage().isEmpty() );
6✔
666
  CPPUNIT_ASSERT ( wdgt.getStatusbarMessage().isEmpty() );
6✔
667

668
  // Test the primary widget colors
669
  CPPUNIT_ASSERT ( wdgt.getForegroundColor() == finalcut::FColor::Default );
6✔
670
  CPPUNIT_ASSERT ( wdgt.getBackgroundColor() == finalcut::FColor::Default );
5✔
671
  wdgt.setColor();
1✔
672
  CPPUNIT_ASSERT ( wdgt.getTermForegroundColor() == finalcut::FColor::Default );
6✔
673
  CPPUNIT_ASSERT ( wdgt.getTermBackgroundColor() == finalcut::FColor::Default );
5✔
674
  wdgt.setForegroundColor(finalcut::FColor::White);
1✔
675
  wdgt.setBackgroundColor(finalcut::FColor::DarkSeaGreen5);
1✔
676
  CPPUNIT_ASSERT ( wdgt.getForegroundColor() == finalcut::FColor::White );
6✔
677
  CPPUNIT_ASSERT ( wdgt.getBackgroundColor() == finalcut::FColor::DarkSeaGreen5 );
5✔
678
  wdgt.setColor();
1✔
679
  CPPUNIT_ASSERT ( wdgt.getTermForegroundColor() == finalcut::FColor::White );
6✔
680
  CPPUNIT_ASSERT ( wdgt.getTermBackgroundColor() == finalcut::FColor::DarkSeaGreen5 );
5✔
681
  wdgt.setForegroundColor(finalcut::FColor(256));  // FColor value > 255
1✔
682
  wdgt.setBackgroundColor(finalcut::FColor(257));  // FColor value > 255
1✔
683
  CPPUNIT_ASSERT ( wdgt.getForegroundColor() == finalcut::FColor::White );
6✔
684
  CPPUNIT_ASSERT ( wdgt.getBackgroundColor() == finalcut::FColor::DarkSeaGreen5 );
6✔
685

686
  // Parent widget color
687
  CPPUNIT_ASSERT ( root_wdgt.getForegroundColor() == finalcut::FColor::Default );
6✔
688
  CPPUNIT_ASSERT ( root_wdgt.getBackgroundColor() == finalcut::FColor::Default );
5✔
689
  root_wdgt.useParentWidgetColor();
1✔
690
  CPPUNIT_ASSERT ( root_wdgt.getForegroundColor() == finalcut::FColor::Black );
6✔
691
  CPPUNIT_ASSERT ( root_wdgt.getBackgroundColor() == finalcut::FColor::LightGray );
6✔
692
  CPPUNIT_ASSERT ( root_wdgt.getTermForegroundColor() == finalcut::FColor::Black );
6✔
693
  CPPUNIT_ASSERT ( root_wdgt.getTermBackgroundColor() == finalcut::FColor::LightGray );
5✔
694
  root_wdgt.setForegroundColor(finalcut::FColor::Yellow);
1✔
695
  root_wdgt.setBackgroundColor(finalcut::FColor::DarkBlue);
1✔
696
  wdgt.useParentWidgetColor();
1✔
697
  CPPUNIT_ASSERT ( wdgt.getForegroundColor() == finalcut::FColor::Yellow );
6✔
698
  CPPUNIT_ASSERT ( wdgt.getBackgroundColor() == finalcut::FColor::DarkBlue );
6✔
699
  CPPUNIT_ASSERT ( wdgt.getTermForegroundColor() == finalcut::FColor::Yellow );
6✔
700
  CPPUNIT_ASSERT ( wdgt.getTermBackgroundColor() == finalcut::FColor::DarkBlue );
5✔
701

702
  // Get and set double flat line
703
  auto& top = wdgt.doubleFlatLine_ref(finalcut::Side::Top);
1✔
704
  auto& right = wdgt.doubleFlatLine_ref(finalcut::Side::Right);
1✔
705
  auto& bottom = wdgt.doubleFlatLine_ref(finalcut::Side::Bottom);
1✔
706
  auto& left = wdgt.doubleFlatLine_ref(finalcut::Side::Left);
1✔
707
  CPPUNIT_ASSERT_THROW ( wdgt.doubleFlatLine_ref(static_cast<finalcut::Side>(99))
5✔
708
                       , std::invalid_argument );
709
  CPPUNIT_ASSERT ( top.size() == 1 );
6✔
710
  CPPUNIT_ASSERT ( right.size() == 1 );
6✔
711
  CPPUNIT_ASSERT ( bottom.size() == 1 );
6✔
712
  CPPUNIT_ASSERT ( left.size() == 1 );
6✔
713
  CPPUNIT_ASSERT ( top[0] == false );
6✔
714
  CPPUNIT_ASSERT ( right[0] == false );
6✔
715
  CPPUNIT_ASSERT ( bottom[0] == false );
6✔
716
  CPPUNIT_ASSERT ( left[0] == false );
5✔
717
  wdgt.setDoubleFlatLine(finalcut::Side::Top);
1✔
718
  CPPUNIT_ASSERT ( top[0] == true );
5✔
719
  wdgt.setDoubleFlatLine(finalcut::Side::Right);
1✔
720
  CPPUNIT_ASSERT ( right[0] == true );
5✔
721
  wdgt.setDoubleFlatLine(finalcut::Side::Bottom);
1✔
722
  CPPUNIT_ASSERT ( bottom[0] == true );
5✔
723
  wdgt.setDoubleFlatLine(finalcut::Side::Left);
1✔
724
  CPPUNIT_ASSERT ( left[0] == true );
5✔
725
  top[0] = false;
1✔
726
  right[0] = false;
1✔
727
  bottom[0] = false;
1✔
728
  left[0] = false;
1✔
729
  CPPUNIT_ASSERT ( top[0] == false );
6✔
730
  CPPUNIT_ASSERT ( right[0] == false );
6✔
731
  CPPUNIT_ASSERT ( bottom[0] == false );
6✔
732
  CPPUNIT_ASSERT ( left[0] == false );
5✔
733
  CPPUNIT_ASSERT_THROW ( wdgt.setDoubleFlatLine(static_cast<finalcut::Side>(99))
5✔
734
                       , std::invalid_argument );
735
  CPPUNIT_ASSERT ( top[0] == false );
6✔
736
  CPPUNIT_ASSERT ( right[0] == false );
6✔
737
  CPPUNIT_ASSERT ( bottom[0] == false );
6✔
738
  CPPUNIT_ASSERT ( left[0] == false );
6✔
739

740
  // Positioning and sizes
741
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
742
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
743
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
744
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
745
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
746
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
747
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
748
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
749
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
6✔
750
  CPPUNIT_ASSERT ( wdgt.getTopPadding() == 0 );
6✔
751
  CPPUNIT_ASSERT ( wdgt.getLeftPadding() == 0 );
6✔
752
  CPPUNIT_ASSERT ( wdgt.getBottomPadding() == 0 );
6✔
753
  CPPUNIT_ASSERT ( wdgt.getRightPadding() == 0 );
6✔
754
  CPPUNIT_ASSERT ( wdgt.getClientWidth() == 0 );
6✔
755
  CPPUNIT_ASSERT ( wdgt.getClientHeight() == 0 );
6✔
756
  CPPUNIT_ASSERT ( wdgt.getClientSize() == finalcut::FSize(0, 0) );
6✔
757
  CPPUNIT_ASSERT ( wdgt.getMaxWidth() == 80 );
6✔
758
  CPPUNIT_ASSERT ( wdgt.getMaxHeight() == 24 );
6✔
759
  CPPUNIT_ASSERT ( wdgt.getShadow() == finalcut::FSize(0, 0) );
6✔
760
  CPPUNIT_ASSERT ( wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(1, 1)) );
6✔
761
  CPPUNIT_ASSERT ( wdgt.getGeometryWithShadow() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(1, 1)) );
6✔
762
  CPPUNIT_ASSERT ( wdgt.getTermGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(1, 1)) );
6✔
763
  CPPUNIT_ASSERT ( wdgt.getTermGeometryWithShadow() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(1, 1)) );
6✔
764
  CPPUNIT_ASSERT ( wdgt.getDesktopWidth() == 80 );
6✔
765
  CPPUNIT_ASSERT ( wdgt.getDesktopHeight() == 24 );
6✔
766
  CPPUNIT_ASSERT ( wdgt.getCursorPos() == finalcut::FPoint(-1, -1) );
6✔
767
  CPPUNIT_ASSERT ( wdgt.getPrintPos() == finalcut::FPoint(0, 0) );
5✔
768
  wdgt.setPrintPos(finalcut::FPoint(30, 10));
1✔
769
  CPPUNIT_ASSERT ( wdgt.getPrintPos() == finalcut::FPoint(30, 10) );
5✔
770
  wdgt.setPrintPos(finalcut::FPoint(-3, -10));
1✔
771
  CPPUNIT_ASSERT ( wdgt.getPrintPos() == finalcut::FPoint(-3, -10) );
6✔
772

773
  // Widget flags
774
  CPPUNIT_ASSERT ( wdgt.getFlags().shadow.shadow == false );
6✔
775
  CPPUNIT_ASSERT ( wdgt.getFlags().shadow.trans_shadow == false );
6✔
776
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.active == true );
6✔
777
  CPPUNIT_ASSERT ( wdgt.isEnabled() );
6✔
778
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.visible == true );
6✔
779
  CPPUNIT_ASSERT ( wdgt.isVisible() );
6✔
780
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.shown == false );
6✔
781
  CPPUNIT_ASSERT ( ! wdgt.isShown() );
6✔
782
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.hidden == false );
6✔
783
  CPPUNIT_ASSERT ( ! wdgt.isHidden() );
6✔
784
  CPPUNIT_ASSERT ( wdgt.getFlags().focus.focus == false );
6✔
785
  CPPUNIT_ASSERT ( ! wdgt.hasFocus() );
6✔
786
  CPPUNIT_ASSERT ( wdgt.getFlags().focus.focusable == true );
6✔
787
  CPPUNIT_ASSERT ( wdgt.acceptFocus() );
6✔
788
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.scrollable == false );
6✔
789
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.resizeable == false );
6✔
790
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.minimizable == false );
6✔
791
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.modal == false );
6✔
792
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.visible_cursor == false );
6✔
793
  CPPUNIT_ASSERT ( ! wdgt.hasVisibleCursor() );
6✔
794
  CPPUNIT_ASSERT ( wdgt.getFlags().type.window_widget == false );
6✔
795
  CPPUNIT_ASSERT ( ! wdgt.isWindowWidget() );
6✔
796
  CPPUNIT_ASSERT ( wdgt.getFlags().type.dialog_widget == false );
6✔
797
  CPPUNIT_ASSERT ( ! wdgt.isDialogWidget() );
6✔
798
  CPPUNIT_ASSERT ( wdgt.getFlags().type.menu_widget == false );
6✔
799
  CPPUNIT_ASSERT ( ! wdgt.isMenuWidget() );
6✔
800
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.always_on_top == false );
6✔
801
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.flat == false );
6✔
802
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.no_border == false );
6✔
803
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.no_underline == false );
6✔
804
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.ignore_padding == false );
5✔
805

806
  wdgt.setVisible(false);
1✔
807
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.visible == false );
6✔
808
  CPPUNIT_ASSERT ( ! wdgt.isVisible() );
5✔
809
  wdgt.setVisible(true);
1✔
810
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.visible == true );
6✔
811
  CPPUNIT_ASSERT ( wdgt.isVisible() );
5✔
812
  wdgt.unsetVisible();
1✔
813
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.visible == false );
6✔
814
  CPPUNIT_ASSERT ( ! wdgt.isVisible() );
5✔
815
  wdgt.setVisible();
1✔
816
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.visible == true );
6✔
817
  CPPUNIT_ASSERT ( wdgt.isVisible() );
5✔
818

819
  wdgt.setEnable(false);
1✔
820
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.active == false );
5✔
821
  wdgt.setEnable(true);
1✔
822
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.active == true );
5✔
823
  wdgt.unsetEnable();
1✔
824
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.active == false );
5✔
825
  wdgt.setEnable();
1✔
826
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.active == true );
5✔
827
  wdgt.setDisable();
1✔
828
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.active == false );
5✔
829

830
  wdgt.setVisibleCursor(false);
1✔
831
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.visible_cursor == false );
5✔
832
  wdgt.setVisibleCursor(true);
1✔
833
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.visible_cursor == true );
5✔
834
  wdgt.unsetVisibleCursor();
1✔
835
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.visible_cursor == false );
5✔
836
  wdgt.setVisibleCursor();
1✔
837
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.visible_cursor == true );
5✔
838

839
  wdgt.setFocus(false);
1✔
840
  CPPUNIT_ASSERT ( wdgt.getFlags().focus.focus == false );
5✔
841
  wdgt.setFocus(true);
1✔
842
  CPPUNIT_ASSERT ( wdgt.getFlags().focus.focus == false );
5✔
843
  wdgt.setEnable();
1✔
844
  wdgt.setFocus(true);
1✔
845
  CPPUNIT_ASSERT ( wdgt.getFlags().focus.focus == true );
5✔
846
  wdgt.unsetFocus();
1✔
847
  CPPUNIT_ASSERT ( wdgt.getFlags().focus.focus == false );
5✔
848
  wdgt.setFocus();
1✔
849
  CPPUNIT_ASSERT ( wdgt.getFlags().focus.focus == true );
5✔
850

851
  wdgt.setFocusable(false);
1✔
852
  CPPUNIT_ASSERT ( wdgt.getFlags().focus.focusable == false );
5✔
853
  wdgt.setFocusable(true);
1✔
854
  CPPUNIT_ASSERT ( wdgt.getFlags().focus.focusable == true );
5✔
855
  wdgt.unsetFocusable();
1✔
856
  CPPUNIT_ASSERT ( wdgt.getFlags().focus.focusable == false );
5✔
857
  wdgt.setFocusable();
1✔
858
  CPPUNIT_ASSERT ( wdgt.getFlags().focus.focusable == true );
5✔
859

860
  wdgt.ignorePadding(false);
1✔
861
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.ignore_padding == false );
6✔
862
  CPPUNIT_ASSERT ( ! wdgt.isPaddingIgnored() );
5✔
863
  wdgt.ignorePadding(true);
1✔
864
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.ignore_padding == true );
6✔
865
  CPPUNIT_ASSERT ( wdgt.isPaddingIgnored() );
5✔
866
  wdgt.acceptPadding();
1✔
867
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.ignore_padding == false );
6✔
868
  CPPUNIT_ASSERT ( ! wdgt.isPaddingIgnored() );
5✔
869
  wdgt.ignorePadding();
1✔
870
  CPPUNIT_ASSERT ( wdgt.getFlags().feature.ignore_padding == true );
6✔
871
  CPPUNIT_ASSERT ( wdgt.isPaddingIgnored() );
5✔
872
}
1✔
873

874
//----------------------------------------------------------------------
875
void FWidgetTest::colorThemeTest()
1✔
876
{
877
  {
878
    finalcut::FWidget root_wdgt{};  // Root widget
1✔
879

880
    // Get color theme
881
    const auto& color_theme = root_wdgt.getColorTheme();
1✔
882
    CPPUNIT_ASSERT ( finalcut::FVTerm::getFOutput()->getMaxColor() == 1 );
6✔
883
    // Less than 16 colors -> default8ColorTheme
884
    CPPUNIT_ASSERT ( color_theme->term.fg == finalcut::FColor::LightGray );
6✔
885
    CPPUNIT_ASSERT ( color_theme->term.bg == finalcut::FColor::Blue );
5✔
886
  }
1✔
887

888
  {
889
    finalcut::FTermcap::max_color = 8;
1✔
890
    finalcut::FWidget root_wdgt{};  // Root widget
1✔
891

892
    // Get color theme
893
    const auto& color_theme = root_wdgt.getColorTheme();
1✔
894
    CPPUNIT_ASSERT ( finalcut::FVTerm::getFOutput()->getMaxColor() == 8 );
6✔
895
    // Less than 16 colors -> default8ColorTheme
896
    CPPUNIT_ASSERT ( color_theme->term.fg == finalcut::FColor::LightGray );
6✔
897
    CPPUNIT_ASSERT ( color_theme->term.bg == finalcut::FColor::Blue );
5✔
898
  }
1✔
899

900
  {
901
    finalcut::FTermcap::max_color = 16;
1✔
902
    finalcut::FWidget root_wdgt{};  // Root widget
1✔
903

904
    // Get color theme
905
    const auto& color_theme = root_wdgt.getColorTheme();
1✔
906
    CPPUNIT_ASSERT ( finalcut::FVTerm::getFOutput()->getMaxColor() == 16 );
6✔
907
    // At least 16 colors or more -> default16ColorTheme
908
    CPPUNIT_ASSERT ( color_theme->term.fg == finalcut::FColor::Black );
6✔
909
    CPPUNIT_ASSERT ( color_theme->term.bg == finalcut::FColor::LightBlue );
5✔
910
  }
1✔
911
}
1✔
912

913
//----------------------------------------------------------------------
914
void FWidgetTest::resetColorsTest()
1✔
915
{
916
  finalcut::FWidget root_wdgt{};  // Root widget
1✔
917

918
  class TestWidget : public finalcut::FWidget
919
  {
920
    public:
921
      explicit TestWidget (finalcut::FWidget* parent = nullptr)
1✔
922
        : finalcut::FWidget{parent}
1✔
923
      { }
1✔
924

925
      TestWidget (const TestWidget&) = delete;
926

927
      TestWidget (TestWidget&&) noexcept = delete;
928

929
      ~TestWidget() override = default;
1✔
930

931
      void resetColors() override
1✔
932
      {
933
        const auto& wc = getColorTheme();
1✔
934
        setForegroundColor (wc->dialog.fg);
1✔
935
        setBackgroundColor (wc->dialog.bg);
1✔
936
        FWidget::resetColors();
1✔
937
      }
1✔
938
  };
939

940
  TestWidget wdgt{&root_wdgt};  // Child widget
1✔
941

942
  CPPUNIT_ASSERT ( root_wdgt.getForegroundColor() == finalcut::FColor::Default );
6✔
943
  CPPUNIT_ASSERT ( root_wdgt.getBackgroundColor() == finalcut::FColor::Default );
6✔
944
  CPPUNIT_ASSERT ( wdgt.getForegroundColor() == finalcut::FColor::Default );
6✔
945
  CPPUNIT_ASSERT ( wdgt.getBackgroundColor() == finalcut::FColor::Default );
5✔
946

947
  root_wdgt.resetColors();
1✔
948
  CPPUNIT_ASSERT ( root_wdgt.getForegroundColor() == finalcut::FColor::Default );
6✔
949
  CPPUNIT_ASSERT ( root_wdgt.getBackgroundColor() == finalcut::FColor::Default );
6✔
950
  CPPUNIT_ASSERT ( wdgt.getForegroundColor() == finalcut::FColor::Black );
6✔
951
  CPPUNIT_ASSERT ( wdgt.getBackgroundColor() == finalcut::FColor::White );
5✔
952
}
1✔
953

954
//----------------------------------------------------------------------
955
void FWidgetTest::acceleratorTest()
1✔
956
{
957
  finalcut::FWidget root_wdgt{};  // Root widget
1✔
958
  finalcut::FWidget wdgt{&root_wdgt};  // Child widget
1✔
959
  auto& accelerator_list = root_wdgt.getAcceleratorList();
1✔
960
  CPPUNIT_ASSERT ( accelerator_list.size() == 0 );
6✔
961

962
  CPPUNIT_ASSERT ( root_wdgt.getAcceleratorList().size() == 0 );
5✔
963
  finalcut::FWidget::FAcceleratorList new_accelerator_list =
964
      { {finalcut::FKey::Escape, &root_wdgt} };
2✔
965
  root_wdgt.setAcceleratorList() = new_accelerator_list;
1✔
966
  CPPUNIT_ASSERT ( root_wdgt.getAcceleratorList().size() == 1 );
6✔
967
  CPPUNIT_ASSERT ( root_wdgt.getAcceleratorList()[0].key == finalcut::FKey::Escape );
6✔
968
  CPPUNIT_ASSERT ( root_wdgt.getAcceleratorList()[0].object == &root_wdgt );
5✔
969

970
  wdgt.addAccelerator(finalcut::FKey::F1);
1✔
971
  CPPUNIT_ASSERT ( accelerator_list.size() == 2 );
6✔
972
  CPPUNIT_ASSERT ( accelerator_list[1].key == finalcut::FKey::F1 );
6✔
973
  CPPUNIT_ASSERT ( accelerator_list[1].object == &wdgt );
5✔
974

975
  wdgt.addAccelerator(finalcut::FKey::Menu, &root_wdgt);
1✔
976
  CPPUNIT_ASSERT ( accelerator_list.size() == 3 );
6✔
977
  CPPUNIT_ASSERT ( accelerator_list[2].key == finalcut::FKey::Menu );
6✔
978
  CPPUNIT_ASSERT ( accelerator_list[2].object == &root_wdgt );
6✔
979

980
  // Delete accelerator
981
  CPPUNIT_ASSERT ( accelerator_list.size() == 3 );
6✔
982
  CPPUNIT_ASSERT ( wdgt.getAcceleratorList().size() == 0 );
5✔
983
  root_wdgt.delAccelerator(&wdgt);
1✔
984
  CPPUNIT_ASSERT ( accelerator_list.size() == 2 );
6✔
985
  CPPUNIT_ASSERT ( wdgt.getAcceleratorList().size() == 0 );
5✔
986
  root_wdgt.delAccelerator(&wdgt);
1✔
987
  CPPUNIT_ASSERT ( accelerator_list.size() == 2 );
6✔
988
  CPPUNIT_ASSERT ( wdgt.getAcceleratorList().size() == 0 );
5✔
989
  root_wdgt.delAccelerator();
1✔
990
  CPPUNIT_ASSERT ( accelerator_list.size() == 0 );
6✔
991
  CPPUNIT_ASSERT ( wdgt.getAcceleratorList().size() == 0 );
5✔
992
  wdgt.setAcceleratorList() = std::move(new_accelerator_list);
1✔
993
  CPPUNIT_ASSERT ( wdgt.getAcceleratorList().size() == 1 );
5✔
994
  wdgt.delAccelerator();
1✔
995
  CPPUNIT_ASSERT ( wdgt.getAcceleratorList().size() == 1 );
5✔
996
  wdgt.setFlags().type.window_widget = true;
1✔
997
  wdgt.delAccelerator(&wdgt);
1✔
998
  CPPUNIT_ASSERT ( wdgt.getAcceleratorList().size() == 1 );
5✔
999
  wdgt.delAccelerator(&root_wdgt);
1✔
1000
  CPPUNIT_ASSERT ( wdgt.getAcceleratorList().size() == 0 );
5✔
1001
}
1✔
1002

1003
//----------------------------------------------------------------------
1004
void FWidgetTest::PosAndSizeTest()
1✔
1005
{
1006
  std::unique_ptr<finalcut::FSystem> fsys = std::make_unique<FSystemTest>();
1✔
1007
  finalcut::FTerm::setFSystem(fsys);
1✔
1008

1009
  finalcut::FWidget root_wdgt{};  // Root widget
1✔
1010
  finalcut::FWidget wdgt{&root_wdgt};  // Child widget
1✔
1011

1012
  CPPUNIT_ASSERT ( root_wdgt.getX() == 1 );
6✔
1013
  CPPUNIT_ASSERT ( root_wdgt.getY() == 1 );
6✔
1014
  CPPUNIT_ASSERT ( root_wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1015
  CPPUNIT_ASSERT ( root_wdgt.getTermX() == 1 );
6✔
1016
  CPPUNIT_ASSERT ( root_wdgt.getTermY() == 1 );
6✔
1017
  CPPUNIT_ASSERT ( root_wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1018
  CPPUNIT_ASSERT ( root_wdgt.getWidth() == 80 );
6✔
1019
  CPPUNIT_ASSERT ( root_wdgt.getHeight() == 24 );
6✔
1020
  CPPUNIT_ASSERT ( root_wdgt.getSize() == finalcut::FSize(80, 24) );
6✔
1021

1022
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1023
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1024
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1025
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1026
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1027
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1028
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1029
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1030
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
5✔
1031

1032
  wdgt.setX(1);
1✔
1033
  wdgt.setY(1);
1✔
1034
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1035
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1036
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1037
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1038
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1039
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1040
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1041
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1042
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
6✔
1043
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(1, 1)) == finalcut::FPoint(1, 1) );
5✔
1044

1045
  wdgt.setX(-1);
1✔
1046
  wdgt.setY(-1);
1✔
1047
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1048
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1049
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1050
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1051
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1052
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1053
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1054
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1055
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
6✔
1056
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(1, 1)) == finalcut::FPoint(1, 1) );
5✔
1057

1058
  wdgt.setFlags().type.window_widget = true;
1✔
1059
  wdgt.setX(-1);
1✔
1060
  wdgt.setY(-1);
1✔
1061
  CPPUNIT_ASSERT ( wdgt.getX() == -1 );
6✔
1062
  CPPUNIT_ASSERT ( wdgt.getY() == -1 );
6✔
1063
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(-1, -1) );
6✔
1064
  CPPUNIT_ASSERT ( wdgt.getTermX() == -1 );
6✔
1065
  CPPUNIT_ASSERT ( wdgt.getTermY() == -1 );
6✔
1066
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(-1, -1) );
6✔
1067
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1068
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1069
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
5✔
1070

1071
  wdgt.setX(5);
1✔
1072
  wdgt.setY(3);
1✔
1073
  CPPUNIT_ASSERT ( wdgt.getX() == 5 );
6✔
1074
  CPPUNIT_ASSERT ( wdgt.getY() == 3 );
6✔
1075
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(5, 3) );
6✔
1076
  CPPUNIT_ASSERT ( wdgt.getTermX() == 5 );
6✔
1077
  CPPUNIT_ASSERT ( wdgt.getTermY() == 3 );
6✔
1078
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(5, 3) );
6✔
1079
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1080
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1081
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
6✔
1082
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(3, 3)) == finalcut::FPoint(-1, 1) );
6✔
1083
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(2, 2)) == finalcut::FPoint(-2, 0) );
6✔
1084
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(1, 1)) == finalcut::FPoint(-3, -1) );
5✔
1085

1086
  wdgt.setPos(finalcut::FPoint(5, 3));
1✔
1087
  CPPUNIT_ASSERT ( wdgt.getX() == 5 );
6✔
1088
  CPPUNIT_ASSERT ( wdgt.getY() == 3 );
6✔
1089
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(5, 3) );
6✔
1090
  CPPUNIT_ASSERT ( wdgt.getTermX() == 5 );
6✔
1091
  CPPUNIT_ASSERT ( wdgt.getTermY() == 3 );
6✔
1092
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(5, 3) );
6✔
1093
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1094
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1095
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
6✔
1096
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(3, 3)) == finalcut::FPoint(-1, 1) );
6✔
1097
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(2, 2)) == finalcut::FPoint(-2, 0) );
6✔
1098
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(1, 1)) == finalcut::FPoint(-3, -1) );
5✔
1099

1100
  wdgt.setPos(finalcut::FPoint(20, 15));
1✔
1101
  CPPUNIT_ASSERT ( wdgt.getX() == 20 );
6✔
1102
  CPPUNIT_ASSERT ( wdgt.getY() == 15 );
6✔
1103
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(20, 15) );
6✔
1104
  CPPUNIT_ASSERT ( wdgt.getTermX() == 20 );
6✔
1105
  CPPUNIT_ASSERT ( wdgt.getTermY() == 15 );
6✔
1106
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(20, 15) );
6✔
1107
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1108
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1109
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
5✔
1110

1111
  wdgt.setPos(finalcut::FPoint(-5, -7));
1✔
1112
  CPPUNIT_ASSERT ( wdgt.getX() == -5 );
6✔
1113
  CPPUNIT_ASSERT ( wdgt.getY() == -7 );
6✔
1114
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(-5, -7) );
6✔
1115
  CPPUNIT_ASSERT ( wdgt.getTermX() == -5 );
6✔
1116
  CPPUNIT_ASSERT ( wdgt.getTermY() == -7 );
6✔
1117
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(-5, -7) );
6✔
1118
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1119
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1120
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
5✔
1121

1122
  wdgt.setFlags().type.window_widget = false;
1✔
1123
  wdgt.setPos(finalcut::FPoint(-9, -6));
1✔
1124
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1125
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1126
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1127
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1128
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1129
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1130
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1131
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1132
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
6✔
1133
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 1 );
6✔
1134
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 1 );
6✔
1135
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 1 );
6✔
1136
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 1 );
5✔
1137

1138
  wdgt.setWidth(1);
1✔
1139
  wdgt.setHeight(1);
1✔
1140
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1141
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1142
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1143
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1144
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1145
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1146
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1147
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1148
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
6✔
1149
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 1 );
6✔
1150
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 1 );
6✔
1151
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 1 );
6✔
1152
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 1 );
5✔
1153

1154
  wdgt.setFlags().type.window_widget = true;
1✔
1155
  wdgt.setWidth(0);
1✔
1156
  wdgt.setHeight(0);
1✔
1157
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1158
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1159
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1160
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1161
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1162
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1163
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1164
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1165
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
6✔
1166
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 1 );
6✔
1167
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 1 );
6✔
1168
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 1 );
6✔
1169
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 1 );
5✔
1170

1171
  wdgt.setWidth(400);
1✔
1172
  wdgt.setHeight(100);
1✔
1173
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1174
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1175
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1176
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1177
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1178
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1179
  CPPUNIT_ASSERT ( wdgt.getWidth() == 400 );
6✔
1180
  CPPUNIT_ASSERT ( wdgt.getHeight() == 100 );
6✔
1181
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(400, 100) );
6✔
1182
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 400 );
6✔
1183
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 100 );
6✔
1184
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 400 );
6✔
1185
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 100 );
5✔
1186

1187
  wdgt.setSize(finalcut::FSize(400, 100));
1✔
1188
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1189
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1190
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1191
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1192
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1193
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1194
  CPPUNIT_ASSERT ( wdgt.getWidth() == 400 );
6✔
1195
  CPPUNIT_ASSERT ( wdgt.getHeight() == 100 );
6✔
1196
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(400, 100) );
6✔
1197
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 400 );
6✔
1198
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 100 );
6✔
1199
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 400 );
6✔
1200
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 100 );
5✔
1201

1202
  wdgt.setSize(finalcut::FSize(0, 0));
1✔
1203
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1204
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1205
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1206
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1207
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1208
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1209
  CPPUNIT_ASSERT ( wdgt.getWidth() == 1 );
6✔
1210
  CPPUNIT_ASSERT ( wdgt.getHeight() == 1 );
6✔
1211
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(1, 1) );
6✔
1212
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 1 );
6✔
1213
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 1 );
6✔
1214
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 1 );
6✔
1215
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 1 );
5✔
1216

1217
  wdgt.setSize(finalcut::FSize(64, 13));
1✔
1218
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1219
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1220
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1221
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1222
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1223
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1224
  CPPUNIT_ASSERT ( wdgt.getWidth() == 64 );
6✔
1225
  CPPUNIT_ASSERT ( wdgt.getHeight() == 13 );
6✔
1226
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(64, 13) );
6✔
1227
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 64 );
6✔
1228
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 13 );
6✔
1229
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 64 );
6✔
1230
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 13 );
5✔
1231

1232
  // Tests with minimum and maximum
1233
  wdgt.setMinimumWidth(40);
1✔
1234
  wdgt.setMinimumHeight(10);
1✔
1235
  wdgt.setMaximumWidth(80);
1✔
1236
  wdgt.setMaximumHeight(24);
1✔
1237
  wdgt.setSize(finalcut::FSize(800, 600));
1✔
1238
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1239
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1240
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1241
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1242
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1243
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1244
  CPPUNIT_ASSERT ( wdgt.getWidth() == 80 );
6✔
1245
  CPPUNIT_ASSERT ( wdgt.getHeight() == 24 );
6✔
1246
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(80, 24) );
6✔
1247
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 80 );
6✔
1248
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 24 );
6✔
1249
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 80 );
6✔
1250
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 24 );
5✔
1251

1252
  wdgt.setSize(finalcut::FSize(14, 7));
1✔
1253
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1254
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1255
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1256
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1257
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1258
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1259
  CPPUNIT_ASSERT ( wdgt.getWidth() == 40 );
6✔
1260
  CPPUNIT_ASSERT ( wdgt.getHeight() == 10 );
6✔
1261
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(40, 10) );
6✔
1262
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 40 );
6✔
1263
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 10 );
6✔
1264
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 40 );
6✔
1265
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 10 );
5✔
1266

1267
  wdgt.setWidth(1000);
1✔
1268
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1269
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1270
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1271
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1272
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1273
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1274
  CPPUNIT_ASSERT ( wdgt.getWidth() == 80 );
6✔
1275
  CPPUNIT_ASSERT ( wdgt.getHeight() == 10 );
6✔
1276
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(80, 10) );
6✔
1277
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 80 );
6✔
1278
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 10 );
6✔
1279
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 80 );
6✔
1280
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 10 );
5✔
1281

1282
  wdgt.setHeight(1000);
1✔
1283
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1284
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1285
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1286
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1287
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1288
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1289
  CPPUNIT_ASSERT ( wdgt.getWidth() == 80 );
6✔
1290
  CPPUNIT_ASSERT ( wdgt.getHeight() == 24 );
6✔
1291
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(80, 24) );
6✔
1292
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 80 );
6✔
1293
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 24 );
6✔
1294
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 80 );
6✔
1295
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 24 );
5✔
1296

1297
  wdgt.setMinimumSize( finalcut::FSize(60, 20) );
1✔
1298
  wdgt.setMaximumSize( finalcut::FSize(100, 40) );
1✔
1299
  wdgt.setWidth(999);
1✔
1300
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1301
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1302
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1303
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1304
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1305
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1306
  CPPUNIT_ASSERT ( wdgt.getWidth() == 100 );
6✔
1307
  CPPUNIT_ASSERT ( wdgt.getHeight() == 24 );
6✔
1308
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(100, 24) );
6✔
1309
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 100 );
6✔
1310
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 24 );
6✔
1311
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 100 );
6✔
1312
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 24 );
5✔
1313

1314
  wdgt.setWidth(59);
1✔
1315
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1316
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1317
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1318
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1319
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1320
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1321
  CPPUNIT_ASSERT ( wdgt.getWidth() == 60 );
6✔
1322
  CPPUNIT_ASSERT ( wdgt.getHeight() == 24 );
6✔
1323
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(60, 24) );
6✔
1324
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 60 );
6✔
1325
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 24 );
6✔
1326
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 60 );
6✔
1327
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 24 );
5✔
1328

1329
  wdgt.setHeight(999);
1✔
1330
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1331
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1332
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1333
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1334
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1335
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1336
  CPPUNIT_ASSERT ( wdgt.getWidth() == 60 );
6✔
1337
  CPPUNIT_ASSERT ( wdgt.getHeight() == 40 );
6✔
1338
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(60, 40) );
6✔
1339
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 60 );
6✔
1340
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 40 );
6✔
1341
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 60 );
6✔
1342
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 40 );
5✔
1343

1344
  wdgt.setHeight(19);
1✔
1345
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1346
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1347
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1348
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1349
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1350
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1351
  CPPUNIT_ASSERT ( wdgt.getWidth() == 60 );
6✔
1352
  CPPUNIT_ASSERT ( wdgt.getHeight() == 20 );
6✔
1353
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(60, 20) );
6✔
1354
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 60 );
6✔
1355
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 20 );
6✔
1356
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 60 );
6✔
1357
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 20 );
5✔
1358

1359
  wdgt.setFixedSize( finalcut::FSize(45, 16) );
1✔
1360
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(60, 20) );
5✔
1361
  wdgt.setWidth(10);
1✔
1362
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1363
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1364
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1365
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1366
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1367
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1368
  CPPUNIT_ASSERT ( wdgt.getWidth() == 45 );
6✔
1369
  CPPUNIT_ASSERT ( wdgt.getHeight() == 20 );
6✔
1370
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(45, 20) );
6✔
1371
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 45 );
6✔
1372
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 20 );
6✔
1373
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 45 );
6✔
1374
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 20 );
5✔
1375

1376
  wdgt.setFixedSize( finalcut::FSize(48, 16) );
1✔
1377
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(45, 20) );
5✔
1378
  wdgt.setWidth(50);
1✔
1379
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1380
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1381
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1382
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1383
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1384
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1385
  CPPUNIT_ASSERT ( wdgt.getWidth() == 48 );
6✔
1386
  CPPUNIT_ASSERT ( wdgt.getHeight() == 20 );
6✔
1387
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(48, 20) );
6✔
1388
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 48 );
6✔
1389
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 20 );
6✔
1390
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 48 );
6✔
1391
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 20 );
5✔
1392

1393
  wdgt.setHeight(5);
1✔
1394
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1395
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1396
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1397
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1398
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1399
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1400
  CPPUNIT_ASSERT ( wdgt.getWidth() == 48 );
6✔
1401
  CPPUNIT_ASSERT ( wdgt.getHeight() == 16 );
6✔
1402
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(48, 16) );
6✔
1403
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 48 );
6✔
1404
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 16 );
6✔
1405
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 48 );
6✔
1406
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 16 );
5✔
1407

1408
  wdgt.setFixedSize( finalcut::FSize(50, 20) );
1✔
1409
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(48, 16) );
5✔
1410
  wdgt.setHeight(25);
1✔
1411
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1412
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1413
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1414
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1415
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1416
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1417
  CPPUNIT_ASSERT ( wdgt.getWidth() == 48 );
6✔
1418
  CPPUNIT_ASSERT ( wdgt.getHeight() == 20 );
6✔
1419
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(48, 20) );
6✔
1420
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 48 );
6✔
1421
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 20 );
6✔
1422
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 48 );
6✔
1423
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 20 );
5✔
1424

1425
  wdgt.setFixedSize( finalcut::FSize(30, 15) );
1✔
1426
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(48, 20) );
5✔
1427
  wdgt.setSize( finalcut::FSize(3, 5) );
1✔
1428
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1429
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1430
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1431
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1432
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1433
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1434
  CPPUNIT_ASSERT ( wdgt.getWidth() == 30 );
6✔
1435
  CPPUNIT_ASSERT ( wdgt.getHeight() == 15 );
6✔
1436
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(30, 15) );
6✔
1437
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 30 );
6✔
1438
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 15 );
6✔
1439
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 30 );
6✔
1440
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 15 );
5✔
1441

1442
  wdgt.setFixedSize( finalcut::FSize(34, 12) );
1✔
1443
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(30, 15) );
5✔
1444
  wdgt.setSize( finalcut::FSize(35, 13) );
1✔
1445
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1446
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1447
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1448
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1449
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1450
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1451
  CPPUNIT_ASSERT ( wdgt.getWidth() == 34 );
6✔
1452
  CPPUNIT_ASSERT ( wdgt.getHeight() == 12 );
6✔
1453
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(34, 12) );
6✔
1454
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 34 );
6✔
1455
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 12 );
6✔
1456
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 34 );
6✔
1457
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 12 );
5✔
1458

1459
  // Reset minimum and maximum
1460
  wdgt.setMinimumSize(finalcut::FSize(0, 0));
1✔
1461
  wdgt.setMaximumSize(finalcut::FSize(INT_MAX, INT_MAX));
1✔
1462

1463
  auto box = finalcut::FRect(finalcut::FPoint(7, 7), finalcut::FSize(10, 8) );
1✔
1464
  wdgt.setGeometry (box);
1✔
1465
  CPPUNIT_ASSERT ( wdgt.getX() == 7 );
6✔
1466
  CPPUNIT_ASSERT ( wdgt.getY() == 7 );
6✔
1467
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(7, 7) );
6✔
1468
  CPPUNIT_ASSERT ( wdgt.getTermX() == 7 );
6✔
1469
  CPPUNIT_ASSERT ( wdgt.getTermY() == 7 );
6✔
1470
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(7, 7) );
6✔
1471
  CPPUNIT_ASSERT ( wdgt.getWidth() == 10 );
6✔
1472
  CPPUNIT_ASSERT ( wdgt.getHeight() == 8 );
6✔
1473
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(10, 8) );
6✔
1474
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 10 );
6✔
1475
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 8 );
6✔
1476
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 10 );
6✔
1477
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 8 );
6✔
1478
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(3, 3)) == finalcut::FPoint(-3, -3) );
6✔
1479
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(2, 2)) == finalcut::FPoint(-4, -4) );
6✔
1480
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(1, 1)) == finalcut::FPoint(-5, -5) );
5✔
1481

1482
  // Same position and size
1483
  wdgt.setGeometry (box);
1✔
1484
  CPPUNIT_ASSERT ( wdgt.getX() == 7 );
6✔
1485
  CPPUNIT_ASSERT ( wdgt.getY() == 7 );
6✔
1486
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(7, 7) );
6✔
1487
  CPPUNIT_ASSERT ( wdgt.getTermX() == 7 );
6✔
1488
  CPPUNIT_ASSERT ( wdgt.getTermY() == 7 );
6✔
1489
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(7, 7) );
6✔
1490
  CPPUNIT_ASSERT ( wdgt.getWidth() == 10 );
6✔
1491
  CPPUNIT_ASSERT ( wdgt.getHeight() == 8 );
6✔
1492
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(10, 8) );
6✔
1493
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 10 );
6✔
1494
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 8 );
6✔
1495
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 10 );
6✔
1496
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 8 );
6✔
1497
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(3, 3)) == finalcut::FPoint(-3, -3) );
6✔
1498
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(2, 2)) == finalcut::FPoint(-4, -4) );
6✔
1499
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(1, 1)) == finalcut::FPoint(-5, -5) );
5✔
1500

1501
  wdgt.setGeometry(finalcut::FPoint(22, 33), finalcut::FSize(560, 130) );
1✔
1502
  CPPUNIT_ASSERT ( wdgt.getX() == 22 );
6✔
1503
  CPPUNIT_ASSERT ( wdgt.getY() == 33 );
6✔
1504
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(22, 33) );
6✔
1505
  CPPUNIT_ASSERT ( wdgt.getTermX() == 22 );
6✔
1506
  CPPUNIT_ASSERT ( wdgt.getTermY() == 33 );
6✔
1507
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(22, 33) );
6✔
1508
  CPPUNIT_ASSERT ( wdgt.getWidth() == 560 );
6✔
1509
  CPPUNIT_ASSERT ( wdgt.getHeight() == 130 );
6✔
1510
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(560, 130) );
6✔
1511
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 560 );
6✔
1512
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 130 );
6✔
1513
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 560 );
6✔
1514
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 130 );
6✔
1515
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(3, 3)) == finalcut::FPoint(-18, -29) );
6✔
1516
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(2, 2)) == finalcut::FPoint(-19, -30) );
6✔
1517
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(1, 1)) == finalcut::FPoint(-20, -31) );
5✔
1518

1519
  wdgt.setGeometry(finalcut::FPoint(-5, -3), finalcut::FSize(50, 30) );
1✔
1520
  CPPUNIT_ASSERT ( wdgt.getX() == -5 );
6✔
1521
  CPPUNIT_ASSERT ( wdgt.getY() == -3 );
6✔
1522
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(-5, -3) );
6✔
1523
  CPPUNIT_ASSERT ( wdgt.getTermX() == -5 );
6✔
1524
  CPPUNIT_ASSERT ( wdgt.getTermY() == -3 );
6✔
1525
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(-5, -3) );
6✔
1526
  CPPUNIT_ASSERT ( wdgt.getWidth() == 50 );
6✔
1527
  CPPUNIT_ASSERT ( wdgt.getHeight() == 30 );
6✔
1528
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(50, 30) );
6✔
1529
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 50 );
6✔
1530
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 30 );
6✔
1531
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 50 );
6✔
1532
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 30 );
6✔
1533
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(3, 3)) == finalcut::FPoint(9, 7) );
6✔
1534
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(2, 2)) == finalcut::FPoint(8, 6) );
6✔
1535
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(1, 1)) == finalcut::FPoint(7, 5) );
5✔
1536

1537
  wdgt.setFlags().type.window_widget = false;
1✔
1538
  wdgt.setFlags().visibility.shown = true;
1✔
1539
  wdgt.setGeometry(finalcut::FPoint(-4, -2), finalcut::FSize(30, 20) );
1✔
1540
  CPPUNIT_ASSERT ( wdgt.getX() == 1 );
6✔
1541
  CPPUNIT_ASSERT ( wdgt.getY() == 1 );
6✔
1542
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(1, 1) );
6✔
1543
  CPPUNIT_ASSERT ( wdgt.getTermX() == 1 );
6✔
1544
  CPPUNIT_ASSERT ( wdgt.getTermY() == 1 );
6✔
1545
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(1, 1) );
6✔
1546
  CPPUNIT_ASSERT ( wdgt.getWidth() == 30 );
6✔
1547
  CPPUNIT_ASSERT ( wdgt.getHeight() == 20 );
6✔
1548
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(30, 20) );
6✔
1549
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 30 );
6✔
1550
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 20 );
6✔
1551
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 30 );
6✔
1552
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 20 );
6✔
1553
  CPPUNIT_ASSERT ( wdgt.childWidgetAt({0, 0}) == nullptr );
6✔
1554
  CPPUNIT_ASSERT ( wdgt.childWidgetAt({0, 1}) == nullptr );
6✔
1555
  CPPUNIT_ASSERT ( wdgt.childWidgetAt({1, 0}) == nullptr );
6✔
1556
  CPPUNIT_ASSERT ( wdgt.childWidgetAt({1, 1}) == nullptr );
6✔
1557
  CPPUNIT_ASSERT ( root_wdgt.childWidgetAt({0, 0}) == nullptr );
6✔
1558
  CPPUNIT_ASSERT ( root_wdgt.childWidgetAt({0, 1}) == nullptr );
6✔
1559
  CPPUNIT_ASSERT ( root_wdgt.childWidgetAt({1, 0}) == nullptr );
6✔
1560
  CPPUNIT_ASSERT ( root_wdgt.childWidgetAt({1, 1}) == &wdgt );
6✔
1561
  CPPUNIT_ASSERT ( root_wdgt.childWidgetAt({30, 20}) == &wdgt );
6✔
1562
  CPPUNIT_ASSERT ( root_wdgt.childWidgetAt({30, 21}) == nullptr );
6✔
1563
  CPPUNIT_ASSERT ( root_wdgt.childWidgetAt({31, 20}) == nullptr );
6✔
1564
  CPPUNIT_ASSERT ( root_wdgt.childWidgetAt({31, 21}) == nullptr );
5✔
1565

1566
  // Double flat line
1567
  wdgt.setDoubleFlatLine (finalcut::Side::Top, -6, true);  // ignore
1✔
1568
  wdgt.setDoubleFlatLine (finalcut::Side::Top, -2, true);  // ignore
1✔
1569
  wdgt.setDoubleFlatLine (finalcut::Side::Top, 0, true);  // ignore
1✔
1570
  wdgt.setDoubleFlatLine (finalcut::Side::Top, 2, true);
1✔
1571
  wdgt.setDoubleFlatLine (finalcut::Side::Top, 3, true);
1✔
1572
  wdgt.setDoubleFlatLine (finalcut::Side::Top, 5, true);
1✔
1573
  wdgt.setDoubleFlatLine (finalcut::Side::Top, 7, true);
1✔
1574
  wdgt.setDoubleFlatLine (finalcut::Side::Top, 11, true);
1✔
1575
  wdgt.setDoubleFlatLine (finalcut::Side::Top, 13, true);
1✔
1576
  wdgt.setDoubleFlatLine (finalcut::Side::Top, 17, true);
1✔
1577
  wdgt.setDoubleFlatLine (finalcut::Side::Top, 19, true);
1✔
1578
  wdgt.setDoubleFlatLine (finalcut::Side::Top, 23, true);
1✔
1579
  wdgt.setDoubleFlatLine (finalcut::Side::Top, 29, true);
1✔
1580
  wdgt.setDoubleFlatLine (finalcut::Side::Right, 12, true);
1✔
1581
  wdgt.setDoubleFlatLine (finalcut::Side::Bottom, 5, true);
1✔
1582
  wdgt.setDoubleFlatLine (finalcut::Side::Bottom, 15, true);
1✔
1583
  wdgt.setDoubleFlatLine (finalcut::Side::Left, 12, true);
1✔
1584
  CPPUNIT_ASSERT_THROW ( wdgt.setDoubleFlatLine (static_cast<finalcut::Side>(99), 1, true)
5✔
1585
                       , std::invalid_argument );
1586
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[0] == false );
6✔
1587
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[1] == true );
6✔
1588
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[2] == true );
6✔
1589
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[3] == false );
6✔
1590
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[4] == true );
6✔
1591
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[5] == false );
6✔
1592
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[6] == true );
6✔
1593
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[7] == false );
6✔
1594
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[8] == false );
6✔
1595
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[9] == false );
6✔
1596
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[10] == true );
6✔
1597
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[11] == false );
6✔
1598
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[12] == true );
6✔
1599
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[13] == false );
6✔
1600
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[14] == false );
6✔
1601
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[15] == false );
6✔
1602
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[16] == true );
6✔
1603
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[17] == false );
6✔
1604
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[18] == true );
6✔
1605
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[19] == false );
6✔
1606
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[20] == false );
6✔
1607
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[21] == false );
6✔
1608
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[22] == true );
6✔
1609
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[23] == false );
6✔
1610
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[24] == false );
6✔
1611
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[25] == false );
6✔
1612
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[26] == false );
6✔
1613
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[27] == false );
6✔
1614
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[28] == true );
6✔
1615
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top)[29] == false );
5✔
1616

1617
  for (int i{0}; i < 11; i++)
12✔
1618
  {
1619
    CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right)[i] == false );
66✔
1620
    CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left)[i] == false );
66✔
1621
  }
1622

1623
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right)[11] == true );
6✔
1624
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left)[11] == true );
5✔
1625

1626
  for (int i{12}; i < 20; i++)
9✔
1627
  {
1628
    CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right)[i] == false );
48✔
1629
    CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left)[i] == false );
48✔
1630
  }
1631

1632
  for (int i{0}; i < 4; i++)
5✔
1633
  {
1634
    CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom)[i] == false );
24✔
1635
  }
1636

1637
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom)[4] == true );
5✔
1638

1639
  for (int i{5}; i < 14; i++)
10✔
1640
  {
1641
    CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom)[i] == false );
54✔
1642
  }
1643

1644
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom)[14] == true );
5✔
1645

1646
  for (int i{15}; i < 30; i++)
16✔
1647
  {
1648
    CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom)[i] == false );
90✔
1649
  }
1650

1651
  // Test with shadow size
1652
  wdgt.setGeometry(finalcut::FPoint(3, 3), finalcut::FSize(5, 5) );
1✔
1653
  wdgt.setShadowSize(finalcut::FSize(2, 2));
1✔
1654
  CPPUNIT_ASSERT ( wdgt.getX() == 3 );
6✔
1655
  CPPUNIT_ASSERT ( wdgt.getY() == 3 );
6✔
1656
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(3, 3) );
6✔
1657
  CPPUNIT_ASSERT ( wdgt.getTermX() == 3 );
6✔
1658
  CPPUNIT_ASSERT ( wdgt.getTermY() == 3 );
6✔
1659
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(3, 3) );
6✔
1660
  CPPUNIT_ASSERT ( wdgt.getWidth() == 5 );
6✔
1661
  CPPUNIT_ASSERT ( wdgt.getHeight() == 5 );
6✔
1662
  CPPUNIT_ASSERT ( wdgt.getSize() == finalcut::FSize(5, 5) );
6✔
1663
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Top).size() == 5 );
6✔
1664
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Right).size() == 5 );
6✔
1665
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Bottom).size() == 5 );
6✔
1666
  CPPUNIT_ASSERT ( wdgt.doubleFlatLine_ref(finalcut::Side::Left).size() == 5 );
6✔
1667
  CPPUNIT_ASSERT ( wdgt.getShadow() == finalcut::FSize(2, 2) );
6✔
1668
  CPPUNIT_ASSERT ( wdgt.getGeometryWithShadow() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(7, 7)) );
6✔
1669
  CPPUNIT_ASSERT ( wdgt.getTermGeometryWithShadow() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(7, 7)) );
6✔
1670

1671
  // Cursor position
1672
  CPPUNIT_ASSERT ( wdgt.getCursorPos() == finalcut::FPoint(-1, -1) );
6✔
1673
  CPPUNIT_ASSERT ( wdgt.setCursorPos(finalcut::FPoint(0, 0)) == false );
6✔
1674
  CPPUNIT_ASSERT ( wdgt.getCursorPos() == finalcut::FPoint(0, 0) );
6✔
1675
  CPPUNIT_ASSERT ( wdgt.setCursorPos(finalcut::FPoint(30, 3)) == false );
6✔
1676
  CPPUNIT_ASSERT ( wdgt.getCursorPos() == finalcut::FPoint(30, 3) );
5✔
1677
  wdgt.unsetCursorPos();
1✔
1678
  CPPUNIT_ASSERT ( wdgt.getCursorPos() == finalcut::FPoint(-1, -1) );
5✔
1679
  wdgt.setFlags().visibility.hidden = false;
1✔
1680
  CPPUNIT_ASSERT ( wdgt.setCursorPos(finalcut::FPoint(10, 3)) == false );
5✔
1681
  wdgt.setFlags().focus.focus = true;
1✔
1682
  CPPUNIT_ASSERT ( wdgt.setCursorPos(finalcut::FPoint(11, 3)) == false );
5✔
1683
  wdgt.setFlags().type.window_widget = false;
1✔
1684
  CPPUNIT_ASSERT ( wdgt.setCursorPos(finalcut::FPoint(12, 3)) == false );
5✔
1685
  root_wdgt.setFlags().type.window_widget = true;
1✔
1686
  CPPUNIT_ASSERT ( wdgt.setCursorPos(finalcut::FPoint(13, 3)) == true );
6✔
1687
  CPPUNIT_ASSERT ( wdgt.getCursorPos() == finalcut::FPoint(13, 3) );
6✔
1688

1689
  // Padding
1690
  CPPUNIT_ASSERT ( wdgt.getClientSize() == wdgt.getSize() );
6✔
1691
  CPPUNIT_ASSERT ( wdgt.getClientSize() == finalcut::FSize(5, 5) );
6✔
1692
  CPPUNIT_ASSERT ( wdgt.getClientWidth() == 5 );
6✔
1693
  CPPUNIT_ASSERT ( wdgt.getClientHeight() == 5 );
6✔
1694
  CPPUNIT_ASSERT ( wdgt.getTopPadding() == 0 );
6✔
1695
  CPPUNIT_ASSERT ( wdgt.getRightPadding() == 0 );
6✔
1696
  CPPUNIT_ASSERT ( wdgt.getBottomPadding() == 0 );
6✔
1697
  CPPUNIT_ASSERT ( wdgt.getLeftPadding() == 0 );
6✔
1698
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(3, 3)) == finalcut::FPoint(1, 1));
6✔
1699
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(2, 2)) == finalcut::FPoint(0, 0));
6✔
1700
  CPPUNIT_ASSERT ( wdgt.termToWidgetPos(finalcut::FPoint(1, 1)) == finalcut::FPoint(-1, -1));
5✔
1701

1702
  wdgt.setTopPadding(1);
1✔
1703
  CPPUNIT_ASSERT ( wdgt.getClientSize() == finalcut::FSize(5, 4) );
6✔
1704
  CPPUNIT_ASSERT ( wdgt.getClientWidth() == 5 );
6✔
1705
  CPPUNIT_ASSERT ( wdgt.getClientHeight() == 4 );
6✔
1706
  CPPUNIT_ASSERT ( wdgt.getTopPadding() == 1 );
6✔
1707
  CPPUNIT_ASSERT ( wdgt.getRightPadding() == 0 );
6✔
1708
  CPPUNIT_ASSERT ( wdgt.getBottomPadding() == 0 );
6✔
1709
  CPPUNIT_ASSERT ( wdgt.getLeftPadding() == 0 );
5✔
1710
  wdgt.setTopPadding(1);
1✔
1711
  CPPUNIT_ASSERT ( wdgt.getTopPadding() == 1 );
5✔
1712

1713
  wdgt.setBottomPadding(2);
1✔
1714
  CPPUNIT_ASSERT ( wdgt.getClientSize() == finalcut::FSize(5, 2) );
6✔
1715
  CPPUNIT_ASSERT ( wdgt.getClientWidth() == 5 );
6✔
1716
  CPPUNIT_ASSERT ( wdgt.getClientHeight() == 2 );
6✔
1717
  CPPUNIT_ASSERT ( wdgt.getTopPadding() == 1 );
6✔
1718
  CPPUNIT_ASSERT ( wdgt.getRightPadding() == 0 );
6✔
1719
  CPPUNIT_ASSERT ( wdgt.getBottomPadding() == 2 );
6✔
1720
  CPPUNIT_ASSERT ( wdgt.getLeftPadding() == 0 );
5✔
1721
  wdgt.setBottomPadding(2);
1✔
1722
  CPPUNIT_ASSERT ( wdgt.getBottomPadding() == 2 );
5✔
1723

1724
  wdgt.setRightPadding(2);
1✔
1725
  CPPUNIT_ASSERT ( wdgt.getClientSize() == finalcut::FSize(3, 2) );
6✔
1726
  CPPUNIT_ASSERT ( wdgt.getClientWidth() == 3 );
6✔
1727
  CPPUNIT_ASSERT ( wdgt.getClientHeight() == 2 );
6✔
1728
  CPPUNIT_ASSERT ( wdgt.getTopPadding() == 1 );
6✔
1729
  CPPUNIT_ASSERT ( wdgt.getRightPadding() == 2 );
6✔
1730
  CPPUNIT_ASSERT ( wdgt.getBottomPadding() == 2 );
6✔
1731
  CPPUNIT_ASSERT ( wdgt.getLeftPadding() == 0 );
5✔
1732
  wdgt.setRightPadding(2);
1✔
1733
  CPPUNIT_ASSERT ( wdgt.getRightPadding() == 2 );
5✔
1734

1735
  wdgt.setLeftPadding(1);
1✔
1736
  CPPUNIT_ASSERT ( wdgt.getClientSize() == finalcut::FSize(2, 2) );
6✔
1737
  CPPUNIT_ASSERT ( wdgt.getClientWidth() == 2 );
6✔
1738
  CPPUNIT_ASSERT ( wdgt.getClientHeight() == 2 );
6✔
1739
  CPPUNIT_ASSERT ( wdgt.getTopPadding() == 1 );
6✔
1740
  CPPUNIT_ASSERT ( wdgt.getRightPadding() == 2 );
6✔
1741
  CPPUNIT_ASSERT ( wdgt.getBottomPadding() == 2 );
6✔
1742
  CPPUNIT_ASSERT ( wdgt.getLeftPadding() == 1 );
5✔
1743
  wdgt.setLeftPadding(1);
1✔
1744
  CPPUNIT_ASSERT ( wdgt.getLeftPadding() == 1 );
5✔
1745

1746
  wdgt.setRightPadding(-2);
1✔
1747
  CPPUNIT_ASSERT ( wdgt.getClientSize() == finalcut::FSize(6, 2) );
6✔
1748
  CPPUNIT_ASSERT ( wdgt.getClientWidth() == 6 );
6✔
1749
  CPPUNIT_ASSERT ( wdgt.getClientHeight() == 2 );
6✔
1750
  CPPUNIT_ASSERT ( wdgt.getTopPadding() == 1 );
6✔
1751
  CPPUNIT_ASSERT ( wdgt.getRightPadding() == -2 );
6✔
1752
  CPPUNIT_ASSERT ( wdgt.getBottomPadding() == 2 );
6✔
1753
  CPPUNIT_ASSERT ( wdgt.getLeftPadding() == 1 );
5✔
1754

1755
  wdgt.setTopPadding(-3);
1✔
1756
  CPPUNIT_ASSERT ( wdgt.getClientSize() == finalcut::FSize(6, 6) );
6✔
1757
  CPPUNIT_ASSERT ( wdgt.getClientWidth() == 6 );
6✔
1758
  CPPUNIT_ASSERT ( wdgt.getClientHeight() == 6 );
6✔
1759
  CPPUNIT_ASSERT ( wdgt.getTopPadding() == -3 );
6✔
1760
  CPPUNIT_ASSERT ( wdgt.getRightPadding() == -2 );
6✔
1761
  CPPUNIT_ASSERT ( wdgt.getBottomPadding() == 2 );
6✔
1762
  CPPUNIT_ASSERT ( wdgt.getLeftPadding() == 1 );
6✔
1763

1764
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(80, 24) );
6✔
1765
  CPPUNIT_ASSERT ( root_wdgt.getClientWidth() == 80 );
6✔
1766
  CPPUNIT_ASSERT ( root_wdgt.getClientHeight() == 24 );
6✔
1767
  CPPUNIT_ASSERT ( root_wdgt.getTopPadding() == 0 );
6✔
1768
  CPPUNIT_ASSERT ( root_wdgt.getRightPadding() == 0 );
6✔
1769
  CPPUNIT_ASSERT ( root_wdgt.getBottomPadding() == 0 );
6✔
1770
  CPPUNIT_ASSERT ( root_wdgt.getLeftPadding() == 0 );
6✔
1771
  CPPUNIT_ASSERT ( wdgt.getX() == 3 );
6✔
1772
  CPPUNIT_ASSERT ( wdgt.getY() == 3 );
6✔
1773
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(3, 3) );
6✔
1774
  CPPUNIT_ASSERT ( wdgt.getTermX() == 3 );
6✔
1775
  CPPUNIT_ASSERT ( wdgt.getTermY() == 3 );
6✔
1776
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(3, 3) );
5✔
1777

1778
  root_wdgt.setTopPadding(1);
1✔
1779
  root_wdgt.setRightPadding(2);
1✔
1780
  root_wdgt.setBottomPadding(3);
1✔
1781
  root_wdgt.setLeftPadding(4);
1✔
1782
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(74, 20) );
6✔
1783
  CPPUNIT_ASSERT ( root_wdgt.getClientWidth() == 74 );
6✔
1784
  CPPUNIT_ASSERT ( root_wdgt.getClientHeight() == 20 );
6✔
1785
  CPPUNIT_ASSERT ( root_wdgt.getTopPadding() == 1 );
6✔
1786
  CPPUNIT_ASSERT ( root_wdgt.getRightPadding() == 2 );
6✔
1787
  CPPUNIT_ASSERT ( root_wdgt.getBottomPadding() == 3 );
6✔
1788
  CPPUNIT_ASSERT ( root_wdgt.getLeftPadding() == 4 );
6✔
1789
  CPPUNIT_ASSERT ( wdgt.getX() == 3 );
6✔
1790
  CPPUNIT_ASSERT ( wdgt.getY() == 3 );
6✔
1791
  CPPUNIT_ASSERT ( wdgt.getPos() == finalcut::FPoint(3, 3) );
6✔
1792
  CPPUNIT_ASSERT ( wdgt.getTermX() == 7 );
6✔
1793
  CPPUNIT_ASSERT ( wdgt.getTermY() == 4 );
6✔
1794
  CPPUNIT_ASSERT ( wdgt.getTermPos() == finalcut::FPoint(7, 4) );
5✔
1795

1796
  // Set terminal size
1797
  root_wdgt.setTerminalSize( finalcut::FSize(132, 43) );
1✔
1798
  CPPUNIT_ASSERT ( root_wdgt.getWidth() == 80 );
6✔
1799
  CPPUNIT_ASSERT ( root_wdgt.getHeight() == 24 );
6✔
1800
  CPPUNIT_ASSERT ( root_wdgt.getSize() == finalcut::FSize(80, 24) );
5✔
1801
  finalcut::FTermcap tcap;
1802
  tcap.setPutCharFunction (nullptr);  // Avoid resizing the real terminal
1✔
1803
  tcap.setPutStringFunction (nullptr);
1✔
1804
  auto& fdata = finalcut::FTermData::getInstance();
1✔
1805
  fdata.setTermType(finalcut::FTermType::xterm);
1✔
1806
  auto fsys_ptr = static_cast<FSystemTest*>(finalcut::FSystem::getInstance().get());
1✔
1807
  fsys_ptr->setScreenSize(finalcut::FSize(132, 43));
1✔
1808
  root_wdgt.setTerminalSize( finalcut::FSize(132, 43) );
1✔
1809
  CPPUNIT_ASSERT ( root_wdgt.getWidth() == 132 );
6✔
1810
  CPPUNIT_ASSERT ( root_wdgt.getHeight() == 43 );
6✔
1811
  CPPUNIT_ASSERT ( root_wdgt.getSize() == finalcut::FSize(132, 43) );
5✔
1812
}
1✔
1813

1814
//----------------------------------------------------------------------
1815
void FWidgetTest::focusableChildrenTest()
1✔
1816
{
1817
  // root_wdgt -> main_wdgt
1818
  finalcut::FWidget root_wdgt{};  // Root widget
1✔
1819
  finalcut::FWidget main_wdgt{&root_wdgt};  // Child / main widget
1✔
1820

1821
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
1822
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 0 );
5✔
1823

1824
  // root_wdgt -> main_wdgt -> wdgt1
1825
  //                        -> wdgt2
1826
  //                        -> wdgt3
1827
  //                        -> wdgt4
1828
  finalcut::FWidget wdgt1{&main_wdgt};  // 1st Subchild
1✔
1829
  finalcut::FWidget wdgt2{&main_wdgt};  // 2nd Subchild
1✔
1830
  finalcut::FWidget wdgt3{&main_wdgt};  // 3rd Subchild
1✔
1831
  finalcut::FWidget wdgt4{&main_wdgt};  // 4th Subchild
1✔
1832

1833
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
1834
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 0 );
6✔
1835
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 0 );
6✔
1836
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
1837
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
1838
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
5✔
1839

1840
  // root_wdgt -> main_wdgt -> wdgt1 -> wdgt1_1
1841
  //                                 -> wdgt1_2
1842
  finalcut::FWidget wdgt1_1{&wdgt1};  // 1st Sub-subchild
1✔
1843
  finalcut::FWidget wdgt1_2{&wdgt1};  // 2nd Sub-subchild
1✔
1844

1845
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
1846
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
1847
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 0 );
6✔
1848
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
1849
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 0 );
6✔
1850
  CPPUNIT_ASSERT ( wdgt1.getFlags().focus.focusable );
6✔
1851
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
1852
  CPPUNIT_ASSERT ( wdgt2.getFlags().focus.focusable );
6✔
1853
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
1854
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
1855
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
1856
  CPPUNIT_ASSERT ( wdgt4.getFlags().focus.focusable );
6✔
1857
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
1858
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
1859
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
1860
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
1861

1862
  main_wdgt.setFlags().visibility.shown = true;
1✔
1863
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 1 );
6✔
1864
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
1865
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 0 );
6✔
1866
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
1867
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
1868
  CPPUNIT_ASSERT ( ! main_wdgt.getFlags().type.window_widget );
6✔
1869
  CPPUNIT_ASSERT ( !main_wdgt.isWindowWidget() );
6✔
1870
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 0 );
6✔
1871
  CPPUNIT_ASSERT ( wdgt1.getFlags().focus.focusable );
6✔
1872
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
1873
  CPPUNIT_ASSERT ( wdgt2.getFlags().focus.focusable );
6✔
1874
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
1875
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
1876
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
1877
  CPPUNIT_ASSERT ( wdgt4.getFlags().focus.focusable );
6✔
1878
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
1879
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
1880
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
1881
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
1882

1883
  main_wdgt.setFlags().type.window_widget = true;
1✔
1884
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
1885
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
1886
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 0 );
6✔
1887
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
1888
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
1889
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
1890
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
1891
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 0 );
6✔
1892
  CPPUNIT_ASSERT ( wdgt1.getFlags().focus.focusable );
6✔
1893
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
1894
  CPPUNIT_ASSERT ( wdgt2.getFlags().focus.focusable );
6✔
1895
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
1896
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
1897
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
1898
  CPPUNIT_ASSERT ( wdgt4.getFlags().focus.focusable );
6✔
1899
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
1900
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
1901
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
1902
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
1903

1904
  wdgt1.setFlags().visibility.shown = true;
1✔
1905
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
1906
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
1907
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 1 );
6✔
1908
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
1909
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
1910
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
1911
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
1912
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 0 );
6✔
1913
  CPPUNIT_ASSERT ( wdgt1.getFlags().focus.focusable );
6✔
1914
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
1915
  CPPUNIT_ASSERT ( wdgt2.getFlags().focus.focusable );
6✔
1916
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
1917
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
1918
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
1919
  CPPUNIT_ASSERT ( wdgt4.getFlags().focus.focusable );
6✔
1920
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
1921
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
1922
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
1923
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
1924

1925
  wdgt1_1.setFlags().visibility.shown = true;
1✔
1926
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
1927
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
1928
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 1 );
6✔
1929
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
1930
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
1931
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
1932
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
1933
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 1 );
6✔
1934
  CPPUNIT_ASSERT ( wdgt1.getFlags().focus.focusable );
6✔
1935
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
1936
  CPPUNIT_ASSERT ( wdgt2.getFlags().focus.focusable );
6✔
1937
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
1938
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
1939
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
1940
  CPPUNIT_ASSERT ( wdgt4.getFlags().focus.focusable );
6✔
1941
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
1942
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
1943
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
1944
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
1945

1946
  wdgt1_2.setFlags().visibility.shown = true;
1✔
1947
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
1948
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
1949
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 1 );
6✔
1950
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
1951
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
1952
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
1953
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
1954
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 2 );
6✔
1955
  CPPUNIT_ASSERT ( wdgt1.getFlags().focus.focusable );
6✔
1956
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
1957
  CPPUNIT_ASSERT ( wdgt2.getFlags().focus.focusable );
6✔
1958
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
1959
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
1960
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
1961
  CPPUNIT_ASSERT ( wdgt4.getFlags().focus.focusable );
6✔
1962
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
1963
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
1964
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
1965
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
1966

1967
  wdgt2.setFlags().visibility.shown = true;
1✔
1968
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
1969
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
1970
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 2 );
6✔
1971
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
1972
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
1973
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
1974
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
1975
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 2 );
6✔
1976
  CPPUNIT_ASSERT ( wdgt1.getFlags().focus.focusable );
6✔
1977
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
1978
  CPPUNIT_ASSERT ( wdgt2.getFlags().focus.focusable );
6✔
1979
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
1980
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
1981
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
1982
  CPPUNIT_ASSERT ( wdgt4.getFlags().focus.focusable );
6✔
1983
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
1984
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
1985
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
1986
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
1987

1988
  wdgt3.setFlags().visibility.shown = true;
1✔
1989
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
1990
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
1991
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 3 );
6✔
1992
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
1993
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
1994
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
1995
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
1996
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 2 );
6✔
1997
  CPPUNIT_ASSERT ( wdgt1.getFlags().focus.focusable );
6✔
1998
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
1999
  CPPUNIT_ASSERT ( wdgt2.getFlags().focus.focusable );
6✔
2000
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
2001
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
2002
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
2003
  CPPUNIT_ASSERT ( wdgt4.getFlags().focus.focusable );
6✔
2004
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
2005
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
2006
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
2007
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
2008

2009
  wdgt4.setFlags().visibility.shown = true;
1✔
2010
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
2011
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
2012
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 4 );
6✔
2013
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
2014
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
2015
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
2016
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
2017
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 2 );
6✔
2018
  CPPUNIT_ASSERT ( wdgt1.getFlags().focus.focusable );
6✔
2019
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
2020
  CPPUNIT_ASSERT ( wdgt2.getFlags().focus.focusable );
6✔
2021
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
2022
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
2023
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
2024
  CPPUNIT_ASSERT ( wdgt4.getFlags().focus.focusable );
6✔
2025
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
2026
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
2027
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
2028
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
2029

2030
  wdgt2.setFlags().focus.focusable = false;
1✔
2031
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
2032
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
2033
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 3 );
6✔
2034
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
2035
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
2036
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
2037
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
2038
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 2 );
6✔
2039
  CPPUNIT_ASSERT ( wdgt1.getFlags().focus.focusable );
6✔
2040
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
2041
  CPPUNIT_ASSERT ( ! wdgt2.getFlags().focus.focusable );
6✔
2042
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
2043
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
2044
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
2045
  CPPUNIT_ASSERT ( wdgt4.getFlags().focus.focusable );
6✔
2046
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
2047
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
2048
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
2049
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
2050

2051
  wdgt1.setFlags().focus.focusable = false;
1✔
2052
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
2053
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
2054
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 2 );
6✔
2055
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
2056
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
2057
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
2058
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
2059
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 2 );
6✔
2060
  CPPUNIT_ASSERT ( ! wdgt1.getFlags().focus.focusable );
6✔
2061
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
2062
  CPPUNIT_ASSERT ( ! wdgt2.getFlags().focus.focusable );
6✔
2063
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
2064
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
2065
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
2066
  CPPUNIT_ASSERT ( wdgt4.getFlags().focus.focusable );
6✔
2067
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
2068
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
2069
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
2070
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
2071

2072
  wdgt4.setFlags().focus.focusable = false;
1✔
2073
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
2074
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
2075
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 1 );
6✔
2076
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
2077
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
2078
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
2079
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
2080
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 2 );
6✔
2081
  CPPUNIT_ASSERT ( ! wdgt1.getFlags().focus.focusable );
6✔
2082
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
2083
  CPPUNIT_ASSERT ( ! wdgt2.getFlags().focus.focusable );
6✔
2084
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
2085
  CPPUNIT_ASSERT ( wdgt3.getFlags().focus.focusable );
6✔
2086
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
2087
  CPPUNIT_ASSERT ( ! wdgt4.getFlags().focus.focusable );
6✔
2088
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
2089
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
2090
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
2091
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
2092

2093
  wdgt3.setFlags().focus.focusable = false;
1✔
2094
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
2095
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
2096
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 0 );
6✔
2097
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
2098
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
2099
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
2100
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
2101
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 2 );
6✔
2102
  CPPUNIT_ASSERT ( ! wdgt1.getFlags().focus.focusable );
6✔
2103
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
2104
  CPPUNIT_ASSERT ( ! wdgt2.getFlags().focus.focusable );
6✔
2105
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
2106
  CPPUNIT_ASSERT ( ! wdgt3.getFlags().focus.focusable );
6✔
2107
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
2108
  CPPUNIT_ASSERT ( ! wdgt4.getFlags().focus.focusable );
6✔
2109
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
2110
  CPPUNIT_ASSERT ( wdgt1_1.getFlags().focus.focusable );
6✔
2111
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
2112
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
2113

2114
  wdgt1_1.setFlags().focus.focusable = false;
1✔
2115
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
2116
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
2117
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 0 );
6✔
2118
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
2119
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
2120
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
2121
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
2122
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 1 );
6✔
2123
  CPPUNIT_ASSERT ( ! wdgt1.getFlags().focus.focusable );
6✔
2124
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
2125
  CPPUNIT_ASSERT ( ! wdgt2.getFlags().focus.focusable );
6✔
2126
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
2127
  CPPUNIT_ASSERT ( ! wdgt3.getFlags().focus.focusable );
6✔
2128
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
2129
  CPPUNIT_ASSERT ( ! wdgt4.getFlags().focus.focusable );
6✔
2130
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
2131
  CPPUNIT_ASSERT ( ! wdgt1_1.getFlags().focus.focusable );
6✔
2132
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
2133
  CPPUNIT_ASSERT ( wdgt1_2.getFlags().focus.focusable );
5✔
2134

2135
  wdgt1_2.setFlags().focus.focusable = false;
1✔
2136
  CPPUNIT_ASSERT ( root_wdgt.numOfFocusableChildren() == 0 );
6✔
2137
  CPPUNIT_ASSERT ( root_wdgt.getFlags().focus.focusable );
6✔
2138
  CPPUNIT_ASSERT ( main_wdgt.numOfFocusableChildren() == 0 );
6✔
2139
  CPPUNIT_ASSERT ( main_wdgt.getFlags().focus.focusable );
6✔
2140
  CPPUNIT_ASSERT ( main_wdgt.acceptFocus() );
6✔
2141
  CPPUNIT_ASSERT ( main_wdgt.getFlags().type.window_widget );
6✔
2142
  CPPUNIT_ASSERT ( main_wdgt.isWindowWidget() );
6✔
2143
  CPPUNIT_ASSERT ( wdgt1.numOfFocusableChildren() == 0 );
6✔
2144
  CPPUNIT_ASSERT ( ! wdgt1.getFlags().focus.focusable );
6✔
2145
  CPPUNIT_ASSERT ( wdgt2.numOfFocusableChildren() == 0 );
6✔
2146
  CPPUNIT_ASSERT ( ! wdgt2.getFlags().focus.focusable );
6✔
2147
  CPPUNIT_ASSERT ( wdgt3.numOfFocusableChildren() == 0 );
6✔
2148
  CPPUNIT_ASSERT ( ! wdgt3.getFlags().focus.focusable );
6✔
2149
  CPPUNIT_ASSERT ( wdgt4.numOfFocusableChildren() == 0 );
6✔
2150
  CPPUNIT_ASSERT ( ! wdgt4.getFlags().focus.focusable );
6✔
2151
  CPPUNIT_ASSERT ( wdgt1_1.numOfFocusableChildren() == 0 );
6✔
2152
  CPPUNIT_ASSERT ( ! wdgt1_1.getFlags().focus.focusable );
6✔
2153
  CPPUNIT_ASSERT ( wdgt1_2.numOfFocusableChildren() == 0 );
6✔
2154
  CPPUNIT_ASSERT ( ! wdgt1_2.getFlags().focus.focusable );
5✔
2155

2156
  // Test focusing the next widget
2157
  FWidget_protected parent{&root_wdgt};
1✔
2158
  FWidget_protected child1{&parent};
1✔
2159
  FWidget_protected child2{&parent};
1✔
2160
  FWidget_protected child3{&parent};
1✔
2161
  FWidget_protected child4{&parent};
1✔
2162

2163
  CPPUNIT_ASSERT ( ! root_wdgt.focusNextChild() );  // No parent test
6✔
2164
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 0 );
6✔
2165
  CPPUNIT_ASSERT ( child1.getFlags().feature.active );
6✔
2166
  CPPUNIT_ASSERT ( child2.getFlags().feature.active );
6✔
2167
  CPPUNIT_ASSERT ( child3.getFlags().feature.active );
6✔
2168
  CPPUNIT_ASSERT ( child4.getFlags().feature.active );
6✔
2169
  CPPUNIT_ASSERT ( child1.getFlags().focus.focusable );
6✔
2170
  CPPUNIT_ASSERT ( child2.getFlags().focus.focusable );
6✔
2171
  CPPUNIT_ASSERT ( child3.getFlags().focus.focusable );
6✔
2172
  CPPUNIT_ASSERT ( child4.getFlags().focus.focusable );
6✔
2173
  CPPUNIT_ASSERT ( ! child1.getFlags().visibility.shown );
6✔
2174
  CPPUNIT_ASSERT ( ! child2.getFlags().visibility.shown );
6✔
2175
  CPPUNIT_ASSERT ( ! child3.getFlags().visibility.shown );
6✔
2176
  CPPUNIT_ASSERT ( ! child4.getFlags().visibility.shown );
5✔
2177
  child1.setFlags().visibility.shown = true;
1✔
2178
  child2.setFlags().visibility.shown = true;
1✔
2179
  child3.setFlags().visibility.shown = true;
1✔
2180
  child4.setFlags().visibility.shown = true;
1✔
2181
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 4 );
6✔
2182
  CPPUNIT_ASSERT ( child1.getFlags().visibility.shown );
6✔
2183
  CPPUNIT_ASSERT ( child2.getFlags().visibility.shown );
6✔
2184
  CPPUNIT_ASSERT ( child3.getFlags().visibility.shown );
6✔
2185
  CPPUNIT_ASSERT ( child4.getFlags().visibility.shown );
6✔
2186
  CPPUNIT_ASSERT ( ! child1.isWindowWidget() );
6✔
2187
  CPPUNIT_ASSERT ( ! child2.isWindowWidget() );
6✔
2188
  CPPUNIT_ASSERT ( ! child3.isWindowWidget() );
6✔
2189
  CPPUNIT_ASSERT ( ! child4.isWindowWidget() );
6✔
2190
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2191
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2192
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2193
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
6✔
2194
  CPPUNIT_ASSERT ( ! parent.focusNextChild() );
5✔
2195
  child1.setFocus();  // Set the initial focus on the first child
1✔
2196
  CPPUNIT_ASSERT ( child1.hasFocus() );
6✔
2197
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2198
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2199
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2200

2201
  child1.setFlags().type.dialog_widget = true;
1✔
2202
  CPPUNIT_ASSERT ( ! child1.focusNextChild() );
6✔
2203
  CPPUNIT_ASSERT ( child1.hasFocus() );
6✔
2204
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2205
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2206
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2207

2208
  child1.setFlags().type.dialog_widget = false;
1✔
2209
  CPPUNIT_ASSERT ( child1.focusNextChild() );
6✔
2210
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2211
  CPPUNIT_ASSERT ( child2.hasFocus() );
6✔
2212
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2213
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
6✔
2214
  CPPUNIT_ASSERT ( child2.focusNextChild() );
6✔
2215
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2216
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2217
  CPPUNIT_ASSERT ( child3.hasFocus() );
6✔
2218
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
6✔
2219
  CPPUNIT_ASSERT ( child3.focusNextChild() );
6✔
2220
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2221
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2222
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2223
  CPPUNIT_ASSERT ( child4.hasFocus() );
6✔
2224
  CPPUNIT_ASSERT ( child4.focusNextChild() );
6✔
2225
  CPPUNIT_ASSERT ( child1.hasFocus() );
6✔
2226
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2227
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2228
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2229

2230
  child2.p_setWidgetProperty(false);
1✔
2231
  CPPUNIT_ASSERT ( child1.focusNextChild() );
6✔
2232
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2233
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2234
  CPPUNIT_ASSERT ( child3.hasFocus() );
6✔
2235
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
6✔
2236
  CPPUNIT_ASSERT ( child3.focusNextChild() );
6✔
2237
  CPPUNIT_ASSERT ( child4.focusNextChild() );
5✔
2238

2239
  child2.p_setWidgetProperty(true);
1✔
2240
  child2.setFlags().feature.active = false;
1✔
2241
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 3 );
6✔
2242
  CPPUNIT_ASSERT ( child1.focusNextChild() );
6✔
2243
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2244
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2245
  CPPUNIT_ASSERT ( child3.hasFocus() );
6✔
2246
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2247

2248
  child1.setFocus();  // Set the initial focus on the first child
1✔
2249
  child2.setFlags().feature.active = true;
1✔
2250
  child2.setFlags().focus.focusable = false;
1✔
2251
  child3.setFlags().visibility.shown = false;
1✔
2252
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 2 );
6✔
2253
  CPPUNIT_ASSERT ( child1.focusNextChild() );
6✔
2254
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2255
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2256
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2257
  CPPUNIT_ASSERT ( child4.hasFocus() );
5✔
2258

2259
  finalcut::FApplication::start();
1✔
2260
  child1.setFocus();  // Set the initial focus on the first child
1✔
2261
  child4.setFlags().visibility.shown = false;
1✔
2262
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 1 );
5✔
2263
  resetLastEvent();
1✔
2264
  CPPUNIT_ASSERT ( getLastEvent() == finalcut::Event::None );
6✔
2265
  CPPUNIT_ASSERT ( child1.focusNextChild() );
6✔
2266
  CPPUNIT_ASSERT ( getLastEvent() == finalcut::Event::FailAtChildFocus );
6✔
2267
  CPPUNIT_ASSERT ( child1.hasFocus() );
6✔
2268
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2269
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2270
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2271

2272
  child1.unsetFocus();  // Reset the focus of first child
1✔
2273
  child1.setFlags().visibility.shown = false;
1✔
2274
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 0 );
6✔
2275
  CPPUNIT_ASSERT ( ! child1.focusNextChild() );
6✔
2276
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2277
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2278
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2279
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2280

2281
  child1.setFlags().visibility.shown = true;
1✔
2282
  child1.setFocus();  // Set the initial focus on the first child
1✔
2283
  child2.setFlags().focus.focusable = true;
1✔
2284
  child3.setFlags().visibility.shown = true;
1✔
2285
  child2.setFlags().type.window_widget = true;
1✔
2286
  child4.setFlags().visibility.shown = true;
1✔
2287
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 3 );
6✔
2288
  CPPUNIT_ASSERT ( child2.isWindowWidget() );
6✔
2289
  CPPUNIT_ASSERT ( child1.focusNextChild() );
6✔
2290
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2291
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2292
  CPPUNIT_ASSERT ( child3.hasFocus() );
6✔
2293
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2294

2295
  // Test focusing the first child widget
2296
  child3.unsetFocus();  // Reset the focus of first child
1✔
2297
  child2.setFlags().type.window_widget = false;
1✔
2298
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2299
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2300
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2301
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
6✔
2302
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 4 );
6✔
2303
  CPPUNIT_ASSERT ( child1.numOfFocusableChildren() == 0 );
6✔
2304
  CPPUNIT_ASSERT ( ! child1.focusFirstChild() );
5✔
2305

2306
  child1.setFlags().feature.active = false;
1✔
2307
  child2.setFlags().feature.active = false;
1✔
2308
  child3.setFlags().feature.active = false;
1✔
2309
  child4.setFlags().feature.active = false;
1✔
2310
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 0 );
6✔
2311
  CPPUNIT_ASSERT ( ! parent.focusFirstChild() );
6✔
2312
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2313
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2314
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2315
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2316

2317
  child1.setFlags().feature.active = true;
1✔
2318
  child1.setFlags().focus.focusable = false;
1✔
2319
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 0 );
6✔
2320
  CPPUNIT_ASSERT ( ! parent.focusFirstChild() );
6✔
2321
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2322
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2323
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2324
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2325

2326
  child2.setFlags().feature.active = true;
1✔
2327
  child2.setFlags().type.menu_widget = true;
1✔
2328
  CPPUNIT_ASSERT ( child2.isMenuWidget() );
6✔
2329
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 1 );
6✔
2330
  // A menu widget cannot receive focus as first element !
2331
  CPPUNIT_ASSERT ( ! parent.focusFirstChild() );
6✔
2332
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2333
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2334
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2335
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2336

2337
  child4.setFlags().feature.active = true;
1✔
2338
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 2 );
6✔
2339
  CPPUNIT_ASSERT ( parent.focusFirstChild() );
6✔
2340
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2341
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2342
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2343
  CPPUNIT_ASSERT ( child4.hasFocus() );
5✔
2344

2345
  child3.setFlags().feature.active = true;
1✔
2346
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 3 );
6✔
2347
  CPPUNIT_ASSERT ( parent.focusFirstChild() );
6✔
2348
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2349
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2350
  CPPUNIT_ASSERT ( child3.hasFocus() );
6✔
2351
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2352

2353
  child2.setFlags().type.menu_widget = false;
1✔
2354
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 3 );
6✔
2355
  CPPUNIT_ASSERT ( parent.focusFirstChild() );
6✔
2356
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2357
  CPPUNIT_ASSERT ( child2.hasFocus() );
6✔
2358
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2359
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2360

2361
  child1.setFlags().focus.focusable = true;
1✔
2362
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 4 );
6✔
2363
  CPPUNIT_ASSERT ( parent.focusFirstChild() );
6✔
2364
  CPPUNIT_ASSERT ( child1.hasFocus() );
6✔
2365
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2366
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2367
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2368

2369
  child1.p_setWidgetProperty(false);
1✔
2370
  CPPUNIT_ASSERT ( parent.focusFirstChild() );
6✔
2371
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2372
  CPPUNIT_ASSERT ( child2.hasFocus() );
6✔
2373
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2374
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2375
  child1.p_setWidgetProperty(true);
1✔
2376

2377
  // Test focusing the previous widget
2378
  child2.unsetFocus();
1✔
2379
  CPPUNIT_ASSERT ( ! root_wdgt.focusPrevChild() );  // No parent test
6✔
2380
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 4 );
6✔
2381
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2382
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2383
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2384
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
6✔
2385
  CPPUNIT_ASSERT ( ! parent.focusPrevChild() );
5✔
2386
  child4.setFocus();  // Set the initial focus on the last child
1✔
2387
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2388
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2389
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2390
  CPPUNIT_ASSERT ( child4.hasFocus() );
5✔
2391

2392
  child4.setFlags().type.dialog_widget = true;
1✔
2393
  CPPUNIT_ASSERT ( ! child4.focusPrevChild() );
6✔
2394
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2395
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2396
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2397
  CPPUNIT_ASSERT ( child4.hasFocus() );
5✔
2398

2399
  child4.setFlags().type.dialog_widget = false;
1✔
2400
  CPPUNIT_ASSERT ( child4.focusPrevChild() );
6✔
2401
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2402
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2403
  CPPUNIT_ASSERT ( child3.hasFocus() );
6✔
2404
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
6✔
2405
  CPPUNIT_ASSERT ( child3.focusPrevChild() );
6✔
2406
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2407
  CPPUNIT_ASSERT ( child2.hasFocus() );
6✔
2408
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2409
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
6✔
2410
  CPPUNIT_ASSERT ( child2.focusPrevChild() );
6✔
2411
  CPPUNIT_ASSERT ( child1.hasFocus() );
6✔
2412
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2413
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2414
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
6✔
2415
  CPPUNIT_ASSERT ( child1.focusPrevChild() );
6✔
2416
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2417
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2418
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2419
  CPPUNIT_ASSERT ( child4.hasFocus() );
5✔
2420

2421
  child3.p_setWidgetProperty(false);
1✔
2422
  CPPUNIT_ASSERT ( child4.focusPrevChild() );
6✔
2423
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2424
  CPPUNIT_ASSERT ( child2.hasFocus() );
6✔
2425
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2426
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2427

2428
  child3.p_setWidgetProperty(true);
1✔
2429
  child3.setFlags().feature.active = false;
1✔
2430
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 3 );
6✔
2431
  CPPUNIT_ASSERT ( child4.focusPrevChild() );
6✔
2432
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2433
  CPPUNIT_ASSERT ( child2.hasFocus() );
6✔
2434
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2435
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2436

2437
  child4.setFocus();  // Set the initial focus on the last child
1✔
2438
  child3.setFlags().feature.active = true;
1✔
2439
  child3.setFlags().focus.focusable = false;
1✔
2440
  child2.setFlags().visibility.shown = false;
1✔
2441
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 2 );
6✔
2442
  CPPUNIT_ASSERT ( child4.focusPrevChild() );
6✔
2443
  CPPUNIT_ASSERT ( child1.hasFocus() );
6✔
2444
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2445
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2446
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2447

2448
  child4.setFocus();  // Set the initial focus on the last child
1✔
2449
  child1.setFlags().visibility.shown = false;
1✔
2450
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 1 );
5✔
2451
  resetLastEvent();
1✔
2452
  CPPUNIT_ASSERT ( getLastEvent() == finalcut::Event::None );
6✔
2453
  CPPUNIT_ASSERT ( child4.focusPrevChild() );
6✔
2454
  CPPUNIT_ASSERT ( getLastEvent() == finalcut::Event::FailAtChildFocus );
6✔
2455
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2456
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2457
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2458
  CPPUNIT_ASSERT ( child4.hasFocus() );
5✔
2459

2460
  child4.unsetFocus();  // Reset the focus of first child
1✔
2461
  child4.setFlags().visibility.shown = false;
1✔
2462
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 0 );
6✔
2463
  CPPUNIT_ASSERT ( ! child4.focusPrevChild() );
6✔
2464
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2465
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2466
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2467
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2468

2469
  child4.setFlags().visibility.shown = true;
1✔
2470
  child4.setFocus();  // Set the initial focus on the first child
1✔
2471
  child3.setFlags().focus.focusable = true;
1✔
2472
  child2.setFlags().visibility.shown = true;
1✔
2473
  child3.setFlags().type.window_widget = true;
1✔
2474
  child1.setFlags().visibility.shown = true;
1✔
2475
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 3 );
6✔
2476
  CPPUNIT_ASSERT ( child3.isWindowWidget() );
6✔
2477
  CPPUNIT_ASSERT ( child4.focusPrevChild() );
6✔
2478
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2479
  CPPUNIT_ASSERT ( child2.hasFocus() );
6✔
2480
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2481
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2482

2483
  // Test focusing the last child widget
2484
  child2.unsetFocus();  // Reset the focus of first child
1✔
2485
  child3.setFlags().type.window_widget = false;
1✔
2486
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2487
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2488
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2489
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
6✔
2490
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 4 );
6✔
2491
  CPPUNIT_ASSERT ( child4.numOfFocusableChildren() == 0 );
6✔
2492
  CPPUNIT_ASSERT ( ! child4.focusLastChild() );
5✔
2493

2494
  child1.setFlags().feature.active = false;
1✔
2495
  child2.setFlags().feature.active = false;
1✔
2496
  child3.setFlags().feature.active = false;
1✔
2497
  child4.setFlags().feature.active = false;
1✔
2498
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 0 );
6✔
2499
  CPPUNIT_ASSERT ( ! parent.focusLastChild() );
6✔
2500
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2501
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2502
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2503
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2504

2505
  child4.setFlags().feature.active = true;
1✔
2506
  child4.setFlags().focus.focusable = false;
1✔
2507
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 0 );
6✔
2508
  CPPUNIT_ASSERT ( ! parent.focusLastChild() );
6✔
2509
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2510
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2511
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2512
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2513

2514
  child3.setFlags().feature.active = true;
1✔
2515
  child3.setFlags().type.menu_widget = true;
1✔
2516
  CPPUNIT_ASSERT ( child3.isMenuWidget() );
6✔
2517
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 1 );
6✔
2518
  // A menu widget cannot receive focus as first element !
2519
  CPPUNIT_ASSERT ( ! parent.focusLastChild() );
6✔
2520
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2521
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2522
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2523
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2524

2525
  child1.setFlags().feature.active = true;
1✔
2526
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 2 );
6✔
2527
  CPPUNIT_ASSERT ( parent.focusLastChild() );
6✔
2528
  CPPUNIT_ASSERT ( child1.hasFocus() );
6✔
2529
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2530
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2531
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2532

2533
  child2.setFlags().feature.active = true;
1✔
2534
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 3 );
6✔
2535
  CPPUNIT_ASSERT ( parent.focusLastChild() );
6✔
2536
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2537
  CPPUNIT_ASSERT ( child2.hasFocus() );
6✔
2538
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2539
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2540

2541
  child3.setFlags().type.menu_widget = false;
1✔
2542
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 3 );
6✔
2543
  CPPUNIT_ASSERT ( parent.focusLastChild() );
6✔
2544
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2545
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2546
  CPPUNIT_ASSERT ( child3.hasFocus() );
6✔
2547
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2548

2549
  child4.setFlags().focus.focusable = true;
1✔
2550
  CPPUNIT_ASSERT ( parent.numOfFocusableChildren() == 4 );
6✔
2551
  CPPUNIT_ASSERT ( parent.focusLastChild() );
6✔
2552
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2553
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2554
  CPPUNIT_ASSERT ( ! child3.hasFocus() );
6✔
2555
  CPPUNIT_ASSERT ( child4.hasFocus() );
5✔
2556

2557
  child4.p_setWidgetProperty(false);
1✔
2558
  CPPUNIT_ASSERT ( parent.focusLastChild() );
6✔
2559
  CPPUNIT_ASSERT ( ! child1.hasFocus() );
6✔
2560
  CPPUNIT_ASSERT ( ! child2.hasFocus() );
6✔
2561
  CPPUNIT_ASSERT ( child3.hasFocus() );
6✔
2562
  CPPUNIT_ASSERT ( ! child4.hasFocus() );
5✔
2563
  child4.p_setWidgetProperty(true);
1✔
2564
}
1✔
2565

2566
//----------------------------------------------------------------------
2567
void FWidgetTest::closeWidgetTest()
1✔
2568
{
2569
  finalcut::FWidget root_wdgt{};  // Root widget
1✔
2570
  finalcut::FWidget main_wdgt{&root_wdgt};  // Child / main widget
1✔
2571
  finalcut::FWidget::setMainWidget(&main_wdgt);
1✔
2572
  main_wdgt.setFlags().visibility.shown = true;
1✔
2573
  CPPUNIT_ASSERT ( ! main_wdgt.getFlags().visibility.hidden );
6✔
2574
  CPPUNIT_ASSERT ( main_wdgt.getFlags().visibility.shown );
5✔
2575

2576
  class TestWidget : public finalcut::FWidget
2577
  {
2578
    public:
2579
      explicit TestWidget (finalcut::FWidget* parent = nullptr)
1✔
2580
        : finalcut::FWidget{parent}
1✔
2581
      { }
1✔
2582

2583
      TestWidget (const TestWidget&) = delete;
2584

2585
      TestWidget (TestWidget&&) noexcept = delete;
2586

2587
      ~TestWidget() override = default;
1✔
2588

2589
      void onClose (finalcut::FCloseEvent* ev) override
4✔
2590
      {
2591
        if ( confirmed )
4✔
2592
          ev->accept();
3✔
2593
        else
2594
          ev->ignore();
1✔
2595
      }
4✔
2596

2597
      void setConfirmed (bool state = true)
1✔
2598
      {
2599
        confirmed = state;
1✔
2600
      }
1✔
2601

2602
      auto p_getWidgetCloseList() -> finalcut::FWidget::FWidgetList*&
9✔
2603
      {
2604
        return finalcut::FWidget::getWidgetCloseList();
9✔
2605
      }
2606

2607
    private:
2608
      bool confirmed{false};
2609
  };
2610

2611
  TestWidget wdgt{&main_wdgt};  // Subchild
1✔
2612
  wdgt.setFlags().visibility.shown = true;
1✔
2613
  CPPUNIT_ASSERT ( ! wdgt.close() );  // Close without confirmation
6✔
2614
  CPPUNIT_ASSERT ( ! wdgt.getFlags().visibility.hidden );
6✔
2615
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.shown );
5✔
2616

2617
  wdgt.setConfirmed();
1✔
2618
  finalcut::FApplication::start();
1✔
2619
  CPPUNIT_ASSERT ( wdgt.p_getWidgetCloseList()->size() == 0 );
6✔
2620
  CPPUNIT_ASSERT ( wdgt.close() );
6✔
2621
  CPPUNIT_ASSERT ( wdgt.p_getWidgetCloseList()->size() == 1 );
6✔
2622
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.hidden );
6✔
2623
  CPPUNIT_ASSERT ( ! wdgt.getFlags().visibility.shown );
5✔
2624

2625
  // wdgt is already in the widget close list
2626
  wdgt.setFlags().visibility.hidden = false;
1✔
2627
  wdgt.setFlags().visibility.shown = true;
1✔
2628
  CPPUNIT_ASSERT ( wdgt.p_getWidgetCloseList()->size() == 1 );
6✔
2629
  CPPUNIT_ASSERT ( wdgt.close() );
6✔
2630
  CPPUNIT_ASSERT ( wdgt.p_getWidgetCloseList()->size() == 1 );
6✔
2631
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.hidden );
6✔
2632
  CPPUNIT_ASSERT ( ! wdgt.getFlags().visibility.shown );
5✔
2633
  wdgt.p_getWidgetCloseList()->clear();
1✔
2634

2635
  // wdgt is modal
2636
  wdgt.setFlags().visibility.modal = true;
1✔
2637
  wdgt.setFlags().visibility.hidden = false;
1✔
2638
  wdgt.setFlags().visibility.shown = true;
1✔
2639
  CPPUNIT_ASSERT ( wdgt.p_getWidgetCloseList()->size() == 0 );
6✔
2640
  CPPUNIT_ASSERT ( wdgt.close() );
6✔
2641
  CPPUNIT_ASSERT ( wdgt.p_getWidgetCloseList()->size() == 0 );
6✔
2642
  CPPUNIT_ASSERT ( wdgt.getFlags().visibility.hidden );
6✔
2643
  CPPUNIT_ASSERT ( ! wdgt.getFlags().visibility.shown );
6✔
2644

2645
  // Close the main widget
2646
  CPPUNIT_ASSERT ( wdgt.p_getWidgetCloseList()->size() == 0 );
6✔
2647
  CPPUNIT_ASSERT ( main_wdgt.close() );
6✔
2648
  CPPUNIT_ASSERT ( wdgt.p_getWidgetCloseList()->size() == 0 );
6✔
2649
  CPPUNIT_ASSERT ( ! main_wdgt.getFlags().visibility.hidden );
6✔
2650
  CPPUNIT_ASSERT ( main_wdgt.getFlags().visibility.shown );
5✔
2651
}
1✔
2652

2653
//----------------------------------------------------------------------
2654
void FWidgetTest::adjustSizeTest()
1✔
2655
{
2656
  std::unique_ptr<finalcut::FSystem> fsys = std::make_unique<FSystemTest>();
1✔
2657
  finalcut::FTerm::setFSystem(fsys);
1✔
2658

2659
  class TestWidget : public finalcut::FWidget
2660
  {
2661
    public:
2662
      explicit TestWidget (finalcut::FWidget* parent = nullptr)
2✔
2663
        : finalcut::FWidget{parent}
2✔
2664
      { }
2✔
2665

2666
      TestWidget (const TestWidget&) = delete;
2667

2668
      TestWidget (TestWidget&&) noexcept = delete;
2669

2670
      ~TestWidget() override = default;
2✔
2671

2672
      void p_adjustSize()
17✔
2673
      {
2674
        return finalcut::FWidget::adjustSize();
17✔
2675
      }
2676
  };
2677

2678
  TestWidget root_wdgt{};  // Root widget
1✔
2679
  TestWidget child_wdgt{&root_wdgt};  // Child widget
1✔
2680
  root_wdgt.setGeometry({3, 3}, {10, 5}, false);
1✔
2681
  child_wdgt.setGeometry({-2, -2}, {20, 50}, false);
1✔
2682
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2683
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(20, 50)) );
6✔
2684
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2685
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(20, 50) );
5✔
2686

2687
  child_wdgt.p_adjustSize();
1✔
2688
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2689
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2690
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2691
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(10, 5) );
5✔
2692

2693
  child_wdgt.move({-3, -4});
1✔
2694
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2695
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(-2, -3), finalcut::FSize(10, 5)) );
6✔
2696
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2697
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(10, 5) );
5✔
2698

2699
  root_wdgt.p_adjustSize();
1✔
2700
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2701
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2702
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2703
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(10, 5) );
5✔
2704

2705
  child_wdgt.move({3, 4});
1✔
2706
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2707
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(4, 5), finalcut::FSize(10, 5)) );
6✔
2708
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2709
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(10, 5) );
5✔
2710

2711
  child_wdgt.p_adjustSize();
1✔
2712
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2713
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2714
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2715
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(10, 5) );
5✔
2716

2717
  child_wdgt.p_adjustSize();
1✔
2718
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2719
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2720
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2721
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(10, 5) );
5✔
2722

2723
  child_wdgt.setTopPadding(1, false);
1✔
2724
  child_wdgt.setRightPadding(1, false);
1✔
2725
  child_wdgt.setBottomPadding(1, false);
1✔
2726
  child_wdgt.setLeftPadding(1, false);
1✔
2727
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2728
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2729
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2730
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(10, 5) );
5✔
2731

2732
  child_wdgt.p_adjustSize();
1✔
2733
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2734
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2735
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2736
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(8, 3) );
5✔
2737

2738
  child_wdgt.setTopPadding(2, false);
1✔
2739
  child_wdgt.setRightPadding(2, false);
1✔
2740
  child_wdgt.setBottomPadding(2, false);
1✔
2741
  child_wdgt.setLeftPadding(2, false);
1✔
2742
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2743
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2744
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2745
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(8, 3) );
5✔
2746

2747
  child_wdgt.p_adjustSize();
1✔
2748
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2749
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2750
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2751
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(6, 1) );
5✔
2752

2753
  child_wdgt.setTopPadding(2, false);
1✔
2754
  child_wdgt.setRightPadding(4, false);
1✔
2755
  child_wdgt.setBottomPadding(2, false);
1✔
2756
  child_wdgt.setLeftPadding(4, false);
1✔
2757
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2758
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2759
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2760
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(6, 1) );
5✔
2761

2762
  child_wdgt.p_adjustSize();
1✔
2763
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2764
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2765
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2766
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(2, 1) );
5✔
2767

2768
  child_wdgt.setTopPadding(2, false);
1✔
2769
  child_wdgt.setRightPadding(5, false);
1✔
2770
  child_wdgt.setBottomPadding(2, false);
1✔
2771
  child_wdgt.setLeftPadding(4, false);
1✔
2772
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2773
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2774
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2775
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(2, 1) );
5✔
2776

2777
  child_wdgt.p_adjustSize();
1✔
2778
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2779
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2780
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2781
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(1, 1) );
5✔
2782

2783
  child_wdgt.setTopPadding(3, false);
1✔
2784
  child_wdgt.setRightPadding(5, false);
1✔
2785
  child_wdgt.setBottomPadding(2, false);
1✔
2786
  child_wdgt.setLeftPadding(4, false);
1✔
2787
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2788
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2789
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2790
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(1, 1) );
5✔
2791

2792
  child_wdgt.p_adjustSize();
1✔
2793
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2794
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2795
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2796
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(1, 0) );
5✔
2797

2798
  child_wdgt.setTopPadding(3, false);
1✔
2799
  child_wdgt.setRightPadding(5, false);
1✔
2800
  child_wdgt.setBottomPadding(2, false);
1✔
2801
  child_wdgt.setLeftPadding(5, false);
1✔
2802
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2803
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2804
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2805
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(1, 0) );
5✔
2806

2807
  child_wdgt.p_adjustSize();
1✔
2808
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2809
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2810
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2811
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(0, 0) );
5✔
2812

2813
  child_wdgt.setTopPadding(7, false);
1✔
2814
  child_wdgt.setRightPadding(9, false);
1✔
2815
  child_wdgt.setBottomPadding(2, false);
1✔
2816
  child_wdgt.setLeftPadding(5, false);
1✔
2817
  child_wdgt.move({5, 5});
1✔
2818
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2819
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(6, 6), finalcut::FSize(10, 5)) );
6✔
2820
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2821
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(0, 0) );
5✔
2822

2823
  child_wdgt.p_adjustSize();
1✔
2824
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2825
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(10, 5)) );
6✔
2826
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2827
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(0, 0) );
5✔
2828

2829
  child_wdgt.setPos({6, 6}, false);  // The y value is large
1✔
2830
  child_wdgt.setSize({0, 0}, false);  // A widget width or a height can never be < 1 character
1✔
2831
  child_wdgt.setTopPadding(0, false);
1✔
2832
  child_wdgt.setRightPadding(0, false);
1✔
2833
  child_wdgt.setBottomPadding(0, false);
1✔
2834
  child_wdgt.setLeftPadding(0, false);
1✔
2835
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2836
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(6, 6), finalcut::FSize(1, 1)) );
6✔
2837
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2838
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(0, 0) );
5✔
2839

2840
  child_wdgt.p_adjustSize();
1✔
2841
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2842
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(6, 5), finalcut::FSize(1, 1)) );
6✔
2843
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2844
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(1, 1) );
5✔
2845

2846
  // setMinimumSize before setSize
2847
  child_wdgt.setMinimumWidth(2);
1✔
2848
  child_wdgt.setMinimumHeight(2);
1✔
2849
  child_wdgt.setSize({0, 0}, false);  // Widget width or height can not be smaller than the minimum
1✔
2850
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2851
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(6, 6), finalcut::FSize(2, 2)) );
6✔
2852
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2853
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(1, 1) );
5✔
2854

2855
  child_wdgt.p_adjustSize();
1✔
2856
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2857
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(6, 4), finalcut::FSize(2, 2)) );
6✔
2858
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2859
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(2, 2) );
5✔
2860

2861
  // Reset minimum size
2862
  child_wdgt.setMinimumSize({0, 0} );
1✔
2863
  // setSize before setMinimumSize
2864
  child_wdgt.setSize({0, 0}, false);  // Widget width or height can not be smaller than the minimum
1✔
2865
  child_wdgt.setMinimumSize({3, 3} );
1✔
2866
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2867
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(6, 6), finalcut::FSize(1, 1)) );
6✔
2868
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2869
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(2, 2) );
5✔
2870

2871
  child_wdgt.p_adjustSize();
1✔
2872
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(3, 3), finalcut::FSize(10, 5)) );
6✔
2873
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(6, 5), finalcut::FSize(3, 3)) );
6✔
2874
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2875
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(3, 3) );
5✔
2876

2877
  // Set the minimum width and height to 0
2878
  child_wdgt.setMinimumSize({0, 0} );
1✔
2879
  child_wdgt.setMaximumSize({INT_MAX, INT_MAX} );
1✔
2880
  child_wdgt.setBottomPadding(1, false);
1✔
2881
  child_wdgt.setRightPadding(1, false);
1✔
2882
  root_wdgt.setPos({1, 1}, false);
1✔
2883
  root_wdgt.setSize({1, 1}, false);
1✔
2884
  child_wdgt.setPos({-2, -2}, false);
1✔
2885
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(1, 1)) );
6✔
2886
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(3, 3)) );
6✔
2887
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(10, 5) );
6✔
2888
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(3, 3) );
5✔
2889

2890
  root_wdgt.p_adjustSize();
1✔
2891
  CPPUNIT_ASSERT ( root_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(1, 1)) );
6✔
2892
  CPPUNIT_ASSERT ( child_wdgt.getGeometry() == finalcut::FRect(finalcut::FPoint(1, 1), finalcut::FSize(1, 1)) );
6✔
2893
  CPPUNIT_ASSERT ( root_wdgt.getClientSize() == finalcut::FSize(1, 1) );
6✔
2894
  CPPUNIT_ASSERT ( child_wdgt.getClientSize() == finalcut::FSize(0, 0) );
5✔
2895

2896
  root_wdgt.setPos({9, 9}, false);
1✔
2897
  root_wdgt.setSize({20, 20}, false);
1✔
2898
  child_wdgt.setPos({2, 2}, false);
1✔
2899
  child_wdgt.setSize({10, 10}, false);
1✔
2900
  CPPUNIT_ASSERT ( root_wdgt.getTermGeometry() == finalcut::FRect(finalcut::FPoint(9, 9), finalcut::FSize(20, 20)) );
6✔
2901
  CPPUNIT_ASSERT ( child_wdgt.getTermGeometry() == finalcut::FRect(finalcut::FPoint(2, 2), finalcut::FSize(10, 10)) );
5✔
2902
  child_wdgt.setFlags().type.window_widget = true;
1✔
2903
  child_wdgt.ignorePadding(true);
1✔
2904
  child_wdgt.p_adjustSize();
1✔
2905
  CPPUNIT_ASSERT ( root_wdgt.getTermGeometry() == finalcut::FRect(finalcut::FPoint(9, 9), finalcut::FSize(20, 20)) );
6✔
2906
  CPPUNIT_ASSERT ( child_wdgt.getTermGeometry() == finalcut::FRect(finalcut::FPoint(2, 2), finalcut::FSize(10, 10)) );
5✔
2907

2908
  child_wdgt.setFlags().type.window_widget = false;
1✔
2909
  child_wdgt.p_adjustSize();
1✔
2910
  CPPUNIT_ASSERT ( root_wdgt.getTermGeometry() == finalcut::FRect(finalcut::FPoint(9, 9), finalcut::FSize(20, 20)) );
6✔
2911
  CPPUNIT_ASSERT ( child_wdgt.getTermGeometry() == finalcut::FRect(finalcut::FPoint(10, 10), finalcut::FSize(10, 10)) );
5✔
2912
}
1✔
2913

2914
//----------------------------------------------------------------------
2915
void FWidgetTest::callbackTest()
1✔
2916
{
2917
  int value{0};
1✔
2918
  finalcut::FWidget wdgt{};
1✔
2919
  wdgt.addCallback( "signal", [&value] () { value++; } );
1✔
2920
  CPPUNIT_ASSERT ( value == 0 );
5✔
2921
  wdgt.emitCallback("nonsense");
1✔
2922
  CPPUNIT_ASSERT ( value == 0 );
5✔
2923
  wdgt.emitCallback("signal");
1✔
2924
  CPPUNIT_ASSERT ( value == 1 );
5✔
2925
  value *= 300;
1✔
2926
  wdgt.emitCallback("signal");
1✔
2927
  CPPUNIT_ASSERT ( value == 301 );
5✔
2928
  wdgt.delCallback("nonsense");
1✔
2929
  wdgt.emitCallback("signal");
1✔
2930
  CPPUNIT_ASSERT ( value == 302 );
5✔
2931
  wdgt.delCallback("signal");
1✔
2932
  wdgt.emitCallback("signal");
1✔
2933
  CPPUNIT_ASSERT ( value == 302 );
5✔
2934
}
1✔
2935

2936

2937
// Put the test suite in the registry
2938
CPPUNIT_TEST_SUITE_REGISTRATION (FWidgetTest);
2939

2940
// The general unit test main part
2941
#include <main-test.inc>
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc