diff --git a/web/test/cases/craftLoft.js b/web/test/cases/craftLoft.js index 361d082f..da77ae1e 100644 --- a/web/test/cases/craftLoft.js +++ b/web/test/cases/craftLoft.js @@ -12,7 +12,7 @@ export function testLoftOver2Sections(env, ui) { ui.wizardOK(); ui.selectFaces([0, 0, 290], [0, 0, 310]); sui = ui.openSketcher(); - sui.addRectangle([0, -100], [100, 100], [-100, 100]); + sui.addPolygon([0, -100], [100, 100], [-100, 100]); ui.commitSketch(); ui.openWizard('LOFT'); @@ -22,5 +22,57 @@ export function testLoftOver2Sections(env, ui) { env.done(); } +export function testLoftOver3Sections(env, ui) { + let sui = createPlaneAndOpenSketcher(ui); + sui.addRectangle(-100, -100, 100, 100); + ui.commitSketch(); + + ui.openWizard('PLANE'); + ui.wizardContext.updateParam('depth', 300); + ui.wizardOK(); + ui.selectFaces([0, 0, 290], [0, 0, 310]); + sui = ui.openSketcher(); + sui.addPolygon([0, -100], [100, 100], [-100, 100]); + ui.commitSketch(); + + + ui.openWizard('PLANE'); + ui.wizardContext.updateParam('depth', 600); + ui.wizardOK(); + ui.selectFaces([0, 0, 590], [0, 0, 610]); + sui = ui.openSketcher(); + sui.addPolygon([0, 100], [100, -100], [-100, -100]); + ui.commitSketch(); + + + ui.openWizard('LOFT'); + ui.select([-3, -3, 610], [-3, -3, 590]); + ui.select([-3, -3, 310], [-3, -3, 290]); + ui.select([-3, -3, -10], [-3, -3, 10]); + ui.wizardOK(); + env.done(); +} + + +export function testLoftCircleSections(env, ui) { + let sui = createPlaneAndOpenSketcher(ui); + sui.addRectangle(-100, -100, 100, 100); + ui.commitSketch(); + + ui.openWizard('PLANE'); + ui.wizardContext.updateParam('depth', 300); + ui.wizardOK(); + ui.selectFaces([0, 0, 290], [0, 0, 310]); + sui = ui.openSketcher(); + sui.addCircle(0, 0, 100); + ui.commitSketch(); + + ui.openWizard('LOFT'); + ui.select([-3, -3, 310], [-3, -3, 290]); + ui.select([-3, -3, -10], [-3, -3, 10]); + ui.wizardOK(); + env.done(); +} + diff --git a/web/test/utils/subjects/modeller/sketcherUISubject.js b/web/test/utils/subjects/modeller/sketcherUISubject.js index 2d0612a1..a3e67cf0 100644 --- a/web/test/utils/subjects/modeller/sketcherUISubject.js +++ b/web/test/utils/subjects/modeller/sketcherUISubject.js @@ -37,7 +37,7 @@ export function createSubjectFromInPlaceSketcher(ctx) { ]; } - function addSerpinski([ax, ay], [bx, by], depth) { + function addSerpinski(ax, ay, bx, by, depth) { genSerpinskiImpl(ctx.services.sketcher.inPlaceEditor.viewer, {x: ax, y: ay}, {x: bx, y: by}, depth); let jointWidth = distance(ax, ay, bx, by) / (depth + 1) / 2; let dx = bx - ax; @@ -52,10 +52,12 @@ export function createSubjectFromInPlaceSketcher(ctx) { addSegment(bx, by, bx-ddx, by-ddy); } - function addPolygon(points) { - let p, q, n = points.length; + function addPolygon() { + let p, q, n = arguments.length; for(p = n - 1, q = 0; q < n; p = q++) { - addSegment(p, q); + let [ax, ay] = arguments[p]; + let [bx, by] = arguments[q]; + addSegment(ax, ay, bx, by); } }