diff --git a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java index e62fc9146..f1eb9f66b 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java +++ b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java @@ -315,6 +315,7 @@ public class Rocket extends RocketComponent { // Rocket copy is cloned, so non-trivial members must be cloned as well: copy.stageMap = new HashMap(); copy.configSet = new FlightConfigurableParameterSet( this.configSet ); + copy.selectedConfiguration = copy.configSet.get( this.getSelectedConfiguration().getId()); copy.listenerList = new ArrayList(); return copy; diff --git a/core/test/net/sf/openrocket/rocketcomponent/RocketTest.java b/core/test/net/sf/openrocket/rocketcomponent/RocketTest.java index 8807e7a5b..352e1159f 100644 --- a/core/test/net/sf/openrocket/rocketcomponent/RocketTest.java +++ b/core/test/net/sf/openrocket/rocketcomponent/RocketTest.java @@ -17,23 +17,21 @@ public class RocketTest extends BaseTestCase { @Test public void testCopyIndependence() { Rocket rkt1 = TestRockets.makeEstesAlphaIII(); - FlightConfiguration config1 = rkt1.getSelectedConfiguration(); - FlightConfigurationId fcid1 = config1.getId(); + FlightConfiguration config1 = new FlightConfiguration(rkt1, null); + rkt1.setFlightConfiguration( config1.getId(), config1); + rkt1.setSelectedConfiguration( config1.getId()); FlightConfiguration config2 = new FlightConfiguration(rkt1, null); rkt1.setFlightConfiguration( config2.getId(), config2); - FlightConfiguration config3 = new FlightConfiguration(rkt1, null); - rkt1.setFlightConfiguration( config3.getId(), config3); - //System.err.println("src: "+ rkt1.toDebugConfigs()); // vvvv test target vvvv Rocket rkt2 = rkt1.copyWithOriginalID(); // ^^^^ test target ^^^^ - //System.err.println("cpy: "+ rkt1.toDebugConfigs()); FlightConfiguration config4 = rkt2.getSelectedConfiguration(); FlightConfigurationId fcid4 = config4.getId(); - assertThat("fcids should match: ", fcid1.key, equalTo(fcid4.key)); - assertThat("Configurations should be different match: "+config1.toDebug()+"=?="+config4.toDebug(), config1.instanceNumber, not( config4.instanceNumber)); + + assertThat("fcids should match: ", config1.getId().key, equalTo(fcid4.key)); + assertThat("Configurations should be different: "+config1.toDebug()+"=?="+config4.toDebug(), config1.instanceNumber, not( config4.instanceNumber)); FlightConfiguration config5 = rkt2.getFlightConfiguration(config2.getId()); FlightConfigurationId fcid5 = config5.getId();