From 4cf6b98f0341be0e5a2faad256b4b29c5bcdc835 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 28 Jun 2022 01:14:23 +0200 Subject: [PATCH] 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 --- swing/test/net/sf/openrocket/IntegrationTest.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/swing/test/net/sf/openrocket/IntegrationTest.java b/swing/test/net/sf/openrocket/IntegrationTest.java index 24cb6178e..e0a280f09 100644 --- a/swing/test/net/sf/openrocket/IntegrationTest.java +++ b/swing/test/net/sf/openrocket/IntegrationTest.java @@ -71,7 +71,7 @@ public class IntegrationTest { private Action undoAction, redoAction; private AerodynamicCalculator aeroCalc = new BarrowmanCalculator(); - private FlightConfiguration config; + private FlightConfigurationId fcid; private FlightConditions conditions; private String massComponentID = null; @@ -112,14 +112,12 @@ public class IntegrationTest { undoAction = UndoRedoAction.newUndoAction(document); redoAction = UndoRedoAction.newRedoAction(document); - FlightConfigurationId fcid = document.getSimulation(0).getFlightConfigurationId(); - config = document.getRocket().getFlightConfiguration(fcid); + fcid = document.getSimulation(0).getFlightConfigurationId(); + FlightConfiguration config = document.getRocket().getFlightConfiguration(fcid); conditions = new FlightConditions(config); // Test undo state checkUndoState(null, null); - - InnerTube mmt = (InnerTube)config.getRocket().getChild(0).getChild(1).getChild(2); // Compute cg+cp + altitude // double cgx, double mass, double cpx, double cna) @@ -330,6 +328,7 @@ public class IntegrationTest { } private void checkCgCp(double cgx, double mass, double cpx, double cna) { + FlightConfiguration config = document.getRocket().getFlightConfiguration(fcid); final RigidBody launchData = MassCalculator.calculateLaunch(config); final Coordinate cg = launchData.getCenterOfMass(); assertEquals(cgx, cg.x, 0.001);