From 2252a31f97e9a287d155814a297d552465708e96 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 9 Mar 2023 01:01:21 +0100 Subject: [PATCH] Add extra rocket test --- .../rasaero/importt/Complex.Two-Stage.CDX1 | 289 ++++++++++++++++++ .../rasaero/importt/RASAeroLoaderTest.java | 28 +- 2 files changed, 316 insertions(+), 1 deletion(-) create mode 100644 core/test/net/sf/openrocket/file/rasaero/importt/Complex.Two-Stage.CDX1 diff --git a/core/test/net/sf/openrocket/file/rasaero/importt/Complex.Two-Stage.CDX1 b/core/test/net/sf/openrocket/file/rasaero/importt/Complex.Two-Stage.CDX1 new file mode 100644 index 000000000..4270cce29 --- /dev/null +++ b/core/test/net/sf/openrocket/file/rasaero/importt/Complex.Two-Stage.CDX1 @@ -0,0 +1,289 @@ + + 2 + + + NoseCone + 12 + 3 + Tangent Ogive + 0.25 + 0 + Black + + + BodyTube + 6 + 3 + 0 + 0 + 0 + 0 + 0 + 12 + Black + 0 + 0 + 0 + 0 + + 3 + 1 + 1 + 1 + 0 + 0.1 + 0 + 1 + Square + 0 + 0 + + + + Transition + 0.25 + 2.5 + 18 + 2.5 + Black + + + BodyTube + 0.5 + 2.5 + 0 + 0 + 0 + 0 + 0 + 18.25 + Black + 0 + 0 + 0 + 0 + + 6 + 0.25 + 2 + 2 + 0.125 + 0.1 + 0 + 0.25 + Square + 0 + 0 + + + + Transition + 0.25 + 3 + 18.75 + 3 + Black + + + BodyTube + 36 + 3 + 0 + 0 + 0 + 0 + 0 + 19 + Black + 0 + 0 + 0 + 0 + + 6 + 1 + 1 + 1 + 0 + 0.1 + 0 + 36 + Square + 0 + 0 + + + 0 + 0.25 + 30 + 0.25 + 0 + 0 + + + + FinCan + 6 + 3.25 + 3 + 0 + 0 + 0.5 + 0.375 + 0 + 55 + 0.25 + -6 + Black + + 5 + 6 + 4 + 3 + 2 + 0.1 + 0 + 6 + Square + 0 + 0 + + + + BoatTail + 3 + 3.25 + 2.75 + 55 + Black + + 4 + 2 + 1 + 1.3125 + 0 + 0.1 + 0 + 2.5 + Square + 0 + 0 + + + + Booster + 7.5 + 6 + 3.25 + 0 + 0 + 0 + 0 + 0 + 55 + 2 + Black + 0 + 0.5 + 6.5 + + 3 + 4 + 3 + 3 + 1 + 0.1 + 0 + 4.5 + Square + 0 + 0 + + + Smooth Paint + 0 + False + False + 0 + 0 + 0 + False + False + + + + 3750 + 0 + 7.64 + 12 + 80 + 0 + + + 1000 + 600 + Parachute + Parachute + True + True + 12 + 24 + Apogee + Altitude + 0.8 + 0.8 + + + + + J90W (AT) + 4.06 + 0 + 35.96 + 0 + I170G (AT) + 5.64 + 2 + 0 + 43.06 + 0 + True + 0 + 0 + 0 + 0 + False + 0 + 16.75019 + 4351.988 + 577.8134 + 0 + 0 + + + J180T (AT) + 3.97 + 0 + 35.72 + 0 + I215R (AT) + 5.54 + 2 + 0 + 42.95 + 0 + True + 0 + 0 + 0 + 0 + False + 0 + 15.07016 + 4358.963 + 717.1073 + 0 + 0 + + + \ No newline at end of file diff --git a/core/test/net/sf/openrocket/file/rasaero/importt/RASAeroLoaderTest.java b/core/test/net/sf/openrocket/file/rasaero/importt/RASAeroLoaderTest.java index b88aaace0..2a4a7e34f 100644 --- a/core/test/net/sf/openrocket/file/rasaero/importt/RASAeroLoaderTest.java +++ b/core/test/net/sf/openrocket/file/rasaero/importt/RASAeroLoaderTest.java @@ -153,7 +153,7 @@ public class RASAeroLoaderTest extends BaseTestCase { } /** - * Test whether we can load a very complex rocket with practically all RASAero features. + * Test whether we can load a very complex, unrealistic rocket with practically all RASAero features. */ @Test public void testShowRocket() { @@ -175,4 +175,30 @@ public class RASAeroLoaderTest extends BaseTestCase { } assertEquals(5, loader.getWarnings().size()); } + + /** + * Test a complex two-stage rocket with practically all RASAero features. + */ + @Test + public void testComplexTwoStageRocket() { + RASAeroLoader loader = new RASAeroLoader(); + InputStream stream = this.getClass().getResourceAsStream("Complex.Two-Stage.CDX1"); + assertNotNull("Could not open Complex.Two-Stage.CDX1", stream); + try { + OpenRocketDocument doc = OpenRocketDocumentFactory.createEmptyRocket(); + DocumentLoadingContext context = new DocumentLoadingContext(); + context.setOpenRocketDocument(doc); + context.setMotorFinder(new DatabaseMotorFinder()); + loader.loadFromStream(context, new BufferedInputStream(stream), null); + Rocket rocket = doc.getRocket(); + assertNotNull(rocket); + + // TODO: fetch components and test their parameters + } catch (IllegalStateException ise) { + fail(ise.getMessage()); + } catch (RocketLoadException | IOException e) { + throw new RuntimeException(e); + } + assertEquals(5, loader.getWarnings().size()); + } }