Search in sources :

Example 1 with TransformDefinitionImpl

use of org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl in project kie-wb-common by kiegroup.

the class ImageDefinitionGeneratorTest method testGenerate.

@Test
public void testGenerate() throws Exception {
    final ImageDefinition definition = new ImageDefinition(ID, HREF);
    definition.setX(X);
    definition.setY(Y);
    definition.setAlpha(ALPHA);
    definition.setStyleDefinition(new StyleDefinitionImpl.Builder().setAlpha(ALPHA).setFillColor(FILL_COLOR).setFillAlpha(FILL_ALPHA).setStrokeColor(STROKE_COLOR).setStrokeAlpha(STROKE_ALPHA).setStrokeWidth(STROKE_WIDTH).build());
    definition.setTransformDefinition(new TransformDefinitionImpl(VBOX_WIDTH, VBOX_HEIGHT, VBOX_MIN_X, VBOX_MIN_Y));
    final String generated = tested.generate(definition).toString();
    assertTrue(generated.contains("new " + Picture.class.getName() + "(" + GeneratorAssertions.formatString(HREF) + ")"));
    GeneratorAssertions.assertDraggable(generated);
    GeneratorAssertions.assertID(generated, ID);
    GeneratorAssertions.assertX(generated, X);
    GeneratorAssertions.assertY(generated, Y);
    GeneratorAssertions.assertAlpha(generated, ALPHA);
    GeneratorAssertions.assertScale(generated, VBOX_WIDTH, VBOX_HEIGHT);
    GeneratorAssertions.assertFillColor(generated, FILL_COLOR);
    GeneratorAssertions.assertFillAlpha(generated, FILL_ALPHA);
    GeneratorAssertions.assertStrokeColor(generated, STROKE_COLOR);
    GeneratorAssertions.assertStrokeAlpha(generated, STROKE_ALPHA);
    GeneratorAssertions.assertStrokeWidth(generated, STROKE_WIDTH);
    GeneratorAssertions.assertListening(generated, LISTENING);
}
Also used : TransformDefinitionImpl(org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl) ImageDefinition(org.kie.workbench.common.stunner.svg.gen.model.impl.ImageDefinition) Test(org.junit.Test)

Example 2 with TransformDefinitionImpl

use of org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl in project kie-wb-common by kiegroup.

the class CircleDefinitionGeneratorTest method testGenerate.

@Test
public void testGenerate() throws Exception {
    final CircleDefinition circleDefinition = new CircleDefinition(ID, RADIUS);
    circleDefinition.setX(X);
    circleDefinition.setY(Y);
    circleDefinition.setAlpha(ALPHA);
    circleDefinition.setStyleDefinition(new StyleDefinitionImpl.Builder().setAlpha(ALPHA).setFillColor(FILL_COLOR).setFillAlpha(FILL_ALPHA).setStrokeColor(STROKE_COLOR).setStrokeAlpha(STROKE_ALPHA).setStrokeWidth(STROKE_WIDTH).build());
    circleDefinition.setTransformDefinition(new TransformDefinitionImpl(VBOX_WIDTH, VBOX_HEIGHT, VBOX_MIN_X, VBOX_MIN_Y));
    final String generated = tested.generate(circleDefinition).toString();
    assertTrue(generated.contains("new " + Circle.class.getName() + "(" + GeneratorAssertions.formatDouble(RADIUS) + ")"));
    GeneratorAssertions.assertDraggable(generated);
    GeneratorAssertions.assertID(generated, ID);
    GeneratorAssertions.assertX(generated, X);
    GeneratorAssertions.assertY(generated, Y);
    GeneratorAssertions.assertAlpha(generated, ALPHA);
    GeneratorAssertions.assertScale(generated, VBOX_WIDTH, VBOX_HEIGHT);
    GeneratorAssertions.assertFillColor(generated, FILL_COLOR);
    GeneratorAssertions.assertFillAlpha(generated, FILL_ALPHA);
    GeneratorAssertions.assertStrokeColor(generated, STROKE_COLOR);
    GeneratorAssertions.assertStrokeAlpha(generated, STROKE_ALPHA);
    GeneratorAssertions.assertStrokeWidth(generated, STROKE_WIDTH);
    GeneratorAssertions.assertListening(generated, LISTENING);
}
Also used : CircleDefinition(org.kie.workbench.common.stunner.svg.gen.model.impl.CircleDefinition) TransformDefinitionImpl(org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl) Test(org.junit.Test)

Example 3 with TransformDefinitionImpl

use of org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl in project kie-wb-common by kiegroup.

the class GroupDefinitionGeneratorTest method testGenerate.

@Test
public void testGenerate() throws Exception {
    final GroupDefinition definition = new GroupDefinition(ID);
    definition.setX(X);
    definition.setY(Y);
    definition.setAlpha(ALPHA);
    definition.setTransformDefinition(new TransformDefinitionImpl(VBOX_WIDTH, VBOX_HEIGHT, VBOX_MIN_X, VBOX_MIN_Y));
    final String generated = tested.generate(definition).toString();
    assertTrue(generated.contains("new " + Group.class.getName() + "()"));
    GeneratorAssertions.assertDraggable(generated);
    GeneratorAssertions.assertID(generated, ID);
    GeneratorAssertions.assertX(generated, X);
    GeneratorAssertions.assertY(generated, Y);
    GeneratorAssertions.assertAlpha(generated, ALPHA);
    GeneratorAssertions.assertScale(generated, VBOX_WIDTH, VBOX_HEIGHT);
    GeneratorAssertions.assertListening(generated, LISTENING);
}
Also used : GroupDefinition(org.kie.workbench.common.stunner.svg.gen.model.impl.GroupDefinition) TransformDefinitionImpl(org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl) Test(org.junit.Test)

