-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into refactor/rework-tr…
…ansaction-manager-rxjava # Conflicts: # engine/src/main/java/org/terasology/engine/persistence/internal/ReadWriteStorageManager.java
- Loading branch information
Showing
41 changed files
with
1,219 additions
and
670 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
build-logic/src/main/kotlin/org/terasology/gradology/file_operations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2022 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.terasology.gradology | ||
|
||
import org.gradle.api.internal.file.copy.CopySpecInternal | ||
import org.gradle.api.tasks.Copy | ||
|
||
|
||
/** | ||
* Copy, but never overwrite any existing file. | ||
* | ||
* Preserves existing files regardless of how up-to-date they are. | ||
* | ||
* Useful for providing boilerplate or defaults. | ||
*/ | ||
abstract class CopyButNeverOverwrite : Copy() { | ||
|
||
override fun createRootSpec(): CopySpecInternal { | ||
val copySpec = super.createRootSpec() | ||
copySpec.eachFile { | ||
if (this.relativePath.getFile(destinationDir).exists()) { | ||
this.exclude() | ||
} | ||
} | ||
return copySpec; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
engine-tests/src/test/java/org/terasology/engine/math/SideTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.terasology.engine.math; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class SideTest { | ||
|
||
@Test | ||
public void testSideInDirection() { | ||
for (Side side : Side.values()) { | ||
assertEquals(side, Side.inDirection(side.direction().x(), side.direction().y(), side.direction().z())); | ||
} | ||
} | ||
|
||
@Test | ||
public void testRelativeSides() { | ||
Side side = Side.FRONT; | ||
assertEquals(Side.LEFT, side.getRelativeSide(Direction.LEFT)); | ||
assertEquals(Side.RIGHT, side.getRelativeSide(Direction.RIGHT)); | ||
assertEquals(Side.TOP, side.getRelativeSide(Direction.UP)); | ||
assertEquals(Side.BOTTOM, side.getRelativeSide(Direction.DOWN)); | ||
assertEquals(Side.FRONT, side.getRelativeSide(Direction.FORWARD)); | ||
assertEquals(Side.BACK, side.getRelativeSide(Direction.BACKWARD)); | ||
} | ||
|
||
@Test | ||
public void testGetFlag() { | ||
Assertions.assertEquals(0x01, Side.TOP.getFlag()); | ||
Assertions.assertEquals(0x02, Side.LEFT.getFlag()); | ||
Assertions.assertEquals(0x04, Side.FRONT.getFlag()); | ||
Assertions.assertEquals(0x08, Side.BOTTOM.getFlag()); | ||
Assertions.assertEquals(0x10, Side.RIGHT.getFlag()); | ||
Assertions.assertEquals(0x20, Side.BACK.getFlag()); | ||
} | ||
|
||
@Test | ||
public void testToFlags() { | ||
Assertions.assertEquals(Side.TOP.getFlag() | Side.LEFT.getFlag(), Side.toFlags(Side.TOP, Side.LEFT)); | ||
Assertions.assertEquals(Side.TOP.getFlag() | Side.RIGHT.getFlag(), Side.toFlags(Side.TOP, Side.RIGHT)); | ||
Assertions.assertEquals(Side.TOP.getFlag(), Side.toFlags(Side.TOP, Side.TOP)); | ||
Assertions.assertEquals(Side.BACK.getFlag() | Side.BOTTOM.getFlag(), Side.toFlags(Side.BACK, Side.BOTTOM)); | ||
|
||
Assertions.assertEquals( | ||
Side.TOP.getFlag() | Side.LEFT.getFlag() | Side.FRONT.getFlag() | Side.BOTTOM.getFlag() | Side.RIGHT.getFlag() | Side.BACK.getFlag(), | ||
Side.toFlags(Side.TOP, Side.LEFT, Side.FRONT, Side.BOTTOM, Side.RIGHT, Side.BACK)); | ||
} | ||
} |
Oops, something went wrong.