mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 07:25:37 -04:00
[goalc-test] Apply windows cmd color fix (lg::initialize is not called here) (#278)
This commit is contained in:
+20
-1
@@ -3,6 +3,9 @@
|
||||
#include "common/util/FileUtil.h"
|
||||
|
||||
#include <filesystem>
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
// Running subsets of tests, see:
|
||||
// -
|
||||
@@ -16,6 +19,22 @@
|
||||
// to make it easier to test a subset of tests
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
#ifdef _WIN32
|
||||
// Always enable VIRTUAL_TERMINAL_PROCESSING, this console mode allows the console (stdout) to
|
||||
// support ANSI colors in the outputted text, which are used by the logging tool.
|
||||
// This mode may not be enabled by default, and changing that involves modifying the registry,
|
||||
// so it seems like a better solution would be enabling it ourselves.
|
||||
|
||||
// Get handle to stdout
|
||||
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
// get current stdout mode
|
||||
DWORD modeStdOut;
|
||||
GetConsoleMode(hStdOut, &modeStdOut);
|
||||
// enable VIRTUAL_TERMINAL_PROCESSING. As a bitwise OR it will not do anything if it is
|
||||
// already set
|
||||
modeStdOut |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
SetConsoleMode(hStdOut, modeStdOut);
|
||||
#endif
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
// Re-init failed folder
|
||||
@@ -26,4 +45,4 @@ int main(int argc, char** argv) {
|
||||
std::filesystem::create_directory(failedFolder);
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user