Example 4 with TransformDefinitionImpl

use of org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl in project kie-wb-common by kiegroup.

the class MultiPathDefinitionGeneratorTest method testGenerate.

@Test
public void testGenerate() throws Exception {
    final MultiPathDefinition definition = new MultiPathDefinition(ID, PATH);
    definition.setX(X);
    definition.setY(Y);
    definition.setAlpha(ALPHA);
    definition.setStyleDefinition(new StyleDefinitionImpl.Builder().setAlpha(ALPHA).setFillColor(FILL_COLOR).setFillAlpha(FILL_ALPHA).setStrokeColor(STROKE_COLOR).setStrokeAlpha(STROKE_ALPHA).setStrokeWidth(STROKE_WIDTH).setStrokeDashArray(STROKE_DASHARRAY).build());
    definition.setTransformDefinition(new TransformDefinitionImpl(VBOX_WIDTH, VBOX_HEIGHT, VBOX_MIN_X, VBOX_MIN_Y));
    final String generated = tested.generate(definition).toString();
    assertTrue(generated.contains("new " + MultiPath.class.getName() + "(" + SVGViewFactoryGenerator.FIELD_STATICS + ID.toUpperCase() + ")"));
    GeneratorAssertions.assertDraggable(generated);
    GeneratorAssertions.assertID(generated, ID);
    GeneratorAssertions.assertX(generated, X);
    GeneratorAssertions.assertY(generated, Y);
    GeneratorAssertions.assertAlpha(generated, ALPHA);
    GeneratorAssertions.assertScale(generated, VBOX_WIDTH, VBOX_HEIGHT);
    GeneratorAssertions.assertFillColor(generated, FILL_COLOR);
    GeneratorAssertions.assertFillAlpha(generated, FILL_ALPHA);
    GeneratorAssertions.assertStrokeColor(generated, STROKE_COLOR);
    GeneratorAssertions.assertStrokeAlpha(generated, STROKE_ALPHA);
    GeneratorAssertions.assertStrokeWidth(generated, STROKE_WIDTH);
    GeneratorAssertions.assertStrokeDashArray(generated, STROKE_DASHARRAY);
    GeneratorAssertions.assertListening(generated, LISTENING);
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) MultiPathDefinition(org.kie.workbench.common.stunner.svg.gen.model.impl.MultiPathDefinition) TransformDefinitionImpl(org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl) StyleDefinitionImpl(org.kie.workbench.common.stunner.svg.gen.model.impl.StyleDefinitionImpl) Test(org.junit.Test)

Example 5 with TransformDefinitionImpl

use of org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl in project kie-wb-common by kiegroup.

the class RectangleDefinitionGeneratorTest method testGenerate.

@Test
public void testGenerate() throws Exception {
    final RectDefinition definition = new RectDefinition(ID, WIDTH, HEIGHT, CORNER_RADIUS);
    definition.setX(X);
    definition.setY(Y);
    definition.setAlpha(ALPHA);
    definition.setStyleDefinition(new StyleDefinitionImpl.Builder().setAlpha(ALPHA).setFillColor(FILL_COLOR).setFillAlpha(FILL_ALPHA).setStrokeColor(STROKE_COLOR).setStrokeAlpha(STROKE_ALPHA).setStrokeWidth(STROKE_WIDTH).build());
    definition.setTransformDefinition(new TransformDefinitionImpl(VBOX_WIDTH, VBOX_HEIGHT, VBOX_MIN_X, VBOX_MIN_Y));
    final String generated = tested.generate(definition).toString();
    assertTrue(generated.contains("new " + Rectangle.class.getName() + "(" + GeneratorAssertions.formatDouble(WIDTH) + ", " + GeneratorAssertions.formatDouble(HEIGHT) + ")"));
    GeneratorAssertions.assertDraggable(generated);
    GeneratorAssertions.assertID(generated, ID);
    GeneratorAssertions.assertX(generated, X);
    GeneratorAssertions.assertY(generated, Y);
    GeneratorAssertions.assertAlpha(generated, ALPHA);
    GeneratorAssertions.assertScale(generated, VBOX_WIDTH, VBOX_HEIGHT);
    GeneratorAssertions.assertFillColor(generated, FILL_COLOR);
    GeneratorAssertions.assertFillAlpha(generated, FILL_ALPHA);
    GeneratorAssertions.assertStrokeColor(generated, STROKE_COLOR);
    GeneratorAssertions.assertStrokeAlpha(generated, STROKE_ALPHA);
    GeneratorAssertions.assertStrokeWidth(generated, STROKE_WIDTH);
    GeneratorAssertions.assertListening(generated, LISTENING);
}
Also used : TransformDefinitionImpl(org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl) RectDefinition(org.kie.workbench.common.stunner.svg.gen.model.impl.RectDefinition) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)5 TransformDefinitionImpl (org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl)5 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1 CircleDefinition (org.kie.workbench.common.stunner.svg.gen.model.impl.CircleDefinition)1 GroupDefinition (org.kie.workbench.common.stunner.svg.gen.model.impl.GroupDefinition)1 ImageDefinition (org.kie.workbench.common.stunner.svg.gen.model.impl.ImageDefinition)1 MultiPathDefinition (org.kie.workbench.common.stunner.svg.gen.model.impl.MultiPathDefinition)1 RectDefinition (org.kie.workbench.common.stunner.svg.gen.model.impl.RectDefinition)1 StyleDefinitionImpl (org.kie.workbench.common.stunner.svg.gen.model.impl.StyleDefinitionImpl)1