diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c029aa7..f4d26d7b 100755 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,6 +36,22 @@ jobs: ls -al . sudo apt install gnupg1 + - name: start xvfb + run: + Xvfb :0 & + + - name: initialize the X11 DISPLAY variable + run: + export DISPLAY=:0 + + - name: Install libraries + run: | + sudo apt update + sudo apt install libgtk2.0-0 + + - name: Test with Gradle + run: xvfb-run -s '-screen 0 1024x768x24' ./gradlew test + - name: Publish package run: bash publish.sh env: diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index 1d74a14b..aa0dcb5a 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -1257,7 +1257,7 @@ public CSG difference(CSG csg) { * @return the csg */ private CSG _differenceCSGBoundsOpt(CSG csg) { - CSG a1 = this._differenceNoOpt(csg.getBounds().toCSG()); + CSG a1 = this._differenceNoOpt(csg.getBounds().toCSG().setColor(csg.getColor())); CSG a2 = this.intersect(csg.getBounds().toCSG()); CSG result = a2._differenceNoOpt(csg)._unionIntersectOpt(a1).optimization(getOptType()); if (getName().length() != 0 && csg.getName().length() != 0) { diff --git a/src/test/java/eu/mihosoft/vrl/v3d/CSGTest.java b/src/test/java/eu/mihosoft/vrl/v3d/CSGTest.java index b6a829aa..c3f17eba 100644 --- a/src/test/java/eu/mihosoft/vrl/v3d/CSGTest.java +++ b/src/test/java/eu/mihosoft/vrl/v3d/CSGTest.java @@ -29,7 +29,7 @@ public void setColor_OnUnionCSGShouldRetainColorsOnPolygons() { .transformed(new Transform().translate(10, 0, 0)); CSG union = cube1.union(cube2); - assertEquals(CSG.getDefaultColor(), union.getColor()); + assertEquals("Expected the new object to get the color from the unioned object", Color.RED, union.getColor()); union.getPolygons().forEach(polygon -> { boolean isLeftCube = polygon.getPoints().stream().allMatch(p -> p.x <= 5); @@ -51,7 +51,7 @@ public void setColor_OnUnionedAndTriangulatedCSGShouldRetainColorsOnPolygons() { .transformed(new Transform().translate(10, 0, 0)); CSG union = cube1.union(cube2).triangulate(); - assertEquals(CSG.getDefaultColor(), union.getColor()); + assertEquals("Expected the new object to get the color from the unioned object", Color.RED, union.getColor()); union.getPolygons().forEach(polygon -> { boolean isLeftCube = polygon.getPoints().stream().allMatch(p -> p.x <= 5); @@ -86,7 +86,7 @@ public void setColor_OnUnionedCSGShouldChangeColorsOfAllPolygons() { .transformed(new Transform().translate(10, 0, 0)); CSG union = cube1.union(cube2); - assertEquals("Expected the new object to get the default color", CSG.getDefaultColor(), union.getColor()); + assertEquals("Expected the new object to get the color from the unioned object", Color.RED, union.getColor()); union.setColor(Color.BLUE); union.getPolygons().forEach(polygon -> {