• 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

81.25
/test/ftermopenbsd-test.cpp
1
/***********************************************************************
2
* ftermopenbsd-test.cpp - FTermOpenBSD unit tests                      *
3
*                                                                      *
4
* This file is part of the FINAL CUT widget toolkit                    *
5
*                                                                      *
6
* Copyright 2019-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 <term.h>
24
#undef back_tab         // from term.h
25
#undef buttons          // from term.h
26
#undef carriage_return  // from term.h
27
#undef clr_bol          // from term.h
28
#undef clr_eol          // from term.h
29
#undef column_address   // from term.h
30
#undef erase_chars      // from term.h
31
#undef orig_colors      // from term.h
32
#undef orig_pair        // from term.h
33
#undef repeat_char      // from term.h
34
#undef row_address      // from term.h
35
#undef tab              // from term.h
36

37
#include <limits>
38
#include <string>
39

40
#include <cppunit/BriefTestProgressListener.h>
41
#include <cppunit/CompilerOutputter.h>
42
#include <cppunit/extensions/HelperMacros.h>
43
#include <cppunit/TestFixture.h>
44
#include <cppunit/TestResult.h>
45
#include <cppunit/TestResultCollector.h>
46
#include <cppunit/TestRunner.h>
47
#include <unistd.h>
48

49
#include <conemu.h>
50
#include <final/final.h>
51

52

53
namespace test
54
{
55

56
//----------------------------------------------------------------------
57
// class FSystemTest
58
//----------------------------------------------------------------------
59

60
class FSystemTest : public finalcut::FSystem
61
{
62
  public:
63
    // Constructor
64
    FSystemTest();
65

66
    // Methods
67
    auto inPortByte (uShort) noexcept -> uChar override;
68
    void outPortByte (uChar, uShort) noexcept override;
69
    auto isTTY (int) const noexcept -> int override;
70
    auto ioctl (int, uLong, ...) noexcept -> int override;
71
    auto pipe (finalcut::PipeData&) noexcept -> int override;
72
    auto open (const char*, int, ...) noexcept -> int override;
73
    auto close (int) noexcept -> int override;
74
    auto fopen (const char*, const char*) noexcept -> FILE* override;
75
    auto fputs (const char*, FILE*) noexcept -> int override;
76
    auto fclose (FILE*) noexcept -> int override;
77
    auto putchar (int) noexcept -> int override;
78
    auto putstring (const char*, std::size_t) noexcept -> int override;
79
    auto sigaction ( int, const struct sigaction*
80
                   , struct sigaction*) noexcept -> int override;
81
    auto timer_create ( clockid_t, struct sigevent*
82
                      , timer_t* ) noexcept -> int override;
83
    auto timer_settime ( timer_t, int
84
                       , const struct itimerspec*
85
                       , struct itimerspec* ) noexcept -> int override;
86
    auto timer_delete (timer_t) noexcept -> int override;
87
    auto kqueue() noexcept -> int override;
88
    auto kevent ( int, const struct kevent*
89
                , int, struct kevent*
90
                , int, const struct timespec* ) noexcept -> int override;
91
    auto getuid() noexcept -> uid_t override;
92
    auto geteuid() noexcept -> uid_t override;
93
    auto getpwuid_r ( uid_t, struct passwd*, char*
94
                    , size_t, struct passwd** ) noexcept -> int override;
95
    auto realpath (const char*, char*) noexcept -> char* override;
96
    auto getBell() noexcept -> wskbd_bell_data&;
97

98
  private:
99
    kbd_t kbdencoding{512};
100
    wskbd_bell_data system_bell{};
101
};
102

103

104
// constructors and destructor
105
//----------------------------------------------------------------------
106
FSystemTest::FSystemTest()  // constructor
5✔
107
{
108
  // Initialize bell values
109
  system_bell.which  = 0;
5✔
110
  system_bell.pitch  = 1500;
5✔
111
  system_bell.period = 100;
5✔
112
  system_bell.volume = 50;
5✔
113
}
5✔
114

115

116
// public methods of FSystemTest
117
//----------------------------------------------------------------------
118
auto FSystemTest::inPortByte (uShort) noexcept -> uChar
×
119
{
120
  return 0;
×
121
}
122

123
//----------------------------------------------------------------------
124
void FSystemTest::outPortByte (uChar, uShort) noexcept
×
125
{
126
}
×
127

128
//----------------------------------------------------------------------
129
auto FSystemTest::isTTY (int file_descriptor) const noexcept -> int
×
130
{
131
  std::cerr << "Call: isatty (file_descriptor=" << file_descriptor << ")\n";
×
132
  return 1;
×
133
}
134

135
//----------------------------------------------------------------------
136
auto FSystemTest::ioctl (int file_descriptor, uLong request, ...) noexcept -> int
26✔
137
{
138
  va_list args{};
26✔
139
  void* argp{};
26✔
140
  std::string req_string{};
26✔
141
  int ret_val{-1};
26✔
142

143
  va_start (args, request);
26✔
144
  argp = va_arg (args, void*);
26✔
145

146
  switch ( request )
26✔
147
  {
148
    case WSKBDIO_GETENCODING:
17✔
149
    {
150
      req_string = "WSKBDIO_GETENCODING";
17✔
151
      auto kbd_enc = static_cast<kbd_t*>(argp);
17✔
152
      *kbd_enc = kbdencoding;
17✔
153
      ret_val = 0;
17✔
154
      break;
17✔
155
    }
156

157
    case WSKBDIO_SETENCODING:
4✔
158
    {
159
      req_string = "WSKBDIO_SETENCODING";
4✔
160
      auto kbd_enc = static_cast<kbd_t*>(argp);
4✔
161
      kbdencoding = *kbd_enc;
4✔
162
      ret_val = 0;
4✔
163
      break;
4✔
164
    }
165

166
    case WSKBDIO_GETDEFAULTBELL:
1✔
167
    {
168
      req_string = "WSKBDIO_GETDEFAULTBELL";
1✔
169
      auto spk = static_cast<wskbd_bell_data*>(argp);
1✔
170
      spk->which = 0;
1✔
171
      spk->pitch = 1500;
1✔
172
      spk->period = 100;
1✔
173
      spk->volume = 50;
1✔
174
      ret_val = 0;
1✔
175
      break;
1✔
176
    }
177

178
    case WSKBDIO_SETBELL:
2✔
179
    {
180
      req_string = "WSKBDIO_SETBELL";
2✔
181
      auto spk = static_cast<wskbd_bell_data*>(argp);
2✔
182

183
      if ( spk->which & WSKBD_BELL_DOPITCH )
2✔
184
        system_bell.pitch = spk->pitch;
2✔
185
      else
186
        system_bell.pitch = 1500;
×
187

188
      if ( spk->which & WSKBD_BELL_DOPERIOD )
2✔
189
        system_bell.period = spk->period;
2✔
190
      else
191
        system_bell.period = 100;
×
192

193
      if ( spk->which & WSKBD_BELL_DOVOLUME )
2✔
194
        system_bell.volume = spk->volume;
2✔
195
      else
196
        system_bell.volume = 50;
×
197

198
      spk->which = WSKBD_BELL_DOALL;
2✔
199
      ret_val = 0;
2✔
200
      break;
2✔
201
    }
202

203
    case TIOCGWINSZ:
2✔
204
      req_string = "TIOCGWINSZ";
2✔
205
      auto win_size = static_cast<winsize*>(argp);
2✔
206
      win_size->ws_col = 80;
2✔
207
      win_size->ws_row = 25;
2✔
208
      ret_val = 0;
2✔
209
      break;
2✔
210
  }
211

212
  va_end (args);
26✔
213

214
  std::cerr << "Call: ioctl (file_descriptor=" << file_descriptor
26✔
215
            << ", request=" << req_string
216
            << "(0x" << std::hex << request << ")"
26✔
217
            << ", argp=" << argp << std::dec << ")\n";
26✔
218
  return ret_val;
52✔
219
}
26✔
220

221
//----------------------------------------------------------------------
222
auto FSystemTest::pipe (finalcut::PipeData& pipe) noexcept -> int
×
223
{
224
  std::cerr << "Call: pipe (pipefd={"
×
225
            << pipe.getReadFd() << ", "
×
226
            << pipe.getWriteFd() << "})\n";
×
227
  return 0;
×
228
}
229

230
//----------------------------------------------------------------------
231
auto FSystemTest::open (const char* pathname, int flags, ...) noexcept -> int
×
232
{
233
  va_list args{};
×
234
  va_start (args, flags);
×
235
  auto mode = static_cast<mode_t>(va_arg (args, int));
×
236
  va_end (args);
×
237

238
  std::cerr << "Call: open (pathname=\"" << pathname
239
            << "\", flags=" << flags
×
240
            << ", mode=" << mode << ")\n";
×
241

242
  return 0;
×
243
}
244

245
//----------------------------------------------------------------------
246
auto FSystemTest::close (int file_descriptor) noexcept -> int
×
247
{
248
  std::cerr << "Call: close (file_descriptor=" << file_descriptor << ")\n";
×
249
  return 0;
×
250
}
251

252
//----------------------------------------------------------------------
253
auto FSystemTest::fopen (const char* path, const char* mode) noexcept -> FILE*
×
254
{
255
  std::cerr << "Call: fopen (path=" << path
256
            << ", mode=" << mode << ")\n";
×
257
  return nullptr;
×
258
}
259

260
//----------------------------------------------------------------------
261
auto FSystemTest::fclose (FILE* file_ptr) noexcept -> int
×
262
{
263
  std::cerr << "Call: fclose (file_ptr=" << file_ptr << ")\n";
×
264
  return 0;
×
265
}
266

267
//----------------------------------------------------------------------
268
auto FSystemTest::fputs (const char* str, FILE* stream) noexcept -> int
×
269
{
270
  return std::fputs(str, stream);
×
271
}
272

273
//----------------------------------------------------------------------
274
auto FSystemTest::putchar (int c) noexcept -> int
×
275
{
276
#if defined(__sun) && defined(__SVR4)
277
  return std::putchar(char(c));
278
#else
279
  return std::putchar(c);
×
280
#endif
281
}
282

283
//----------------------------------------------------------------------
284
auto FSystemTest::putstring (const char* str, std::size_t len) noexcept -> int
×
285
{
286
  return std::fwrite(str, 1, len, stdout);
×
287
}
288

289
//----------------------------------------------------------------------
290
auto FSystemTest::sigaction ( int, const struct sigaction*
×
291
                            , struct sigaction* ) noexcept -> int
292
{
293
  return 0;
×
294
}
295

296
//----------------------------------------------------------------------
297
auto FSystemTest::timer_create ( clockid_t, struct sigevent*
×
298
                               , timer_t* ) noexcept -> int
299
{
300
  return 0;
×
301
}
302

303
//----------------------------------------------------------------------
304
auto FSystemTest::timer_settime ( timer_t, int
×
305
                                , const struct itimerspec*
306
                                , struct itimerspec* ) noexcept -> int
307
{
308
  return 0;
×
309
}
310

311
//----------------------------------------------------------------------
312
auto FSystemTest::timer_delete (timer_t) noexcept -> int
×
313
{
314
  return 0;
×
315
}
316

317
//----------------------------------------------------------------------
318
auto FSystemTest::kqueue() noexcept -> int
×
319
{
320
  return 0;
×
321
}
322

323
//----------------------------------------------------------------------
324
auto FSystemTest::kevent ( int, const struct kevent*
×
325
                         , int, struct kevent*
326
                         , int, const struct timespec*) noexcept -> int
327
{
328
  return 0;
×
329
}
330

331
//----------------------------------------------------------------------
332
auto FSystemTest::getuid() noexcept -> uid_t
×
333
{
334
  return 0;
×
335
}
336

337
//----------------------------------------------------------------------
338
auto FSystemTest::geteuid() noexcept -> uid_t
×
339
{
340
  return 0;
×
341
}
342

343
//----------------------------------------------------------------------
344
auto FSystemTest::getpwuid_r ( uid_t, struct passwd*, char*
×
345
                            , size_t, struct passwd** ) noexcept -> int
346
{
347
  return 0;
×
348
}
349

350
//----------------------------------------------------------------------
351
auto FSystemTest::realpath (const char*, char*) noexcept -> char*
×
352
{
353
  return const_cast<char*>("");
×
354
}
355

356
//----------------------------------------------------------------------
357
auto FSystemTest::getBell() noexcept -> wskbd_bell_data&
1✔
358
{
359
  return system_bell;
1✔
360
}
361

362
}  // namespace test
363

364

365
//----------------------------------------------------------------------
366
// class ftermopenbsdTest
367
//----------------------------------------------------------------------
368

369
class ftermopenbsdTest : public CPPUNIT_NS::TestFixture
370
                       , test::ConEmu
371
{
372
  public:
373
    ftermopenbsdTest() = default;
9✔
374

375
  protected:
376
    void classNameTest();
377
    void netbsdConsoleTest();
378
    void openbsdConsoleTest();
379

380
  private:
381
    // Adds code needed to register the test suite
382
    CPPUNIT_TEST_SUITE (ftermopenbsdTest);
6✔
383

384
    // Add a methods to the test suite
385
    CPPUNIT_TEST (classNameTest);
6✔
386
    CPPUNIT_TEST (netbsdConsoleTest);
6✔
387
    CPPUNIT_TEST (openbsdConsoleTest);
6✔
388

389
    // End of test suite definition
390
    CPPUNIT_TEST_SUITE_END();
9✔
391
};
392

393
//----------------------------------------------------------------------
394
void ftermopenbsdTest::classNameTest()
3✔
395
{
396
  const auto& openbsd = finalcut::FTermOpenBSD::getInstance();
3✔
397
  const finalcut::FString& classname = openbsd.getClassName();
3✔
398
  CPPUNIT_ASSERT ( classname == "FTermOpenBSD" );
15✔
399
}
3✔
400

401
//----------------------------------------------------------------------
402
void ftermopenbsdTest::netbsdConsoleTest()
3✔
403
{
404
  std::unique_ptr<finalcut::FSystem> fsys = std::make_unique<test::FSystemTest>();
3✔
405
  finalcut::FTerm::setFSystem(fsys);
3✔
406
  std::cout << "\n";
3✔
407
  auto& data = finalcut::FTermData::getInstance();
3✔
408

409
  auto& encoding_list = data.getEncodingList();
3✔
410
  encoding_list["UTF-8"] = finalcut::Encoding::UTF8;
6✔
411
  encoding_list["UTF8"]  = finalcut::Encoding::UTF8;
6✔
412
  encoding_list["VT100"] = finalcut::Encoding::VT100;
6✔
413
  encoding_list["PC"]    = finalcut::Encoding::PC;
6✔
414
  encoding_list["ASCII"] = finalcut::Encoding::ASCII;
3✔
415

416
  data.setTermEncoding(finalcut::Encoding::VT100);
3✔
417
  data.setBaudrate(9600);
3✔
418
  data.setTermType("wsvt25");
6✔
419
  data.setTermFileName("/dev/ttyE1");
3✔
420
  data.setTTYFileDescriptor(0);
3✔
421
  data.supportShadowCharacter (false);
3✔
422
  data.supportHalfBlockCharacter (false);
3✔
423
  data.supportCursorOptimisation (true);
3✔
424
  data.setCursorHidden (true);
3✔
425
  data.useAlternateScreen (false);
3✔
426
  data.setASCIIConsole (true);
3✔
427
  data.setVT100Console (false);
3✔
428
  data.setUTF8Console (false);
3✔
429
  data.setUTF8 (false);
3✔
430
  data.setNewFont (false);
3✔
431
  data.setVGAFont (false);
3✔
432
  data.setMonochron (false);
3✔
433
  data.setTermResized (false);
3✔
434
  setenv ("TERM", "wsvt25", 1);
3✔
435

436
  // setupterm is needed for tputs in ncurses >= 6.1
437
  setupterm (static_cast<char*>(nullptr), 1, static_cast<int*>(nullptr));
3✔
438
  auto& term_detection = finalcut::FTermDetection::getInstance();
3✔
439
  term_detection.setTerminalDetection(true);
3✔
440
  pid_t pid = forkConEmu();
3✔
441

442
  if ( isConEmuChildProcess(pid) )
3✔
443
  {
444
    // (gdb) set follow-fork-mode child
445
    finalcut::FTermOpenBSD netbsd;
446

447
    setenv ("TERM", "wsvt25", 1);
1✔
448
    setenv ("COLUMNS", "80", 1);
1✔
449
    setenv ("LINES", "25", 1);
1✔
450
    unsetenv("TERMCAP");
1✔
451
    unsetenv("COLORTERM");
1✔
452
    unsetenv("COLORFGBG");
1✔
453
    unsetenv("VTE_VERSION");
1✔
454
    unsetenv("XTERM_VERSION");
1✔
455
    unsetenv("ROXTERM_ID");
1✔
456
    unsetenv("KONSOLE_DBUS_SESSION");
1✔
457
    unsetenv("KONSOLE_DCOP");
1✔
458
    unsetenv("TMUX");
1✔
459

460
    netbsd.disableMetaSendsEscape();
1✔
461
    netbsd.init();
1✔
462
    term_detection.detect();
1✔
463
    finalcut::FTerm::detectTermSize();
1✔
464

465
#if DEBUG
466
    const finalcut::FString& sec_da = \
467
        finalcut::FTermDebugData::getInstance().getSecDAString();
1✔
468
    CPPUNIT_ASSERT ( sec_da == "\033[>24;20;0c" );
6✔
469
#endif
470

471
    CPPUNIT_ASSERT ( ::isatty(0) == 1 );
6✔
472
    CPPUNIT_ASSERT ( ! data.isTermType(finalcut::FTermType::openbsd_con) );
6✔
473
    CPPUNIT_ASSERT ( data.isTermType(finalcut::FTermType::netbsd_con) );
6✔
474
    CPPUNIT_ASSERT ( data.getTerminalGeometry().getWidth() == 80 );
6✔
475
    CPPUNIT_ASSERT ( data.getTerminalGeometry().getHeight() == 25 );
6✔
476
    CPPUNIT_ASSERT ( ! data.hasShadowCharacter() );
6✔
477
    CPPUNIT_ASSERT ( ! data.hasHalfBlockCharacter() );
5✔
478

479
    netbsd.finish();
1✔
480

481
    netbsd.enableMetaSendsEscape();
1✔
482
    netbsd.init();
1✔
483

484
    CPPUNIT_ASSERT ( ::isatty(0) == 1 );
6✔
485
    CPPUNIT_ASSERT ( ! data.isTermType(finalcut::FTermType::openbsd_con) );
6✔
486
    CPPUNIT_ASSERT ( data.isTermType(finalcut::FTermType::netbsd_con) );
6✔
487
    CPPUNIT_ASSERT ( data.getTerminalGeometry().getWidth() == 80 );
6✔
488
    CPPUNIT_ASSERT ( data.getTerminalGeometry().getHeight() == 25 );
6✔
489
    CPPUNIT_ASSERT ( ! data.hasShadowCharacter() );
6✔
490
    CPPUNIT_ASSERT ( ! data.hasHalfBlockCharacter() );
5✔
491

492
    netbsd.finish();
1✔
493

494
    closeConEmuStdStreams();
1✔
495
    exit(EXIT_SUCCESS);
1✔
496
  }
497
  else  // Parent
498
  {
499
    // Start the terminal emulation
500
    startConEmuTerminal (ConEmu::console::netbsd_con);
2✔
501
    int wstatus;
502

503
    if ( waitpid(pid, &wstatus, WUNTRACED) != pid )
2✔
504
      std::cerr << "waitpid error" << std::endl;
×
505

506
    if ( WIFEXITED(wstatus) )
2✔
507
      CPPUNIT_ASSERT ( WEXITSTATUS(wstatus) == 0 );
12✔
508
  }
509
}
2✔
510

511
//----------------------------------------------------------------------
512
void ftermopenbsdTest::openbsdConsoleTest()
2✔
513
{
514
  std::unique_ptr<finalcut::FSystem> fsys = std::make_unique<test::FSystemTest>();
2✔
515
  finalcut::FTerm::setFSystem(fsys);
2✔
516
  std::cout << "\n";
2✔
517
  auto& data = finalcut::FTermData::getInstance();
2✔
518

519
  auto& encoding_list = data.getEncodingList();
2✔
520
  encoding_list["UTF-8"] = finalcut::Encoding::UTF8;
4✔
521
  encoding_list["UTF8"]  = finalcut::Encoding::UTF8;
4✔
522
  encoding_list["VT100"] = finalcut::Encoding::VT100;
4✔
523
  encoding_list["PC"]    = finalcut::Encoding::PC;
4✔
524
  encoding_list["ASCII"] = finalcut::Encoding::ASCII;
2✔
525

526
  data.setTermEncoding(finalcut::Encoding::VT100);
2✔
527
  data.setBaudrate(9600);
2✔
528
  data.setTermType("vt220");
4✔
529
  data.setTermFileName("/dev/ttyC0");
2✔
530
  data.setTTYFileDescriptor(0);
2✔
531
  data.supportShadowCharacter (false);
2✔
532
  data.supportHalfBlockCharacter (false);
2✔
533
  data.supportCursorOptimisation (true);
2✔
534
  data.setCursorHidden (true);
2✔
535
  data.useAlternateScreen (false);
2✔
536
  data.setASCIIConsole (true);
2✔
537
  data.setVT100Console (false);
2✔
538
  data.setUTF8Console (false);
2✔
539
  data.setUTF8 (false);
2✔
540
  data.setNewFont (false);
2✔
541
  data.setVGAFont (false);
2✔
542
  data.setMonochron (false);
2✔
543
  data.setTermResized (false);
2✔
544
  setenv ("TERM", "vt220", 1);
2✔
545

546
  // setupterm is needed for tputs in ncurses >= 6.1
547
  setupterm (static_cast<char*>(nullptr), 1, static_cast<int*>(nullptr));
2✔
548
  auto& term_detection = finalcut::FTermDetection::getInstance();
2✔
549
  term_detection.setTerminalDetection(true);
2✔
550
  pid_t pid = forkConEmu();
2✔
551

552
  if ( isConEmuChildProcess(pid) )
2✔
553
  {
554
    // (gdb) set follow-fork-mode child
555
    finalcut::FTermOpenBSD openbsd;
556

557
    setenv ("TERM", "vt220", 1);
1✔
558
    setenv ("COLUMNS", "80", 1);
1✔
559
    setenv ("LINES", "25", 1);
1✔
560
    unsetenv("TERMCAP");
1✔
561
    unsetenv("COLORTERM");
1✔
562
    unsetenv("COLORFGBG");
1✔
563
    unsetenv("VTE_VERSION");
1✔
564
    unsetenv("XTERM_VERSION");
1✔
565
    unsetenv("ROXTERM_ID");
1✔
566
    unsetenv("KONSOLE_DBUS_SESSION");
1✔
567
    unsetenv("KONSOLE_DCOP");
1✔
568
    unsetenv("TMUX");
1✔
569

570
    const auto& fsystem = finalcut::FSystem::getInstance();
1✔
571
    auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());
1✔
572
    wskbd_bell_data& speaker = fsystest->getBell();
1✔
573
    openbsd.disableMetaSendsEscape();
1✔
574
    openbsd.init();
1✔
575
    term_detection.detect();
1✔
576
    finalcut::FTerm::detectTermSize();
1✔
577

578
#if DEBUG
579
    const finalcut::FString& sec_da = \
580
        finalcut::FTermDebugData::getInstance().getSecDAString();
1✔
581
    CPPUNIT_ASSERT ( sec_da == "\033[>24;20;0c" );
6✔
582
#endif
583

584
    CPPUNIT_ASSERT ( ::isatty(0) == 1 );
6✔
585
    CPPUNIT_ASSERT ( data.isTermType(finalcut::FTermType::openbsd_con) );
6✔
586
    CPPUNIT_ASSERT ( ! data.isTermType(finalcut::FTermType::netbsd_con) );
6✔
587
    CPPUNIT_ASSERT ( data.getTerminalGeometry().getWidth() == 80 );
6✔
588
    CPPUNIT_ASSERT ( data.getTerminalGeometry().getHeight() == 25 );
6✔
589
    CPPUNIT_ASSERT ( ! data.hasShadowCharacter() );
6✔
590
    CPPUNIT_ASSERT ( ! data.hasHalfBlockCharacter() );
6✔
591
    CPPUNIT_ASSERT ( term_detection.getTermType() == "pccon" );
5✔
592

593
    openbsd.finish();
1✔
594

595
    openbsd.enableMetaSendsEscape();
1✔
596
    openbsd.init();
1✔
597

598
    CPPUNIT_ASSERT ( ::isatty(0) == 1 );
6✔
599
    CPPUNIT_ASSERT ( data.isTermType(finalcut::FTermType::openbsd_con) );
6✔
600
    CPPUNIT_ASSERT ( ! data.isTermType(finalcut::FTermType::netbsd_con) );
6✔
601
    CPPUNIT_ASSERT ( data.getTerminalGeometry().getWidth() == 80 );
6✔
602
    CPPUNIT_ASSERT ( data.getTerminalGeometry().getHeight() == 25 );
6✔
603
    CPPUNIT_ASSERT ( ! data.hasShadowCharacter() );
6✔
604
    CPPUNIT_ASSERT ( ! data.hasHalfBlockCharacter() );
6✔
605

606
    CPPUNIT_ASSERT ( speaker.pitch  == 1500 );
6✔
607
    CPPUNIT_ASSERT ( speaker.period == 100 );
6✔
608
    CPPUNIT_ASSERT ( speaker.volume == 50 );
5✔
609
    openbsd.setBeep (20, 100);     // Hz < 21
1✔
610
    CPPUNIT_ASSERT ( speaker.pitch  == 1500 );
6✔
611
    CPPUNIT_ASSERT ( speaker.period == 100 );
6✔
612
    CPPUNIT_ASSERT ( speaker.volume == 50 );
5✔
613
    openbsd.setBeep (32767, 100);  // Hz > 32766
1✔
614
    CPPUNIT_ASSERT ( speaker.pitch  == 1500 );
6✔
615
    CPPUNIT_ASSERT ( speaker.period == 100 );
6✔
616
    CPPUNIT_ASSERT ( speaker.volume == 50 );
5✔
617
    openbsd.setBeep (200, -1);     // ms < 0
1✔
618
    CPPUNIT_ASSERT ( speaker.pitch  == 1500 );
6✔
619
    CPPUNIT_ASSERT ( speaker.period == 100 );
6✔
620
    CPPUNIT_ASSERT ( speaker.volume == 50 );
5✔
621
    openbsd.setBeep (200, 2000);   // ms > 1999
1✔
622
    CPPUNIT_ASSERT ( speaker.pitch  == 1500 );
6✔
623
    CPPUNIT_ASSERT ( speaker.period == 100 );
6✔
624
    CPPUNIT_ASSERT ( speaker.volume == 50 );
5✔
625
    openbsd.setBeep (200, 100);    // 200 Hz - 100 ms
1✔
626
    CPPUNIT_ASSERT ( speaker.pitch  == 200 );
6✔
627
    CPPUNIT_ASSERT ( speaker.period == 100 );
6✔
628
    CPPUNIT_ASSERT ( speaker.volume == 50 );
5✔
629
    openbsd.resetBeep();
1✔
630
    CPPUNIT_ASSERT ( speaker.pitch  == 1500 );
6✔
631
    CPPUNIT_ASSERT ( speaker.period == 100 );
6✔
632
    CPPUNIT_ASSERT ( speaker.volume == 50 );
5✔
633

634
    openbsd.finish();
1✔
635

636
    closeConEmuStdStreams();
1✔
637
    exit(EXIT_SUCCESS);
1✔
638
  }
639
  else  // Parent
640
  {
641
    // Start the terminal emulation
642
    startConEmuTerminal (ConEmu::console::openbsd_con);
1✔
643
    int wstatus;
644

645
    if ( waitpid(pid, &wstatus, WUNTRACED) != pid )
1✔
646
      std::cerr << "waitpid error" << std::endl;
×
647

648
    if ( WIFEXITED(wstatus) )
1✔
649
      CPPUNIT_ASSERT ( WEXITSTATUS(wstatus) == 0 );
6✔
650
  }
651
}
1✔
652

653

654
// Put the test suite in the registry
655
CPPUNIT_TEST_SUITE_REGISTRATION (ftermopenbsdTest);
656

657
// The general unit test main part
658
#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