Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ ASWUnitTests is a lightweight C++ console unit-testing framework.
- `rad370/` contains the RAD Studio 13.1 project and Windows build scripts.
- `vcl/` contains RAD Studio projects that link the VCL and define `ASWUNITTESTS_RTL_EXCEPTIONS`, exercising the framework's opt-in RTL support (RTL exceptions and the `System::String` overloads): `vcl/console/rad370/` is a VCL console project (with its own build scripts) that runs the full self-test suite plus the RTL-specific and GUI unit tests in `vcl/tests/`. `vcl/gui/rad370/` is the VCL GUI runner project (with its own build scripts, and a project group that also opens the console project), built from the sources in `vcl/gui/src/`. The console project also compiles the GUI's non-form units, so their tests run without the GUI.
- `win32/` contains the Win32 GUI runner, which uses only the Windows API (no VCL) and has the VCL GUI runner's features: `win32/gui/src/` holds its units, its `WinMain()`, its manifest and `ASWUnitTests_Win32GUI_Sources.cmake`, from which `cmake/CMakeLists.txt` builds the `ASWUnitTests_Win32_GUI` target on Windows. `win32/gui/rad370/` is its RAD Studio project (Win32 and Win64x, with its own build scripts). `win32/tests/` has the tests of its units that need no window, which the CMake console target and the `rad370` console project also compile on Windows.
- `cmake/` contains the CMake project, which builds the console runner and, on Windows, the Win32 GUI runner.
- `resource/` contains the ASWUnitTests icon, `ASWUnitTests.ico`, and `ASWUnitTests_Icon.rc`, which embeds it in the CMake builds; `make_icon.ps1` draws the icon and writes the `.ico` and its `icon_<size>.png` files.
- `README.md` contains usage and integration examples.
- `.uncrustify.cfg` and `.githooks/` define the repository formatting workflow.

Expand Down Expand Up @@ -71,7 +73,7 @@ Keep all source files (`.cpp`/`.h`) plain ASCII, including comments. MSVC reads

## Building and Testing

The RAD Studio debug build can be run from `rad370/Build_Win64x_Debug.bat` when the `Rad370` environment variable points to the RAD Studio installation. The release script is `rad370/Build_Win64x_Release.bat`. Neither pauses before exiting by default; pass `--pause` to have the console prompt "press enter to continue" first, e.g. when running from an IDE that would otherwise close the console immediately.
The RAD Studio debug build can be built with `rad370/Build_Win64x_Debug.bat`, run from `rad370/`, when the `Rad370` environment variable points to the RAD Studio installation. The release script is `rad370/Build_Win64x_Release.bat`. The scripts only build; the executable, `build/bin/<Config>/ASWUnitTests.exe`, doesn't pause before exiting by default. Pass it `--pause` to have the console prompt "press enter to continue" first, e.g. when running from an IDE that would otherwise close the console immediately (the RAD Studio projects' debugger parameters do).

For other environments, use the repository's CMake configuration when present or the IDE's native project configuration. Tests should be run outside the debugger unless debugging an expected exception is intentional. Before considering a change complete:

Expand Down
108 changes: 52 additions & 56 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,43 @@ versioned baseline.

## [Unreleased]

## [1.5.0] - 2026-10-30

### Added

