diff --git a/scripts/gui-session.sh b/scripts/gui-session.sh index 6957040b4d..f784195d4c 100755 --- a/scripts/gui-session.sh +++ b/scripts/gui-session.sh @@ -128,7 +128,7 @@ done # --- main window ---------------------------------------------------------------------------- main="$(xdotool search --name "Untitled" 2>/dev/null | head -1 || true)" if [ -n "$main" ]; then - xdotool windowmove "$main" 0 0 windowsize "$main" ${GEOM/x/ } 2>/dev/null || true + xdotool windowmove "$main" 0 0 windowsize "$main" "$screen_w" "$screen_h" 2>/dev/null || true xdotool windowactivate "$main" 2>/dev/null || true sleep 2 fi diff --git a/tests/libslic3r/test_sketchimport.cpp b/tests/libslic3r/test_sketchimport.cpp index 79c932c5b3..f94d52beb0 100644 --- a/tests/libslic3r/test_sketchimport.cpp +++ b/tests/libslic3r/test_sketchimport.cpp @@ -2,25 +2,31 @@ #include "libslic3r/SketchImport.hpp" #include "libslic3r/Utils.hpp" // resources_dir +#include "test_utils.hpp" // ScopedTemporaryFile #include #include using namespace Slic3r; +// A 10x10 mm filled square, on disk because nanosvg reads from a file. The path +// must come from the system temp dir: a hardcoded /tmp is not writable on +// Windows, where the stream fails silently and the parse then sees no file. +static void write_square_svg(const std::string& path) +{ + std::ofstream f(path); + f << "" + ""; + REQUIRE(f.good()); +} + TEST_CASE("svg_to_regions parses a filled path into a region", "[SketchImport]") { - // A 10x10 mm filled square. Written to a temp file because nanosvg reads - // from disk. - const std::string path = "/tmp/snaporca_test_square.svg"; - { - std::ofstream f(path); - f << "" - ""; - } + ScopedTemporaryFile square(".svg"); + write_square_svg(square.string()); - ImportRegions regs = svg_to_regions(path, 1.0); + ImportRegions regs = svg_to_regions(square.string(), 1.0); REQUIRE(regs.size() >= 1); // Outer contour present with at least a few vertices. REQUIRE(regs[0].size() >= 1); @@ -38,9 +44,13 @@ TEST_CASE("svg_to_regions parses a filled path into a region", "[SketchImport]") TEST_CASE("svg_to_regions rejects bad input gracefully", "[SketchImport]") { + ScopedTemporaryFile square(".svg"); + write_square_svg(square.string()); + ScopedTemporaryFile missing(".svg"); // name reserved, never written + REQUIRE(svg_to_regions("", 1.0).empty()); - REQUIRE(svg_to_regions("/tmp/snaporca_does_not_exist.svg", 1.0).empty()); - REQUIRE(svg_to_regions("/tmp/snaporca_test_square.svg", 0.0).empty()); // scale<=0 + REQUIRE(svg_to_regions(missing.string(), 1.0).empty()); + REQUIRE(svg_to_regions(square.string(), 0.0).empty()); // scale<=0 } TEST_CASE("transform_regions moves and scales independently", "[SketchImport]")