Search in sources :

Example 1 with ImageDefinition

use of org.kie.workbench.common.stunner.svg.gen.model.impl.ImageDefinition 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)

Aggregations

Test (org.junit.Test)1 ImageDefinition (org.kie.workbench.common.stunner.svg.gen.model.impl.ImageDefinition)1 TransformDefinitionImpl (org.kie.workbench.common.stunner.svg.gen.model.impl.TransformDefinitionImpl)1