- `TTestHandler::GetAppBitsStr()`, which returns `"64-bit"` or `"32-bit"`, and
`TTestHandler::GetBuildOS()`, which returns `"Windows"` or `"Linux"` (`"Unknown"` for any other
operating system), describing the build the framework was compiled for.
- A Win32 GUI runner, `ASWUnitTests_Win32_GUI`, with the same window, features and command line
options as the VCL GUI runner, built on the Windows API alone, so it needs neither the VCL nor
RAD Studio: it builds with CMake (MSVC, MinGW, Clang) as well as with RAD Studio, for Win32 and
Win64x. It needs Windows 10 version 1703 or later. This repository's CMake project builds it on
Windows, and a project of your own can build it with your tests by including
`win32\gui\src\ASWUnitTests_Win32GUI_Sources.cmake`; the README's "Win32 GUI Runner" section
covers both, and RAD Studio.
- `ASWUNITTESTS_CORE_SOURCES` in `src\ASWUnitTests_Sources.cmake`: the framework's sources without
`main.cpp`, for a runner with its own entry point. `ASWUNITTESTS_SOURCES` lists the same files as
before.
- `gui\src\ASWUnitTests_GUI_Sources.cmake`, which lists the GUI runners' shared units as
`ASWUNITTESTS_GUI_SOURCES`.
- A dark theme in both GUI runners, with **View > Theme** to choose it: **Use Windows Setting**
(the default) follows Windows' app mode setting, switching as soon as it changes, and **Light**
and **Dark** override it. The choice applies without a restart and is saved in the layout file;
`--layout-ignore` and `--layout-reset` cover it as they do the layout. In the VCL GUI runner, dark
is RAD Studio's Carbon VCL style, so a project of your own that runs its tests in it needs Carbon
among its custom styles (Project > Options > Application > Appearance) for it, and a `WinMain()`
that applies the saved theme as `vcl\gui\rad370\ASWUnitTests_VCL_GUI.cpp` does. The Win32 GUI
runner paints Carbon's colors itself, so it needs nothing more; its message boxes are its own
dialogs, in its theme, and its tree, results tabs and progress bar are drawn without flicker as
the window is resized.
- Theme files for the dark look in both GUI runners, chosen in **View > Theme > Dark Theme**, which
lists Carbon and the files in `%APPDATA%\ASWUnitTests\Themes`, shared by every test app. The Win32
GUI runner's are INI files that set any of its colors by role, and **Save Theme Template...**
saves Carbon's as one to start from; the VCL GUI runner's are VCL style files (`.vsf`). The
choice is saved in the layout file, and a theme file's problems are reported in the log.
- Four more built-in dark themes in the Win32 GUI runner, tints of Carbon: Ember (warm brown),
Forest (green), Midnight (blue) and Plum (purple), listed in **View > Theme > Dark Theme** above
the theme files. The colors that show how tests did (the tree's status dots, failed and skipped
text, a failed run's progress bar) stay Carbon's.
- Four of RAD Studio's dark VCL styles as built-in dark themes in both GUI runners, beside Carbon:
Charcoal Dark Slate, Cobalt XEMedia, Onyx Blue and Tablet Dark. The VCL GUI runner's project
links them in, and a VCL GUI project of your own lists the ones it links; the Win32 GUI runner
paints their colors. The Win32 GUI runner's theme files can also set `ButtonText`,
`ButtonHotText` and `SelectionText`, new roles for a button's text and the tree's selected text.
- Themes in both GUI runners, chosen in **View > Theme**: **Use Windows Setting** (the default)
follows Windows' app mode setting, switching as soon as it changes, and **Light** and **Dark**
override it. **View > Theme > Dark Theme** chooses the dark look's colors: one of five of RAD
Studio's dark VCL styles (Carbon, the default, Charcoal Dark Slate, Cobalt XEMedia, Onyx Blue and
Tablet Dark), in the Win32 GUI runner also one of four tints of Carbon (Ember, Forest, Midnight
and Plum), or a theme file of your own in `%APPDATA%\ASWUnitTests\Themes`, shared by every test
app, which **Open Themes Folder** opens. The Win32 GUI runner's theme files are INI files that set
any of its colors by role, and **Save Theme Template...** saves Carbon's as one to start from; the
VCL GUI runner's are VCL style files (`.vsf`). The choice applies without a restart and is saved
in the layout file, `--layout-ignore` and `--layout-reset` cover it as they do the layout, and a
theme file's problems are reported in the log. The Win32 GUI runner paints the themes itself, so
it needs nothing more. The VCL GUI runner uses the VCL styles, so a project of your own that runs
its tests in it needs them among its custom styles (Project > Options > Application >
Appearance), Carbon at least, without which Dark shows the light look, and a `WinMain()` that
applies the saved theme (see Changed). The README's "GUI Runners" section has the details.
- An ASWUnitTests icon, `resource\ASWUnitTests.ico`, which this repository's console and GUI
runners now have on Windows, with the PNGs it's made from and `resource\make_icon.ps1`, which
draws them. `ASWUNITTESTS_WIN32_GUI_SOURCES` includes `resource\ASWUnitTests_Icon.rc`, so a Win32
GUI runner of your own built with CMake gets the icon too, in Explorer, its title bar and the
taskbar; to use your own, remove that script from the list (the README's "Win32 GUI Runner" shows
how) and name your icon `MAINICON`. `ASWUNITTESTS_RESOURCE_DIR` is the `resource` folder, which
`ASWUNITTESTS_WIN32_GUI_INCLUDE_DIRS` now includes.
- A `TCLIParser::ParseArguments()` overload that takes the arguments as a
`std::vector<std::string>`, the program name first, as in `argv`.
- `UTF8ToWide()` in `ASWUnitTests_Utils.h`, which converts UTF-8 to wide text (UTF-16 on Windows,
UTF-32 on Linux), and, on Windows, `CommandLineArguments()` and `SystemErrorText()`: a command
line split into UTF-8 arguments, and a `GetLastError()` code's description.
- `TConsoleUTF8Output` (`ASWUnitTests_Console.h`), which sets the Windows console's output code page
to UTF-8 while it exists and then restores it. The console runner uses it for the whole run.
runners have on Windows, with the PNGs it's made from and `resource\make_icon.ps1`, which draws
them. `ASWUNITTESTS_WIN32_GUI_SOURCES` includes `resource\ASWUnitTests_Icon.rc`, so a Win32 GUI
runner of your own built with CMake gets the icon too, in Explorer, its title bar and the taskbar;
to use your own, remove that script from the list (the README's "Win32 GUI Runner" shows how) and
name your icon `MAINICON`. `ASWUNITTESTS_RESOURCE_DIR` is the `resource` folder, which
`ASWUNITTESTS_WIN32_GUI_INCLUDE_DIRS` includes.
- `ASWUNITTESTS_CORE_SOURCES` in `src\ASWUnitTests_Sources.cmake`: the framework's sources without
`main.cpp`, for a runner with its own entry point (`ASWUNITTESTS_SOURCES` lists the same files as
before), and `gui\src\ASWUnitTests_GUI_Sources.cmake`, which lists the GUI runners' shared units
as `ASWUNITTESTS_GUI_SOURCES`.
- The string checks (`Equals`, `Contains`, `StartsWith`, `EndsWith` and `Matches`, with their `Not`
and `IC` forms) take two texts of different types: a `std::string` with a C string, and narrow
text with wide text, which didn't compile before. Two narrow or two wide texts are compared as
Expand Down Expand Up @@ -92,24 +74,37 @@ versioned baseline.
Expecting a message substring from a type with no message (neither a `std::exception` nor an RTL
exception) fails, naming the type that was caught, e.g. `an object of type "int"`. A class also
matches a `std::exception` subclass derived from it, whose `what()` is then checked.
- A `TCLIParser::ParseArguments()` overload that takes the arguments as a
`std::vector<std::string>`, the program name first, as in `argv`.
- `UTF8ToWide()` in `ASWUnitTests_Utils.h`, which converts UTF-8 to wide text (UTF-16 on Windows,
UTF-32 on Linux), and, on Windows, `CommandLineArguments()` and `SystemErrorText()`: a command
line split into UTF-8 arguments, and a `GetLastError()` code's description.
- `TConsoleUTF8Output` (`ASWUnitTests_Console.h`), which sets the Windows console's output code page
to UTF-8 while it exists and then restores it. The console runner uses it for the whole run.
- `TTestHandler::GetAppBitsStr()`, which returns `"64-bit"` or `"32-bit"`, and
`TTestHandler::GetBuildOS()`, which returns `"Windows"` or `"Linux"` (`"Unknown"` for any other
operating system), describing the build the framework was compiled for.

### Changed

- The first line of the banner `TTestHandler::Initialize()` logs now also shows the app bits and
build OS, e.g. `ASWUnitTests - Version 1.5.0 - 64-bit - Windows`.
- The VCL GUI runner's units that don't need the VCL moved from `vcl\gui\src` to a new `gui\src`
folder, so other GUI runners can share them: `ASWUnitTests_GUI_CommandLine`,
folder, shared with the Win32 GUI runner: `ASWUnitTests_GUI_CommandLine`,
`ASWUnitTests_GUI_Layout`, `ASWUnitTests_GUI_RunObserver`, `ASWUnitTests_GUI_Selection`,
`ASWUnitTests_GUI_Shuffle` and `ASWUnitTests_GUI_TestList`, plus the new
`ASWUnitTests_GUI_Commands`, `ASWUnitTests_GUI_INIDocument`, `ASWUnitTests_GUI_Tree` and
`ASWUnitTests_GUI_View`. A project that builds the VCL GUI must compile them from `gui\src` and add
that folder to its include path.
Their VCL-only parts moved to the new `vcl\gui\src\ASWUnitTests_GUI_VCLSystem.h`, which the
project must also compile: `GUILayoutFilePath()`, `GUISelectionFilePath()`, and
`ASWUnitTests_GUI_Shuffle` and `ASWUnitTests_GUI_TestList`, beside the new
`ASWUnitTests_GUI_Commands`, `ASWUnitTests_GUI_INIDocument`, `ASWUnitTests_GUI_Theme`,
`ASWUnitTests_GUI_Tree` and `ASWUnitTests_GUI_View`. A project that builds the VCL GUI runner
must compile them from `gui\src` and add that folder to its include path. Their VCL-only parts
moved to the new `vcl\gui\src\ASWUnitTests_GUI_VCLSystem.cpp`, which the project must also
compile: `GUILayoutFilePath()`, `GUISelectionFilePath()`, and
`TGUICommandLine::ProcessArguments()`, now the free function `ProcessArguments()`. A `WinMain()`
modeled on `ASWUnitTests_VCL_GUI.cpp` must include that header and call
`ASWUnitTests::ProcessArguments()` instead. The layout functions now take a `TGUIINIDocument`
instead of a `TCustomIniFile`, and a `TGUIRect` instead of a `TRect`.
modeled on `vcl\gui\rad370\ASWUnitTests_VCL_GUI.cpp` must follow the new one: it includes
`ASWUnitTests_GUI_Theme.h` and `ASWUnitTests_GUI_VCLSystem.h`, calls
`ASWUnitTests::ProcessArguments()`, applies the saved theme before creating the main form, and
passes the theme to the form's `Start()`, which now takes it as well as the options. The layout
functions now take a `TGUIINIDocument` instead of a `TCustomIniFile`, and a `TGUIRect` instead of
a `TRect`.
- The VCL GUI runner reads and writes its layout file (`%APPDATA%\ASWUnitTests\<exe name>.ini`)
itself, the same way `TMemIniFile` did, so files saved by earlier versions load as before and are
written the same way. A size or position written in hexadecimal by hand is now ignored, as an
Expand Down Expand Up @@ -680,7 +675,8 @@ Initial versioned release, switching the project to semantic versioning and addi
(test group registration, `Check`/`Assert` methods, RAD Studio and CMake build support, etc.) is
treated as the baseline and is not itemized commit-by-commit.

[Unreleased]: https://github.com/ASWSoftware/asw-unit-tests/compare/v1.4.0...HEAD
[Unreleased]: https://github.com/ASWSoftware/asw-unit-tests/compare/v1.5.0...HEAD
[1.5.0]: https://github.com/ASWSoftware/asw-unit-tests/compare/v1.4.0...v1.5.0
[1.4.0]: https://github.com/ASWSoftware/asw-unit-tests/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/ASWSoftware/asw-unit-tests/compare/v1.2.1...v1.3.0
[1.2.1]: https://github.com/ASWSoftware/asw-unit-tests/compare/v1.2.0...v1.2.1
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ framework, and contributions are expected to keep it that way.
5. Check compiler warnings and errors; a change should not introduce new ones.
6. If you touched platform-specific code (`#if defined(_WIN32)` or similar), validate both the
Windows and the portable path if you can.
7. If you touched the RTL support (`ASWUNITTESTS_RTL_EXCEPTIONS`), the GUI runners (`gui/src/`,
`vcl/gui/src/`, `win32/gui/src/`) or framework code they use, also build and run the projects
[AGENTS.md](AGENTS.md#building-and-testing) lists for them: the VCL console and VCL GUI projects,
the CMake `ASWUnitTests_Win32_GUI` target and the Win32 GUI's RAD Studio project. Check the
affected GUI behavior by hand.

## Formatting

Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ it currently builds the test executable directly rather than packaging or instal

## Versions

ASWUnitTests follows [Semantic Versioning](https://semver.org), shown by `--version` and the VCL
GUI's caption. Releases are tagged on `main` (e.g. `v1.1.0`). Between releases, the `develop` branch
carries the next planned version with a pre-release, e.g. `1.2.0-dev.1`, which comes before `1.2.0`.
ASWUnitTests follows [Semantic Versioning](https://semver.org), shown by `--version` and the GUI
runners' caption. Releases are tagged on `main` (e.g. `v1.1.0`). Between releases, the `develop`
branch carries the next planned version with a pre-release, e.g. `1.2.0-dev.1`, which comes before
`1.2.0`.
`src/ASWUnitTests_Version.h` has the version as macros, for code that supports several ASWUnitTests
versions, and as constants in the `ASWUnitTests` namespace:

Expand Down Expand Up @@ -502,9 +503,8 @@ applies the saved theme and starts the main form. For the dark theme, also add R
style to the application (Project > Options > Application > Appearance, which this repository's
project has as `Custom_Styles`); without it, Dark shows the light look. The other built-in dark
themes (Charcoal Dark Slate, Cobalt XEMedia, Onyx Blue and Tablet Dark) are listed only if their
styles are added too. For the ASWUnitTests icon,
set the application's icon to `resource\ASWUnitTests.ico` there too, as this repository's project
does.
styles are added too. For the ASWUnitTests icon, set the application's icon to
`resource\ASWUnitTests.ico` there too, as this repository's project does.

### Win32 GUI Runner

Expand Down Expand Up @@ -1376,8 +1376,9 @@ find_package(Threads REQUIRED)
target_link_libraries(MyTests PRIVATE Threads::Threads)
```

For a GUI target, `win32\gui\src\ASWUnitTests_Win32GUI_Sources.cmake` does the same for the
[Win32 GUI runner](#win32-gui-runner); see that section.
`ASWUNITTESTS_CORE_SOURCES` lists the same files without `main.cpp`, for a runner with an entry
point of its own. For a GUI target, `win32\gui\src\ASWUnitTests_Win32GUI_Sources.cmake` does the
same for the [Win32 GUI runner](#win32-gui-runner); see that section.

### RAD Studio / Visual Studio / other IDE projects

Expand Down
4 changes: 2 additions & 2 deletions src/ASWUnitTests_Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ limitations under the License.
#define ASWUNITTESTS_VERSION_MAJOR 1
#define ASWUNITTESTS_VERSION_MINOR 5
#define ASWUNITTESTS_VERSION_PATCH 0
#define ASWUNITTESTS_VERSION_PRERELEASE "dev.8"
#define ASWUNITTESTS_VERSION_STRING "1.5.0-dev.8"
#define ASWUNITTESTS_VERSION_PRERELEASE ""
#define ASWUNITTESTS_VERSION_STRING "1.5.0"

namespace ASWUnitTests
{
Expand Down
Loading