Fix unit test
The unit test was actually a bit deceptive, always using the same flight configuration, even though it changes because of the undo action
This commit is contained in:
parent
4660cc9045
commit
4cf6b98f03
@ -71,7 +71,7 @@ public class IntegrationTest {
|
|||||||
private Action undoAction, redoAction;
|
private Action undoAction, redoAction;
|
||||||
|
|
||||||
private AerodynamicCalculator aeroCalc = new BarrowmanCalculator();
|
private AerodynamicCalculator aeroCalc = new BarrowmanCalculator();
|
||||||
private FlightConfiguration config;
|
private FlightConfigurationId fcid;
|
||||||
private FlightConditions conditions;
|
private FlightConditions conditions;
|
||||||
private String massComponentID = null;
|
private String massComponentID = null;
|
||||||
|
|
||||||
@ -112,15 +112,13 @@ public class IntegrationTest {
|
|||||||
|
|
||||||
undoAction = UndoRedoAction.newUndoAction(document);
|
undoAction = UndoRedoAction.newUndoAction(document);
|
||||||
redoAction = UndoRedoAction.newRedoAction(document);
|
redoAction = UndoRedoAction.newRedoAction(document);
|
||||||
FlightConfigurationId fcid = document.getSimulation(0).getFlightConfigurationId();
|
fcid = document.getSimulation(0).getFlightConfigurationId();
|
||||||
config = document.getRocket().getFlightConfiguration(fcid);
|
FlightConfiguration config = document.getRocket().getFlightConfiguration(fcid);
|
||||||
conditions = new FlightConditions(config);
|
conditions = new FlightConditions(config);
|
||||||
|
|
||||||
// Test undo state
|
// Test undo state
|
||||||
checkUndoState(null, null);
|
checkUndoState(null, null);
|
||||||
|
|
||||||
InnerTube mmt = (InnerTube)config.getRocket().getChild(0).getChild(1).getChild(2);
|
|
||||||
|
|
||||||
// Compute cg+cp + altitude
|
// Compute cg+cp + altitude
|
||||||
// double cgx, double mass, double cpx, double cna)
|
// double cgx, double mass, double cpx, double cna)
|
||||||
checkCgCp(0.248, 0.0645, 0.320, 12.0);
|
checkCgCp(0.248, 0.0645, 0.320, 12.0);
|
||||||
@ -330,6 +328,7 @@ public class IntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkCgCp(double cgx, double mass, double cpx, double cna) {
|
private void checkCgCp(double cgx, double mass, double cpx, double cna) {
|
||||||
|
FlightConfiguration config = document.getRocket().getFlightConfiguration(fcid);
|
||||||
final RigidBody launchData = MassCalculator.calculateLaunch(config);
|
final RigidBody launchData = MassCalculator.calculateLaunch(config);
|
||||||
final Coordinate cg = launchData.getCenterOfMass();
|
final Coordinate cg = launchData.getCenterOfMass();
|
||||||
assertEquals(cgx, cg.x, 0.001);
|
assertEquals(cgx, cg.x, 0.001);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user