diff --git a/ChangeLog b/ChangeLog index bf54ec61..e9dcaae4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2019-08-10 Markus Gans + * Pitch and duration of system speaker can now be changed + on OpenBSD + 2019-08-07 Markus Gans * Fixes the Cygwin build diff --git a/src/Makefile.am b/src/Makefile.am index ebdf222e..0c71d77b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -75,7 +75,6 @@ finalcutinclude_HEADERS = \ include/final/fapplication.h \ include/final/fbutton.h \ include/final/fbuttongroup.h \ - include/final/fcharmap.h \ include/final/fcheckbox.h \ include/final/fcolorpair.h \ include/final/fconfig.h \ diff --git a/src/fterm.cpp b/src/fterm.cpp index ba30571a..580abdc8 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -1032,16 +1032,28 @@ void FTerm::setPalette (FColor index, int r, int g, int b) } //---------------------------------------------------------------------- -#if defined(__linux__) +#if defined(UNIT_TEST) +void FTerm::setBeep (int Hz, int ms) +{ + linux->setBeep (Hz, ms); + freebsd->setBeep (Hz, ms); + openbsd->setBeep (Hz, ms); +} +#elif defined(__linux__) void FTerm::setBeep (int Hz, int ms) { linux->setBeep (Hz, ms); } -#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST) +#elif defined(__FreeBSD__) || defined(__DragonFly__) void FTerm::setBeep (int Hz, int ms) { freebsd->setBeep (Hz, ms); } +#elif defined(__NetBSD__) || defined(__OpenBSD__) +void FTerm::setBeep (int Hz, int ms) +{ + openbsd->setBeep (Hz, ms); +} #else void FTerm::setBeep (int, int) { } @@ -1050,10 +1062,16 @@ void FTerm::setBeep (int, int) //---------------------------------------------------------------------- void FTerm::resetBeep() { -#if defined(__linux__) +#if defined(UNIT_TEST) linux->resetBeep(); -#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST) freebsd->resetBeep(); + openbsd->resetBeep(); +#elif defined(__linux__) + linux->resetBeep(); +#elif defined(__FreeBSD__) || defined(__DragonFly__) + freebsd->resetBeep(); +#elif defined(__NetBSD__) || defined(__OpenBSD__) + openbsd->resetBeep(); #endif } @@ -2327,8 +2345,8 @@ void FTerm::init (bool disable_alt_screen) if ( init_values.color_change ) redefineColorPalette(); - // Set 200 Hz beep (100 ms) - setBeep(200, 100); + // Set 220 Hz beep (100 ms) + setBeep(220, 100); // Set FTerm signal handler setSignalHandler(); diff --git a/src/ftermfreebsd.cpp b/src/ftermfreebsd.cpp index 213e87d6..baa415c2 100644 --- a/src/ftermfreebsd.cpp +++ b/src/ftermfreebsd.cpp @@ -94,11 +94,11 @@ void FTermFreeBSD::setBeep (int Hz, int ms) if ( ! FTerm::isFreeBSDTerm() ) return; - // range for frequency: 21-32766 + // Range for frequency: 21-32766 if ( Hz < 21 || Hz > 32766 ) return; - // range for duration: 0-1999 + // Range for duration: 0-1999 if ( ms < 0 || ms > 1999 ) return; @@ -115,8 +115,8 @@ void FTermFreeBSD::resetBeep() if ( ! FTerm::isFreeBSDTerm() ) return; - // default frequency: 1491 Hz - // default duration: 50 ms + // Default frequency: 1491 Hz + // Default duration: 50 ms FTerm::putstring (CSI "=800;5B"); std::fflush(stdout); } @@ -124,7 +124,7 @@ void FTermFreeBSD::resetBeep() //---------------------------------------------------------------------- void FTermFreeBSD::init() { - // initialize BSD console + // Initialize BSD console fsystem = FTerm::getFSystem(); fterm_data = FTerm::getFTermData(); @@ -134,10 +134,10 @@ void FTermFreeBSD::init() if ( meta_sends_escape ) { - // save current left alt key mapping + // Save current left alt key mapping saveFreeBSDAltKey(); - // map meta key to left alt key + // Map meta key to left alt key setFreeBSDAlt2Meta(); } @@ -192,7 +192,7 @@ bool FTermFreeBSD::saveFreeBSDAltKey() if ( ret < 0 ) return false; - // save current mapping + // Save current mapping bsd_alt_keymap = keymap.key[left_alt].map[0]; return true; } diff --git a/src/ftermlinux.cpp b/src/ftermlinux.cpp index b5ccba38..2f4208db 100644 --- a/src/ftermlinux.cpp +++ b/src/ftermlinux.cpp @@ -160,7 +160,7 @@ bool FTermLinux::isLinuxConsole() char arg = 0; int fd_tty = FTerm::getTTYFileDescriptor(); - // get keyboard type an compare + // Get keyboard type an compare return ( fsystem->isTTY(fd_tty) && fsystem->ioctl(fd_tty, KDGKBTYPE, &arg) == 0 && ((arg == KB_101) || (arg == KB_84)) ); @@ -169,7 +169,7 @@ bool FTermLinux::isLinuxConsole() //---------------------------------------------------------------------- void FTermLinux::init() { - // initialize Linux console + // Initialize Linux console if ( ! fsystem ) fsystem = FTerm::getFSystem(); @@ -289,7 +289,7 @@ bool FTermLinux::loadVGAFont() if ( ret != 0 ) vga_font = false; - // unicode character mapping + // Unicode character mapping struct unimapdesc unimap; unimap.entry_ct = uInt16 ( sizeof(fc::unicode_cp437_pairs) / sizeof(unipair) ); @@ -330,7 +330,7 @@ bool FTermLinux::loadNewFont() if ( ret != 0 ) new_font = false; - // unicode character mapping + // Unicode character mapping struct unimapdesc unimap; unimap.entry_ct = uInt16 ( sizeof(fc::unicode_cp437_pairs) / sizeof(unipair) ); @@ -429,11 +429,11 @@ void FTermLinux::setBeep (int Hz, int ms) if ( ! FTerm::isLinuxTerm() ) return; - // range for frequency: 21-32766 + // Range for frequency: 21-32766 if ( Hz < 21 || Hz > 32766 ) return; - // range for duration: 0-1999 + // Range for duration: 0-1999 if ( ms < 0 || ms > 1999 ) return; @@ -449,8 +449,8 @@ void FTermLinux::resetBeep() if ( ! FTerm::isLinuxTerm() ) return; - // default frequency: 750 Hz - // default duration: 125 ms + // Default frequency: 750 Hz + // Default duration: 125 ms FTerm::putstring ( CSI "10;750]" CSI "11;125]" ); std::fflush(stdout); @@ -550,7 +550,7 @@ bool FTermLinux::getScreenFont() if ( fd_tty < 0 ) return false; - // initialize unused padding bytes in struct + // Initialize unused padding bytes in struct std::memset (&font, 0, sizeof(console_font_op)); font.op = KD_FONT_OP_GET; @@ -559,7 +559,7 @@ bool FTermLinux::getScreenFont() font.height = 32; font.charcount = 512; - // initialize with 0 + // Initialize with 0 try { static constexpr std::size_t data_size = 4 * 32 * 512; @@ -571,7 +571,7 @@ bool FTermLinux::getScreenFont() return false; } - // font operation + // Font operation if ( fsystem ) ret = fsystem->ioctl (fd_tty, KDFONTOP, &font); @@ -602,7 +602,7 @@ bool FTermLinux::getUnicodeMap() screen_unicode_map.entry_ct = 0; screen_unicode_map.entries = nullptr; - // get count + // Get count if ( fsystem ) ret = fsystem->ioctl (fd_tty, GIO_UNIMAP, &screen_unicode_map); @@ -623,7 +623,7 @@ bool FTermLinux::getUnicodeMap() return false; } - // get unicode-to-font mapping from kernel + // Get unicode-to-font mapping from kernel if ( fsystem ) ret = fsystem->ioctl (fd_tty, GIO_UNIMAP, &screen_unicode_map); @@ -641,7 +641,7 @@ FTermLinux::modifier_key& FTermLinux::getModifierKey() char subcode = 6; // Shift state command + return value - // fill bit field with 0 + // Fill bit field with 0 std::memset (&mod_key, 0x00, sizeof(mod_key)); // TIOCLINUX, subcode = 6 (TIOCL_GETSHIFTSTATE) @@ -675,7 +675,7 @@ int FTermLinux::setScreenFont ( uChar fontdata[], uInt count if ( fd_tty < 0 ) return -1; - // initialize unused padding bytes in struct + // Initialize unused padding bytes in struct std::memset (&font, 0x00, sizeof(console_font_op)); font.op = KD_FONT_OP_SET; @@ -693,7 +693,7 @@ int FTermLinux::setScreenFont ( uChar fontdata[], uInt count try { - font.data = new uChar[data_size](); // initialize with 0 + font.data = new uChar[data_size](); // Initialize with 0 } catch (const std::bad_alloc& ex) { @@ -707,7 +707,7 @@ int FTermLinux::setScreenFont ( uChar fontdata[], uInt count , font.height); } - // font operation + // Font operation if ( fsystem ) ret = fsystem->ioctl (fd_tty, KDFONTOP, &font); @@ -744,14 +744,14 @@ int FTermLinux::setUnicodeMap (struct unimapdesc* unimap) do { - // clear the unicode-to-font table + // Clear the unicode-to-font table if ( fsystem ) ret = fsystem->ioctl (fd_tty, PIO_UNIMAPCLR, &advice); if ( ret != 0 ) return -1; - // put the new unicode-to-font mapping in kernel + // Put the new unicode-to-font mapping in kernel if ( fsystem ) ret = fsystem->ioctl (fd_tty, PIO_UNIMAP, unimap); diff --git a/src/ftermopenbsd.cpp b/src/ftermopenbsd.cpp index e31f9629..d5bbe2ba 100644 --- a/src/ftermopenbsd.cpp +++ b/src/ftermopenbsd.cpp @@ -61,7 +61,7 @@ bool FTermOpenBSD::isBSDConsole() //---------------------------------------------------------------------- void FTermOpenBSD::init() { - // initialize BSD workstation console + // Initialize BSD workstation console fsystem = FTerm::getFSystem(); @@ -70,10 +70,10 @@ void FTermOpenBSD::init() if ( meta_sends_escape ) { - // save current left alt key mapping + // Save current left alt key mapping saveBSDConsoleEncoding(); - // alt key generate ESC prefix + // Alt key generate ESC prefix setBSDConsoleMetaEsc(); } } @@ -88,6 +88,52 @@ void FTermOpenBSD::finish() resetBSDConsoleEncoding(); } +//---------------------------------------------------------------------- +bool FTermOpenBSD::setBeep (int Hz, int ms) +{ + if ( ! isBSDConsole() ) + return false; + + // Range for frequency: 21-32766 + if ( Hz < 21 || Hz > 32766 ) + return false; + + // Range for duration: 0-1999 + if ( ms < 0 || ms > 1999 ) + return false; + + wskbd_bell_data bell; + bell.which = WSKBD_BELL_DOALL; + bell.pitch = Hz; + bell.period = ms; + bell.volume = 50; // 50% volume + + if ( fsystem && fsystem->ioctl(0, WSKBDIO_SETBELL, &bell) < 0 ) + return false; + else + return true; +} + +//---------------------------------------------------------------------- +bool FTermOpenBSD::resetBeep() +{ + wskbd_bell_data default_bell; + + // Gets the default setting for the bell + if ( fsystem + && fsystem->ioctl(0, WSKBDIO_GETDEFAULTBELL, &default_bell) < 0 ) + return false; + + default_bell.which = WSKBD_BELL_DOALL; + + // Sets the bell settings + if ( fsystem + && fsystem->ioctl(0, WSKBDIO_SETBELL, &default_bell) < 0 ) + return false; + else + return true; +} + // private methods of FTermOpenBSD //---------------------------------------------------------------------- @@ -102,7 +148,7 @@ bool FTermOpenBSD::saveBSDConsoleEncoding() if ( ret < 0 ) return false; - // save current encoding + // Save current encoding bsd_keyboard_encoding = k_encoding; return true; } @@ -120,7 +166,7 @@ bool FTermOpenBSD::setBSDConsoleEncoding (kbd_t k_encoding) //---------------------------------------------------------------------- bool FTermOpenBSD::setBSDConsoleMetaEsc() { - static constexpr kbd_t meta_esc = 0x20; // generate ESC prefix on ALT-key + static constexpr kbd_t meta_esc = 0x20; // Generate ESC prefix on ALT-key return setBSDConsoleEncoding (bsd_keyboard_encoding | meta_esc); } diff --git a/src/include/final/ftermopenbsd.h b/src/include/final/ftermopenbsd.h index c21a4be0..702ef986 100644 --- a/src/include/final/ftermopenbsd.h +++ b/src/include/final/ftermopenbsd.h @@ -40,7 +40,22 @@ #if defined(UNIT_TEST) #define WSKBDIO_GETENCODING uInt32(0x4004570F) #define WSKBDIO_SETENCODING uInt32(0x80045710) + #define WSKBDIO_GETDEFAULTBELL uInt32(0x40105706) + #define WSKBDIO_SETBELL uInt32(0x80105703) + #define WSKBD_BELL_DOPITCH 0x1 // get/set pitch + #define WSKBD_BELL_DOPERIOD 0x2 // get/set period + #define WSKBD_BELL_DOVOLUME 0x4 // get/set volume + #define WSKBD_BELL_DOALL 0x7 // all of the above + typedef uInt32 kbd_t; + + struct wskbd_bell_data + { + uInt which; // values to get/set + uInt pitch; // pitch, in Hz + uInt period; // period, in milliseconds + uInt volume; // percentage of max volume + }; #elif defined(__NetBSD__) || defined(__OpenBSD__) #include #include @@ -87,6 +102,8 @@ class FTermOpenBSD final // Methods static void init(); static void finish(); + static bool setBeep (int, int); + static bool resetBeep(); private: #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST) diff --git a/test/ftermlinux-test.cpp b/test/ftermlinux-test.cpp index a38053f0..64494192 100644 --- a/test/ftermlinux-test.cpp +++ b/test/ftermlinux-test.cpp @@ -39,6 +39,24 @@ #include #include +#define CPPUNIT_ASSERT_CSTRING(expected, actual) \ + check_c_string (expected, actual, CPPUNIT_SOURCELINE()) + +//---------------------------------------------------------------------- +void check_c_string ( const char* s1 + , const char* s2 + , CppUnit::SourceLine sourceLine ) +{ + if ( s1 == 0 && s2 == 0 ) // Strings are equal + return; + + if ( s1 && s2 && std::strcmp (s1, s2) == 0 ) // Strings are equal + return; + + ::CppUnit::Asserter::fail ("Strings are not equal", sourceLine); +} + + namespace test { @@ -1675,38 +1693,47 @@ void FTermLinuxTest::linuxCursorStyleTest() linux.setCursorStyle (finalcut::fc::default_cursor); CPPUNIT_ASSERT ( characters == CSI "?0c" ); CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::fc::default_cursor ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?0c" ); characters.clear(); linux.setCursorStyle (finalcut::fc::invisible_cursor); CPPUNIT_ASSERT ( characters == CSI "?1c" ); CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::fc::invisible_cursor ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?1c" ); characters.clear(); linux.setCursorStyle (finalcut::fc::underscore_cursor); CPPUNIT_ASSERT ( characters == CSI "?2c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?2c" ); CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::fc::underscore_cursor ); characters.clear(); linux.setCursorStyle (finalcut::fc::lower_third_cursor); CPPUNIT_ASSERT ( characters == CSI "?3c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?3c" ); CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::fc::lower_third_cursor ); characters.clear(); linux.setCursorStyle (finalcut::fc::lower_half_cursor); CPPUNIT_ASSERT ( characters == CSI "?4c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?4c" ); CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::fc::lower_half_cursor ); characters.clear(); linux.setCursorStyle (finalcut::fc::two_thirds_cursor); CPPUNIT_ASSERT ( characters == CSI "?5c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?5c" ); CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::fc::two_thirds_cursor ); characters.clear(); linux.setCursorStyle (finalcut::fc::full_block_cursor); CPPUNIT_ASSERT ( characters == CSI "?6c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?6c" ); CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::fc::full_block_cursor ); characters.clear(); linux.setCursorStyle (finalcut::fc::default_cursor); CPPUNIT_ASSERT ( characters == CSI "?0c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?0c" ); CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::fc::default_cursor ); characters.clear(); linux.setCursorStyle (linux.getCursorStyle()); CPPUNIT_ASSERT ( characters == CSI "?0c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?0c" ); CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::fc::default_cursor ); characters.clear(); data->setCursorHidden (true); @@ -1717,6 +1744,7 @@ void FTermLinuxTest::linuxCursorStyleTest() characters.clear(); linux.setCursorStyle (linux.getCursorStyle()); CPPUNIT_ASSERT ( characters == CSI "?1c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?1c" ); characters.clear(); data->setCursorHidden (true); linux.setCursorStyle (finalcut::fc::underscore_cursor); @@ -1726,6 +1754,7 @@ void FTermLinuxTest::linuxCursorStyleTest() characters.clear(); linux.setCursorStyle (linux.getCursorStyle()); CPPUNIT_ASSERT ( characters == CSI "?2c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?2c" ); characters.clear(); data->setCursorHidden (true); linux.setCursorStyle (finalcut::fc::lower_third_cursor); @@ -1735,6 +1764,7 @@ void FTermLinuxTest::linuxCursorStyleTest() characters.clear(); linux.setCursorStyle (linux.getCursorStyle()); CPPUNIT_ASSERT ( characters == CSI "?3c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?3c" ); characters.clear(); data->setCursorHidden (true); linux.setCursorStyle (finalcut::fc::lower_half_cursor); @@ -1744,6 +1774,7 @@ void FTermLinuxTest::linuxCursorStyleTest() characters.clear(); linux.setCursorStyle (linux.getCursorStyle()); CPPUNIT_ASSERT ( characters == CSI "?4c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?4c" ); characters.clear(); data->setCursorHidden (true); linux.setCursorStyle (finalcut::fc::two_thirds_cursor); @@ -1753,6 +1784,7 @@ void FTermLinuxTest::linuxCursorStyleTest() characters.clear(); linux.setCursorStyle (linux.getCursorStyle()); CPPUNIT_ASSERT ( characters == CSI "?5c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?5c" ); characters.clear(); data->setCursorHidden (true); linux.setCursorStyle (finalcut::fc::full_block_cursor); @@ -1762,6 +1794,7 @@ void FTermLinuxTest::linuxCursorStyleTest() characters.clear(); linux.setCursorStyle (linux.getCursorStyle()); CPPUNIT_ASSERT ( characters == CSI "?6c" ); + CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?6c" ); characters.clear(); linux.finish(); diff --git a/test/ftermopenbsd-test.cpp b/test/ftermopenbsd-test.cpp index 2bd794c4..3bddc163 100644 --- a/test/ftermopenbsd-test.cpp +++ b/test/ftermopenbsd-test.cpp @@ -73,20 +73,22 @@ class FSystemTest : public finalcut::FSystem virtual ~FSystemTest(); // Methods - uChar inPortByte (uShort) override; - void outPortByte (uChar, uShort) override; - int isTTY (int) override; - int ioctl (int, uLong, ...) override; - int open (const char*, int, ...) override; - int close (int) override; - FILE* fopen (const char*, const char*) override; - int fclose (FILE*) override; - int putchar (int) override; - int tputs (const char*, int, int (*)(int)) override; - uid_t getuid() override; + uChar inPortByte (uShort) override; + void outPortByte (uChar, uShort) override; + int isTTY (int) override; + int ioctl (int, uLong, ...) override; + int open (const char*, int, ...) override; + int close (int) override; + FILE* fopen (const char*, const char*) override; + int fclose (FILE*) override; + int putchar (int) override; + int tputs (const char*, int, int (*)(int)) override; + uid_t getuid() override; + wskbd_bell_data& getBell(); private: kbd_t kbdencoding = 512; + wskbd_bell_data system_bell; }; #pragma pack(pop) @@ -95,6 +97,11 @@ class FSystemTest : public finalcut::FSystem //---------------------------------------------------------------------- FSystemTest::FSystemTest() // constructor { + // Initialize bell values + system_bell.which = 0; + system_bell.pitch = 1500; + system_bell.period = 100; + system_bell.volume = 50; } //---------------------------------------------------------------------- @@ -153,6 +160,43 @@ int FSystemTest::ioctl (int fd, uLong request, ...) break; } + case WSKBDIO_GETDEFAULTBELL: + { + req_string = "WSKBDIO_GETDEFAULTBELL"; + wskbd_bell_data* spk = static_cast(argp); + spk->which = 0; + spk->pitch = 1500; + spk->period = 100; + spk->volume = 50; + ret_val = 0; + break; + } + + case WSKBDIO_SETBELL: + { + req_string = "WSKBDIO_SETBELL"; + wskbd_bell_data* spk = static_cast(argp); + + if ( spk->which & WSKBD_BELL_DOPITCH ) + system_bell.pitch = spk->pitch; + else + system_bell.pitch = 1500; + + if ( spk->which & WSKBD_BELL_DOPERIOD ) + system_bell.period = spk->period; + else + system_bell.period = 100; + + if ( spk->which & WSKBD_BELL_DOVOLUME ) + system_bell.volume = spk->volume; + else + system_bell.volume = 50; + + spk->which = WSKBD_BELL_DOALL; + ret_val = 0; + break; + } + case TIOCGWINSZ: req_string = "TIOCGWINSZ"; struct winsize* win_size = static_cast(argp); @@ -230,6 +274,12 @@ uid_t FSystemTest::getuid() return 0; } +//---------------------------------------------------------------------- +wskbd_bell_data& FSystemTest::getBell() +{ + return system_bell; +} + } // namespace test @@ -441,6 +491,8 @@ void ftermopenbsdTest::openbsdConsoleTest() unsetenv("KONSOLE_DCOP"); unsetenv("TMUX"); + test::FSystemTest* fsystest = static_cast(fsys); + wskbd_bell_data& speaker = fsystest->getBell(); openbsd.disableMetaSendsEscape(); openbsd.init(); term_detection->detect(); @@ -474,6 +526,34 @@ void ftermopenbsdTest::openbsdConsoleTest() CPPUNIT_ASSERT ( ! data->hasShadowCharacter() ); CPPUNIT_ASSERT ( ! data->hasHalfBlockCharacter() ); + CPPUNIT_ASSERT ( speaker.pitch == 1500 ); + CPPUNIT_ASSERT ( speaker.period == 100 ); + CPPUNIT_ASSERT ( speaker.volume == 50 ); + openbsd.setBeep (20, 100); // Hz < 21 + CPPUNIT_ASSERT ( speaker.pitch == 1500 ); + CPPUNIT_ASSERT ( speaker.period == 100 ); + CPPUNIT_ASSERT ( speaker.volume == 50 ); + openbsd.setBeep (32767, 100); // Hz > 32766 + CPPUNIT_ASSERT ( speaker.pitch == 1500 ); + CPPUNIT_ASSERT ( speaker.period == 100 ); + CPPUNIT_ASSERT ( speaker.volume == 50 ); + openbsd.setBeep (200, -1); // ms < 0 + CPPUNIT_ASSERT ( speaker.pitch == 1500 ); + CPPUNIT_ASSERT ( speaker.period == 100 ); + CPPUNIT_ASSERT ( speaker.volume == 50 ); + openbsd.setBeep (200, 2000); // ms > 1999 + CPPUNIT_ASSERT ( speaker.pitch == 1500 ); + CPPUNIT_ASSERT ( speaker.period == 100 ); + CPPUNIT_ASSERT ( speaker.volume == 50 ); + openbsd.setBeep (200, 100); // 200 Hz - 100 ms + CPPUNIT_ASSERT ( speaker.pitch == 200 ); + CPPUNIT_ASSERT ( speaker.period == 100 ); + CPPUNIT_ASSERT ( speaker.volume == 50 ); + openbsd.resetBeep(); + CPPUNIT_ASSERT ( speaker.pitch == 1500 ); + CPPUNIT_ASSERT ( speaker.period == 100 ); + CPPUNIT_ASSERT ( speaker.volume == 50 ); + openbsd.finish(); closeConEmuStdStreams();