diff --git a/scripts/build_debug.sh b/scripts/build_debug.sh index 97018eb1..a0690955 100755 --- a/scripts/build_debug.sh +++ b/scripts/build_debug.sh @@ -2,8 +2,8 @@ set -e BUILD_DIR=`dirname "$BASH_SOURCE"`/../build mkdir -p $BUILD_DIR/Debug -cd $BUILD_DIR/Debug +pushd $BUILD_DIR/Debug cmake -DCMAKE_BUILD_TYPE=Debug ../.. cmake --build . ctest --verbose -cd ../.. +popd diff --git a/scripts/build_debug_x64.bat b/scripts/build_debug_x64.bat index 675bd2ad..f80c2f3f 100644 --- a/scripts/build_debug_x64.bat +++ b/scripts/build_debug_x64.bat @@ -1,11 +1,11 @@ @echo off set BUILD_DIR=%~dp0%\..\build mkdir %BUILD_DIR%\Debug\x64 || goto :error -cd %BUILD_DIR%\Debug\x64 || goto :error +pushd %BUILD_DIR%\Debug\x64 || goto :error cmake ..\..\.. -A x64 || goto :error cmake --build . --config Debug || goto :error ctest --verbose || goto :error -cd ..\..\.. || goto :error +popd || goto :error goto :EOF diff --git a/scripts/build_debug_x86.bat b/scripts/build_debug_x86.bat index b6dcd6d4..ee051293 100644 --- a/scripts/build_debug_x86.bat +++ b/scripts/build_debug_x86.bat @@ -1,11 +1,11 @@ @echo off set BUILD_DIR=%~dp0%\..\build mkdir %BUILD_DIR%\Debug\x86 || goto :error -cd %BUILD_DIR%\Debug\x86 || goto :error +pushd %BUILD_DIR%\Debug\x86 || goto :error cmake ..\..\.. -A Win32 || goto :error cmake --build . --config Debug || goto :error ctest --verbose || goto :error -cd ..\..\.. || goto :error +popd || goto :error goto :EOF diff --git a/scripts/build_release.sh b/scripts/build_release.sh index 3a2c5c14..1377504f 100755 --- a/scripts/build_release.sh +++ b/scripts/build_release.sh @@ -2,8 +2,8 @@ set -e BUILD_DIR=`dirname "$BASH_SOURCE"`/../build mkdir -p $BUILD_DIR/Release -cd $BUILD_DIR/Release +pushd $BUILD_DIR/Release cmake -DCMAKE_BUILD_TYPE=Release ../.. cmake --build . ctest --verbose -cd ../.. +popd diff --git a/scripts/build_release_x64.bat b/scripts/build_release_x64.bat index 064e8671..65e251e2 100644 --- a/scripts/build_release_x64.bat +++ b/scripts/build_release_x64.bat @@ -1,11 +1,11 @@ @echo off set BUILD_DIR=%~dp0%\..\build mkdir %BUILD_DIR%\Release\x64 || goto :error -cd %BUILD_DIR%\Release\x64 || goto :error +pushd %BUILD_DIR%\Release\x64 || goto :error cmake ..\..\.. -A x64 || goto :error cmake --build . --config Release || goto :error ctest --verbose || goto :error -cd ..\..\.. || goto :error +popd || goto :error goto :EOF diff --git a/scripts/build_release_x86.bat b/scripts/build_release_x86.bat index 09aa042d..1be857bd 100644 --- a/scripts/build_release_x86.bat +++ b/scripts/build_release_x86.bat @@ -1,11 +1,11 @@ @echo off set BUILD_DIR=%~dp0%\..\build mkdir %BUILD_DIR%\Release\x86 || goto :error -cd %BUILD_DIR%\Release\x86 || goto :error +pushd %BUILD_DIR%\Release\x86 || goto :error cmake ..\..\.. -A Win32 || goto :error cmake --build . --config Release || goto :error ctest --verbose || goto :error -cd ..\..\.. || goto :error +popd || goto :error goto :EOF diff --git a/scripts/gen_msvc2017_project.bat b/scripts/gen_msvc2017_project.bat index c3bfba5c..5cfca003 100644 --- a/scripts/gen_msvc2017_project.bat +++ b/scripts/gen_msvc2017_project.bat @@ -1,9 +1,10 @@ @echo off set BUILD_DIR=%~dp0%\..\build mkdir %BUILD_DIR%\msvc2017 || goto :error -cd %BUILD_DIR%\msvc2017 || goto :error +pushd %BUILD_DIR%\msvc2017 || goto :error cmake -G "Visual Studio 15 2017" ..\.. || goto :error start enduro2d.sln || goto :error +popd || goto :error goto :EOF diff --git a/scripts/gen_msvc2019_project.bat b/scripts/gen_msvc2019_project.bat index 8991dea5..773d2cde 100644 --- a/scripts/gen_msvc2019_project.bat +++ b/scripts/gen_msvc2019_project.bat @@ -1,9 +1,10 @@ @echo off set BUILD_DIR=%~dp0%\..\build mkdir %BUILD_DIR%\msvc2019 || goto :error -cd %BUILD_DIR%\msvc2019 || goto :error +pushd %BUILD_DIR%\msvc2019 || goto :error cmake -G "Visual Studio 16 2019" ..\.. || goto :error start enduro2d.sln || goto :error +popd || goto :error goto :EOF diff --git a/scripts/gen_xcode_project.sh b/scripts/gen_xcode_project.sh index a3257808..f2a07694 100755 --- a/scripts/gen_xcode_project.sh +++ b/scripts/gen_xcode_project.sh @@ -2,6 +2,7 @@ set -e BUILD_DIR=`dirname "$BASH_SOURCE"`/../build mkdir -p $BUILD_DIR/xcode -cd $BUILD_DIR/xcode +pushd $BUILD_DIR/xcode cmake -G Xcode ../.. open enduro2d.xcodeproj +popd diff --git a/scripts/pvs_analyze.sh b/scripts/pvs_analyze.sh index f7b1381a..8a81ea76 100755 --- a/scripts/pvs_analyze.sh +++ b/scripts/pvs_analyze.sh @@ -2,7 +2,7 @@ set -e BUILD_DIR=`dirname "$BASH_SOURCE"`/../build mkdir -p $BUILD_DIR/pvs_analyze -cd $BUILD_DIR/pvs_analyze +pushd $BUILD_DIR/pvs_analyze rm -rf pvs_report cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=On ../.. pvs-studio-analyzer analyze\ @@ -15,3 +15,4 @@ pvs-studio-analyzer analyze\ -j8 plog-converter -a GA:1,2 -t fullhtml -o pvs_report pvs_report.log open pvs_report/index.html +popd diff --git a/scripts/upload_coverage.sh b/scripts/upload_coverage.sh index a0bd8fd7..96dd9e15 100755 --- a/scripts/upload_coverage.sh +++ b/scripts/upload_coverage.sh @@ -3,7 +3,7 @@ set -e BUILD_DIR=`dirname "$BASH_SOURCE"`/../build mkdir -p $BUILD_DIR/coverage -cd $BUILD_DIR/coverage +pushd $BUILD_DIR/coverage cmake -DCMAKE_BUILD_TYPE=Debug -DE2D_BUILD_WITH_COVERAGE=ON ../.. cmake --build . @@ -15,3 +15,4 @@ lcov -r "coverage.info" "*/usr/*" "*/Xcode.app/*" "*/untests/*" "*/samples/*" "* lcov -l "coverage.info" bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" +popd diff --git a/untests/bin/library/prefab.json b/untests/bin/library/prefab.json index 2c63c085..d7a13d21 100644 --- a/untests/bin/library/prefab.json +++ b/untests/bin/library/prefab.json @@ -1,2 +1,18 @@ { + "components" : { + "rect_collider" : { + "size" : [1,2], + "pivot" : [2,4] + }, + + "circle_collider" : { + "radius" : 5, + "pivot" : [4,2] + }, + + "polygon_collider" : { + "points" : [[1,2],[2,3],[3,4]], + "pivot" : [8,4] + } + } } diff --git a/untests/sources/untests_high/library.cpp b/untests/sources/untests_high/library.cpp index abf1c066..fd7814ec 100644 --- a/untests/sources/untests_high/library.cpp +++ b/untests/sources/untests_high/library.cpp @@ -246,6 +246,21 @@ TEST_CASE("library"){ { auto prefab_res = l.load_asset("prefab.json"); REQUIRE(prefab_res); + + ecs::registry w; + ecs::entity e = w.create_entity(prefab_res->content().prototype()); + + REQUIRE(e.exists_component()); + REQUIRE(e.get_component().size() == v2f(1.f,2.f)); + REQUIRE(e.get_component().pivot() == v2f(2.f,4.f)); + + REQUIRE(e.exists_component()); + REQUIRE(math::approximately(e.get_component().radius(), 5.f)); + REQUIRE(e.get_component().pivot() == v2f(4.f,2.f)); + + REQUIRE(e.exists_component()); + REQUIRE(e.get_component().points() == vector{{1,2},{2,3},{3,4}}); + REQUIRE(e.get_component().pivot() == v2f(8.f,4.f)); } } }