-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from mcgivrer/feature/add-test-on-materials
Feat(Material): Add Test on Material
- Loading branch information
Showing
5 changed files
with
123 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package features; | ||
|
||
import fr.snapgames.fromclasstogame.core.physic.Material; | ||
import io.cucumber.java.en.And; | ||
import io.cucumber.java.en.Given; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class MaterialStepdefs { | ||
Material mat; | ||
|
||
@Given("A Material of type {string}") | ||
public void aMaterialOfType(String materialTypeName) { | ||
mat = Material.DefaultMaterial.valueOf(materialTypeName).getMaterial(); | ||
} | ||
|
||
@And("the Material has a bounciness of {double}") | ||
public void theMaterialHasABouncinessOf(Double bouncinessValue) { | ||
assertEquals("Bounciness for material has not the right value", bouncinessValue, mat.bounciness, 0.0); | ||
} | ||
|
||
@And("the Material has a density of {double}") | ||
public void theMaterialHasADensityOf(Double densityValue) { | ||
assertEquals("Density for material has not the right value", densityValue, mat.density, 0.0); | ||
} | ||
|
||
@And("the Material has a dynamic friction of {double}") | ||
public void theMaterialHasADynFrictionOf(Double dynFrictionValue) { | ||
assertEquals("Dynamic Friction for material has not the right value", dynFrictionValue, mat.dynFriction, 0.0); | ||
} | ||
|
||
@And("the Material has a static friction of {double}") | ||
public void theMaterialHasAStaticFrictionOf(Double staFrictionValue) { | ||
assertEquals("Static Friction for material has not the right value", staFrictionValue, mat.staticFriction, 0.0); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
src/test/resources/features/GameObject_can_have_Material.feature
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,75 @@ | ||
Feature: Any GamesObject can have some material assigned | ||
|
||
In the Game process to animate GameObject, PhysicEngine needs physic data. Those data are coming from the | ||
Material Object. Any GameObject can have an assigned Material. | ||
|
||
Scenario: 01 - The Entity has material | ||
Given the Game is instantiated | ||
And the Game is running | ||
And I activate the scene "test1" | ||
And I add a GameObject named "player" at (160.0,100.0) | ||
And I set Material "WOOD" to the GameObject "player" | ||
Then the GameObject "player" has Material "wood" | ||
|
||
Scenario: 02 - ROCK Material has some specific Physic values | ||
Given A Material of type "ROCK" | ||
Then the Material has a bounciness of 0.6 | ||
And the Material has a dynamic friction of 1 | ||
And the Material has a static friction of 1 | ||
And the Material has a density of 1 | ||
|
||
Scenario: 03 - WOOD Material has some specific Physic values | ||
Given A Material of type "WOOD" | ||
Then the Material has a bounciness of 0.1 | ||
And the Material has a dynamic friction of 0.69 | ||
And the Material has a static friction of 0.69 | ||
And the Material has a density of 0.3 | ||
|
||
Scenario: 04 - METAL Material has some specific Physic values | ||
Given A Material of type "METAL" | ||
Then the Material has a bounciness of 0.05 | ||
And the Material has a dynamic friction of 1 | ||
And the Material has a static friction of 1 | ||
And the Material has a density of 1.2 | ||
|
||
Scenario: 05 - RUBBER Material has some specific Physic values | ||
Given A Material of type "RUBBER" | ||
Then the Material has a bounciness of 0.8 | ||
And the Material has a dynamic friction of 0.88 | ||
And the Material has a static friction of 0.98 | ||
And the Material has a density of 0.3 | ||
|
||
Scenario: 06 - GLASS Material has some specific Physic values | ||
Given A Material of type "GLASS" | ||
Then the Material has a bounciness of 0.4 | ||
And the Material has a dynamic friction of 1 | ||
And the Material has a static friction of 1 | ||
And the Material has a density of 1 | ||
|
||
Scenario: 07 - ICE Material has some specific Physic values | ||
Given A Material of type "ICE" | ||
Then the Material has a bounciness of 0.1 | ||
And the Material has a dynamic friction of 0.1 | ||
And the Material has a static friction of 1 | ||
And the Material has a density of 1 | ||
|
||
Scenario: 08 - AIR Material has some specific Physic values | ||
Given A Material of type "AIR" | ||
Then the Material has a bounciness of 1 | ||
And the Material has a dynamic friction of 1 | ||
And the Material has a static friction of 1 | ||
And the Material has a density of 0.01 | ||
|
||
Scenario: 09 - STATIC Material has some specific Physic values | ||
Given A Material of type "STATIC" | ||
Then the Material has a bounciness of 0 | ||
And the Material has a dynamic friction of 0 | ||
And the Material has a static friction of 0 | ||
And the Material has a density of 0 | ||
|
||
Scenario: 10 - NEUTRAL Material has some specific Physic values | ||
Given A Material of type "NEUTRAL" | ||
Then the Material has a bounciness of 1 | ||
And the Material has a dynamic friction of 1 | ||
And the Material has a static friction of 1 | ||
And the Material has a density of 1 |
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