Commit Graph

288 Commits

Author SHA1 Message Date
Pietro Gagliardi eb1250a32b Fixed the build and implemented some of the missing functions I just added. Not too happy with how these tests are structured so far; I might hack on that before continuing... 2022-07-30 12:13:36 -04:00
Pietro Gagliardi 1d7c530c32 More implementation of the new uiWindows control parenting and sizing system. 2022-07-30 04:14:16 -04:00
Pietro Gagliardi 69dbafe6f2 Oops forgot to commit this before midnight: started work on uiWindow children. 2022-07-26 00:18:37 -04:00
Pietro Gagliardi 80ddb4df8f Rounded out uiWindow and uiDarwinControl error conditions and error condition documentation. 2020-05-30 21:17:17 -04:00
Pietro Gagliardi de3598df80 Added tests for the uiWindow methods being called after init/on the right thread. To actually implement those, wrote OS-independent wrappers for the uiWindow functions. This will likely become a pattern throughout libui... 2020-05-25 22:35:25 -04:00
Pietro Gagliardi 0dd4bec2af Added uiDarwinControlHandle(), and added it to uiWindow, and added uiWindow handle tests (including underlying string tests) to the test suite. Oof. Also I just remembered we're missing tests of these new functions in noinitwrongthread.c. 2020-05-25 22:13:48 -04:00
Pietro Gagliardi 0be1273dab Finished our initial implementation of uiWindow on macOS to our previous spec. Now to write tests. 2020-05-24 17:23:52 -04:00
Pietro Gagliardi 8db1d5474b Included testhooks.h from uipriv.h and test.h, to make things easier to write (we won't have to keep remembering to include it in every file) and to clean up (ditto, but for removal). 2020-05-22 16:32:04 -04:00
Pietro Gagliardi 6fe7c1ef66 Added a UTF-8 sanitization routine. This will be needed for titles on uiWindow. Reintroduced our copy of the utf library. This should really be part of utf; I'll have to decide whether to test this or not. Made that a TODO for now. I'll be testing bad UTF-8 inputs on each function that takes UTF-8 strings anyway, just to be safe. Now we can finally add uiWindow! 2020-05-17 22:18:47 -04:00
Pietro Gagliardi 7aeb937b93 Added methods to uiControl to catch and handle parent changing from the perspective of the individual controls. This will be used to implement the transition from not being backed by an OS handle to being backed by one and back on Windows, and should be all we need to start re-adding controls after uiWindow. 2020-05-13 12:43:40 -04:00
Pietro Gagliardi 19a776e446 And integrated the cycle-checking code. Woo it's got tests! Now we need to worry about the OS-side test code, assuming I don't have any more pesky TODOs to fix immediately... 2020-05-11 21:02:04 -04:00
Pietro Gagliardi b1d733e9a2 Reworked programmer error tests to limit what they catch. The cycle checking tests now correctly crash and burn because the programmer errors they throw are elsewhere. Now to actually hook up the cycle checking! Also added some notes to test/errors.c to explain what we're doing and also fixed the build. 2020-05-11 20:55:34 -04:00
Pietro Gagliardi fdf9a1245d Wrote the code to check for parent cycles. I'm not going to actually hook it up yet; I want to resolve the one TODO about limiting the scope of the checkProgrammerError() calls first. 2020-05-11 19:48:02 -04:00
Pietro Gagliardi e71c717b31 Made the test for an invalid control type slightly more robust by not using either 0 or 5 for the fake object (but rather some other value that isn't the constant and that's also conveniently ASCII) and deduplicating the redundant tests. 2020-05-10 22:00:49 -04:00
Pietro Gagliardi c52656f2c2 Explicitly specified 0 as the invalid control type and stopped using 5 as an invalid control type. 2020-05-10 21:54:37 -04:00
Pietro Gagliardi 41e62cdce1 Added basic testing for init failing. Now to add support for testing for the lack of a programmer error. 2020-05-09 02:04:51 -04:00
Pietro Gagliardi 514037ba6c Modified common and the macOS port to exhibit the new init/main behavior. Now to adjust the tests. 2020-05-09 01:24:40 -04:00
Pietro Gagliardi dea7b52605 Revert "Made thread names consistent."
I don't know if I want to do this yet.

This reverts commit 456fb594c0.
2020-05-09 00:34:51 -04:00
Pietro Gagliardi 456fb594c0 Made thread names consistent. 2020-05-09 00:18:06 -04:00
Pietro Gagliardi 69bf71aaa1 Decided to hold off on events for now. I'm still not sure about this design and it's holding me back. 2020-05-08 00:16:14 -04:00
Pietro Gagliardi 4fae662575 Revert "Started restructuring common/errors.c to only produce a single error string (so we can pass it to Haiku's debugger() function without further allocations). In this case, the buffer size is 256 + the size of the prefix + the size of the suffix now."
Okay, this is actually going to be more complicated than I at first thought...

This reverts commit 44e13e53bf.
2020-02-09 20:49:47 -05:00
Pietro Gagliardi 44e13e53bf Started restructuring common/errors.c to only produce a single error string (so we can pass it to Haiku's debugger() function without further allocations). In this case, the buffer size is 256 + the size of the prefix + the size of the suffix now. 2020-02-09 18:27:19 -05:00
Pietro Gagliardi 83129eeef5 Normalized uiprivInternalError() calls to always try to fail gracefully, and make sure errors don't call abort() so we can resume when debugging (and because this isn't really our decision to make...). (The debugger breaks will be removed from release builds when we get to that point.) Finally, refined some TODOs and removed some stale ones (in this case, that were related to the first few things). 2020-02-09 13:37:45 -05:00
Pietro Gagliardi edee2b930c Re-added uiControlSetParent() to allow finishing testing uiControlFree() errors. That will come next, alongside its own errors. 2019-06-16 19:52:09 -04:00
Pietro Gagliardi fda6c4a743 And strengthened the uiControlType() test a bit. 2019-06-16 17:32:47 -04:00
Pietro Gagliardi c28adcbd01 Added test hook for checking a malformed uiControl whose type field is invalid. 2019-06-16 17:26:03 -04:00
Pietro Gagliardi 29ce809772 And FINALLY fixed the NULL name error in uiRegisterControlType(). 2019-06-15 21:38:21 -04:00
Pietro Gagliardi b6a8d24c3e And fixed const issues and other build errors. 2019-06-15 20:48:20 -04:00
Pietro Gagliardi 65226ac416 Refactored the programmer error test hook to not needlessly pass in the prefix, suffix, or internal flag, and to allow passing in arbitrary data so we can get rid of the global state in the tests. This will make the tests a LOT easier. 2019-06-09 13:49:53 -04:00
Pietro Gagliardi a2b9145931 Did the same rewording to most of the other programmer errors. Only the first two are left, because I can't think of a good rewording... 2019-06-09 13:39:14 -04:00
Pietro Gagliardi 87a2195027 Renamed the uiControl programmer errors to more clearly indicate they are uiControl programmer errors, and reworded their messages to put the function name first. 2019-06-09 13:32:31 -04:00
Pietro Gagliardi 0f41bb2188 Made all programmer error functions take the function name as an argument. 2019-06-09 13:18:18 -04:00
Pietro Gagliardi 9b11ec4a6f Changed the IntID error into a uiEvent-specific one. 2019-06-09 10:30:47 -04:00
Pietro Gagliardi 14c80eefb8 Started organizing common/programmererrors.h. 2019-06-09 10:27:28 -04:00
Pietro Gagliardi e808d85e01 Added function names to the wrong struct size error. 2019-06-09 08:50:12 -04:00
Pietro Gagliardi 379fc230e5 More compile fixes. sharedbits is starting to get really messy. 2019-06-08 18:39:59 -04:00
Pietro Gagliardi 22cc5ad834 More error fixing. 2019-06-08 18:22:16 -04:00
Pietro Gagliardi 19fc6f674f Oops, forgot to add controls.c to the build. 2019-06-08 18:09:37 -04:00
Pietro Gagliardi 9f776c140d Fixed compile errors. 2019-06-08 18:09:12 -04:00
Pietro Gagliardi 7aa1b0870d And finished filling in controls.c. This is gonna be fun to debug... 2019-06-08 15:31:40 -04:00
Pietro Gagliardi 1189877ca5 Started writing the uiControl implementation. 2019-06-08 13:00:30 -04:00
Pietro Gagliardi 6cf92b2058 Wrote and started testing uiEventInvalidateSender(). The rest of the tests come next. 2019-06-07 10:58:39 -04:00
Pietro Gagliardi 26e492539d Renamed uiFreeEvent() to uiEventFree() for consistency with uiControlFree(). 2019-06-02 22:04:25 -04:00
Pietro Gagliardi 9f2796ebac Added uiEventFree(). Now to add it to the tests and see what AddressSanitizer says afterward. 2019-06-02 10:06:50 -04:00
Pietro Gagliardi ece22bdddc Split programmer errors into their own header file for readability and turned the names from string constants into full-fledged uiprivProgrammerError() calls to increase safety. 2019-06-02 08:35:40 -04:00
Pietro Gagliardi 623575f25a Changed uiprivProgrammerError() to use format strings directly, so errors can be more easily caught. We'll make things even more robust when I change the programmer error macros to be functions. 2019-06-02 02:23:12 -04:00
Pietro Gagliardi 8980a8663b Cleaned up a TODO. 2019-06-01 20:46:41 -04:00
Pietro Gagliardi 6ffe0a4c99 Added functionality to mark printf() functions for compilers with warning checks, and marked such. Sadly it appears ms_printf is ignored with -pedantic, so we'll need to stop using I32... 2019-06-01 20:20:11 -04:00
Pietro Gagliardi a8ad49fead Made the names of format string arguments across the board consistent. Only the "public" functions in the testing library are kept expanded for documentation purposes. 2019-06-01 11:40:16 -04:00
Pietro Gagliardi 76fabb37cf Renamed common/init.c to common/main.c. 2019-06-01 11:24:34 -04:00