mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-07-13 06:22:51 +03:00
Fix warning on macOS due to posix_spawn_file_actions_addchdir_np usage (we must use posix_spawn_file_actions_addchdir).
Try to run tests with borderless windows to see if macOS windows are created with the right size.
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
All build commands must be executed from the **root project directory**. Follow these steps to build the project:
|
||||
|
||||
## Step 1: Update Makefiles (Conditional)
|
||||
If you have **added, renamed, or deleted** any source files, you must regenerate the makefiles before compiling.
|
||||
## Step 1: Regenerate Project Files
|
||||
Always regenerate the project files before compiling or running tests after making changes. Do this even for edits to existing files, because the checked-in makefiles can be stale and may reference removed files or miss recently added targets.
|
||||
|
||||
* **Tool:** Use `premake4` if installed; otherwise, fallback to `premake5` (the parameters are identical).
|
||||
* **Linker Flag (`--with-mold-linker`):** This flag is conditional. If the `mold` linker is installed on the system, you **must** include it to speed up linking. If `mold` is not installed, omit the flag.
|
||||
@@ -14,8 +14,6 @@ If you have **added, renamed, or deleted** any source files, you must regenerate
|
||||
**Command (if `mold` is NOT installed):**
|
||||
`premake4 --disable-static-build --with-debug-symbols --address-sanitizer gmake`
|
||||
|
||||
*(If no files were added/removed, you may skip Step 1).*
|
||||
|
||||
## Step 1a: Format Changed Files
|
||||
After editing any C or C++ source file (`.c`, `.cpp`, `.h`, `.hpp`), you **must** run `clang-format` on all modified files to ensure consistent formatting with the project's style (defined in `.clang-format` at the repository root).
|
||||
|
||||
|
||||
@@ -1293,7 +1293,12 @@ int Sys::execute( const std::string& cmd, const std::string& workingDir ) {
|
||||
if ( posix_spawn_file_actions_init( &actions ) != 0 )
|
||||
return -1; // Failed to initialize
|
||||
|
||||
#if defined( __APPLE__ ) && defined( __MAC_OS_X_VERSION_MIN_REQUIRED__ ) && \
|
||||
__MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110000
|
||||
if ( posix_spawn_file_actions_addchdir( &actions, workingDir.c_str() ) != 0 ) {
|
||||
#else
|
||||
if ( posix_spawn_file_actions_addchdir_np( &actions, workingDir.c_str() ) != 0 ) {
|
||||
#endif
|
||||
posix_spawn_file_actions_destroy( &actions );
|
||||
return -1; // Failed to add chdir action
|
||||
}
|
||||
@@ -2250,13 +2255,13 @@ static bool _isOSUsingDarkColorScheme() {
|
||||
|
||||
return false; // Default to light
|
||||
#elif EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN
|
||||
// Executes JavaScript: window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
return EM_ASM_INT({
|
||||
if (typeof window !== 'undefined' && window.matchMedia) {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
}) != 0;
|
||||
// Executes JavaScript: window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
return EM_ASM_INT( {
|
||||
if ( typeof window != = 'undefined' && window.matchMedia ) {
|
||||
return window.matchMedia( '(prefers-color-scheme: dark)' ).matches ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
} ) != 0;
|
||||
#else
|
||||
return true; // Any other OS default to dark
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,8 @@ using namespace EE::System;
|
||||
using namespace EE::Graphics;
|
||||
using namespace EE::Window;
|
||||
|
||||
static constexpr Uint32 VisualTestWindowStyle = WindowStyle::Borderless;
|
||||
|
||||
static void compareImages( utest_state_s& utest_state, int* utest_result, EE::Window::Window* win,
|
||||
const std::string& imageName,
|
||||
const std::string& imagesFolder = "fontrendering",
|
||||
|
||||
@@ -69,8 +69,8 @@ UTEST( FontRendering, fontsTest ) {
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 1024, 650, "eepp - Fonts", WindowStyle::Default, WindowBackend::Default, 32,
|
||||
{}, 1, false, true ) );
|
||||
WindowSettings( 1024, 650, "eepp - Fonts", VisualTestWindowStyle, WindowBackend::Default,
|
||||
32, {}, 1, false, true ) );
|
||||
|
||||
ASSERT_TRUE_MSG( win->isOpen(), "Failed to create Window" );
|
||||
|
||||
@@ -322,7 +322,7 @@ UTEST( FontRendering, loadFontFaceDataURI ) {
|
||||
UTEST( FontRendering, editorTest ) {
|
||||
const auto runTest = [&]() {
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - CodeEditor", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - CodeEditor", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1 ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -354,7 +354,7 @@ UTEST( FontRendering, editorTest ) {
|
||||
UTEST( FontRendering, textEditTest ) {
|
||||
const auto runTest = [&]() {
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1 ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -386,7 +386,7 @@ UTEST( FontRendering, textEditTest ) {
|
||||
UTEST( FontRendering, tabsTest ) {
|
||||
const auto runTest = [&]() {
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - Tabs Test", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - Tabs Test", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1 ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -419,7 +419,7 @@ UTEST( FontRendering, tabsTest ) {
|
||||
UTEST( FontRendering, tabStopTest ) {
|
||||
const auto runTest = [&]() {
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - Tab Stop Test", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - Tab Stop Test", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1 ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -453,7 +453,7 @@ UTEST( FontRendering, tabStopTest ) {
|
||||
UTEST( FontRendering, tabsTextEditTest ) {
|
||||
const auto runTest = [&]() {
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit - Tabs Test", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit - Tabs Test", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1 ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -485,7 +485,7 @@ UTEST( FontRendering, tabsTextEditTest ) {
|
||||
UTEST( FontRendering, tabStopTextEditTest ) {
|
||||
const auto runTest = [&]() {
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit - Tab Stop Test", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit - Tab Stop Test", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1 ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -517,7 +517,7 @@ UTEST( FontRendering, tabStopTextEditTest ) {
|
||||
|
||||
UTEST( FontRendering, textViewTest ) {
|
||||
const auto runTest = [&]() {
|
||||
UIApplication app( WindowSettings( 1024, 650, "eepp - TextView", WindowStyle::Default,
|
||||
UIApplication app( WindowSettings( 1024, 650, "eepp - TextView", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings(
|
||||
Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1.5f ) );
|
||||
@@ -552,7 +552,7 @@ UTEST( FontRendering, textViewTest ) {
|
||||
UTEST( FontRendering, textEditBengaliTest ) {
|
||||
BoolScopedOp op( Text::TextShaperEnabled, true );
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit Bengali", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit Bengali", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1.5f ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -572,7 +572,7 @@ UTEST( FontRendering, textEditBengaliTest ) {
|
||||
UTEST( FontRendering, textEditArabicTest ) {
|
||||
BoolScopedOp op( Text::TextShaperEnabled, true );
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit Arabic", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit Arabic", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1.5f ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -592,7 +592,7 @@ UTEST( FontRendering, textEditArabicTest ) {
|
||||
UTEST( FontRendering, textEditHebrewTest ) {
|
||||
BoolScopedOp op( Text::TextShaperEnabled, true );
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit Hebrew", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - TextEdit Hebrew", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1.5f ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -918,7 +918,7 @@ UTEST( FontRendering, textSetFillColor ) {
|
||||
UTEST( FontRendering, UITextTest ) {
|
||||
const auto runTest = [&]() {
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - UI Text Test", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - UI Text Test", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1 ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -1162,7 +1162,7 @@ UTEST( FontRendering, TextHardWrap ) {
|
||||
|
||||
const auto runTest = [&]() {
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - Text Hard Wrap", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - Text Hard Wrap", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1 ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -1205,7 +1205,7 @@ UTEST( FontRendering, TextHardWrap ) {
|
||||
UTEST( FontRendering, UITextViewWrappedSelection ) {
|
||||
const auto runTest = [&]() {
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - TextView Wrapped Selection", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - TextView Wrapped Selection", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(),
|
||||
1.5f ) );
|
||||
@@ -1245,7 +1245,7 @@ UTEST( FontRendering, UITextViewWrappedSelection ) {
|
||||
UTEST( FontRendering, UITextViewWrappedSelection2 ) {
|
||||
const auto runTest = [&]() {
|
||||
UIApplication app(
|
||||
WindowSettings( 1024, 650, "eepp - TextView Wrapped Selection", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "eepp - TextView Wrapped Selection", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(),
|
||||
1.5f ) );
|
||||
|
||||
@@ -831,7 +831,7 @@ UTEST( RichText, RichTextTest ) {
|
||||
|
||||
const auto& runTest = [&createRichText, &utest_result]() {
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 1024, 650, "RichText Example", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "RichText Example", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, "", 1, EE_SCREEN_KEYBOARD_ENABLED, true ) );
|
||||
|
||||
if ( !win->isOpen() )
|
||||
|
||||
@@ -101,8 +101,8 @@ static String uiHtmlLineText( const RichText& richText, size_t lineIndex ) {
|
||||
|
||||
UTEST( UIHTMLTable, complexLayout ) {
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 1024, 653, "HTML Tables Test", WindowStyle::Default, WindowBackend::Default,
|
||||
32, {}, 1, false, true ),
|
||||
WindowSettings( 1024, 653, "HTML Tables Test", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
ContextSettings( false, 0, 0, GLv_default, true, false ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
|
||||
@@ -162,7 +162,7 @@ UTEST( UIHTMLTable, complexLayout ) {
|
||||
|
||||
UTEST( UIHTMLTable, complexLayout2 ) {
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 1024, 650, "HTML Tables Test 2", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "HTML Tables Test 2", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
ContextSettings( false, 0, 0, GLv_default, true, false ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -1241,7 +1241,7 @@ UTEST( UIHTML, InlineBlockVerticalAlignDoesNotInflateOwnTextLine ) {
|
||||
|
||||
UTEST( UIHTMLTable, complexLayout3 ) {
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 1024, 650, "HTML Tables Test 3", WindowStyle::Default,
|
||||
WindowSettings( 1024, 650, "HTML Tables Test 3", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
ContextSettings( false, 0, 0, GLv_default, true, false ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -2479,7 +2479,7 @@ UTEST( UIHTMLDetails, lobstersInlineBlockCachesWidth ) {
|
||||
|
||||
UTEST( UIBorder, renderingVariations ) {
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 1024, 653, "Border Rendering Test", WindowStyle::Default,
|
||||
WindowSettings( 1024, 653, "Border Rendering Test", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
ContextSettings( false, 0, 0, GLv_default, true, false ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -2513,7 +2513,7 @@ UTEST( UIBorder, renderingVariations ) {
|
||||
|
||||
UTEST( UIBorder, renderingVariations2 ) {
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 1024, 653, "Border Rendering Test 2", WindowStyle::Default,
|
||||
WindowSettings( 1024, 653, "Border Rendering Test 2", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
ContextSettings( false, 0, 0, GLv_default, true, false ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -3025,7 +3025,7 @@ UTEST( UIHTML, ContactFormLayout ) {
|
||||
|
||||
UTEST( UIBackground, imageAtlasPositioning ) {
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 1024, 653, "Background Atlas Test", WindowStyle::Default,
|
||||
WindowSettings( 1024, 653, "Background Atlas Test", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
ContextSettings( false, 0, 0, GLv_default, true, false ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -3140,7 +3140,7 @@ UTEST( UIBackground, inlineSpanColorRendersBehindBackgroundImage ) {
|
||||
|
||||
UTEST( UIBackground, imageAtlasPositioningPixelDensity2 ) {
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 1024, 653, "Background Atlas Test PD2", WindowStyle::Default,
|
||||
WindowSettings( 1024, 653, "Background Atlas Test PD2", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
ContextSettings( false, 0, 0, GLv_default, true, false ) );
|
||||
EE::Graphics::PixelDensity::setPixelDensity( 2.0f );
|
||||
@@ -3214,7 +3214,7 @@ UTEST( UIBackground, cssFileRelativeSpriteUrlAndNegativePosition ) {
|
||||
|
||||
UTEST( UIBackground, InlineBlockImageSpans ) {
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 1024, 653, "inline-block image spans", WindowStyle::Default,
|
||||
WindowSettings( 1024, 653, "inline-block image spans", VisualTestWindowStyle,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
ContextSettings( false, 0, 0, GLv_default, true, false ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
|
||||
5
src/thirdparty/subprocess/subprocess.h
vendored
5
src/thirdparty/subprocess/subprocess.h
vendored
@@ -1027,7 +1027,12 @@ int subprocess_create_ex(const char *const commandLine[], int options,
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
if (working_directory) {
|
||||
#if defined(__APPLE__) && defined(__MAC_OS_X_VERSION_MIN_REQUIRED__) && \
|
||||
__MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110000
|
||||
if (0 != posix_spawn_file_actions_addchdir(&actions, working_directory)) {
|
||||
#else
|
||||
if (0 != posix_spawn_file_actions_addchdir_np(&actions, working_directory)) {
|
||||
#endif
|
||||
posix_spawn_file_actions_destroy(&actions);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user