Search in sources :

Example 1 with ImageNodeStyleSizeProvider

use of org.eclipse.sirius.components.diagrams.layout.incremental.provider.ImageNodeStyleSizeProvider in project sirius-components by eclipse-sirius.

the class ImageNodeStyleSizeProviderTests method testImageNodeStyleScaledSize.

@Test
public void testImageNodeStyleScaledSize() {
    ImageNodeStyleSizeProvider imageNodeStyleSizeProvider = new ImageNodeStyleSizeProvider(this.imageSizeProvider);
    // @formatter:off
    ImageNodeStyle imageNodeStyle = ImageNodeStyle.newImageNodeStyle().imageURL(IMAGE_PNG).scalingFactor(2).build();
    // @formatter:on
    Size size = imageNodeStyleSizeProvider.getSize(imageNodeStyle);
    assertThat(size.getWidth()).isCloseTo(20.0, Offset.offset(0.0001));
}
Also used : ImageNodeStyleSizeProvider(org.eclipse.sirius.components.diagrams.layout.incremental.provider.ImageNodeStyleSizeProvider) ImageNodeStyle(org.eclipse.sirius.components.diagrams.ImageNodeStyle) Size(org.eclipse.sirius.components.diagrams.Size) Test(org.junit.jupiter.api.Test)

Example 2 with ImageNodeStyleSizeProvider

use of org.eclipse.sirius.components.diagrams.layout.incremental.provider.ImageNodeStyleSizeProvider in project sirius-components by eclipse-sirius.

the class ImageNodeStyleSizeProviderTests method testImageNodeStyleNativeSize.

@Test
public void testImageNodeStyleNativeSize() {
    ImageNodeStyleSizeProvider imageNodeStyleSizeProvider = new ImageNodeStyleSizeProvider(this.imageSizeProvider);
    // @formatter:off
    ImageNodeStyle imageNodeStyle = ImageNodeStyle.newImageNodeStyle().imageURL(IMAGE_PNG).scalingFactor(-1).build();
    // @formatter:on
    Size size = imageNodeStyleSizeProvider.getSize(imageNodeStyle);
    assertThat(size.getWidth()).isCloseTo(42.0, Offset.offset(0.0001));
}
Also used : ImageNodeStyleSizeProvider(org.eclipse.sirius.components.diagrams.layout.incremental.provider.ImageNodeStyleSizeProvider) ImageNodeStyle(org.eclipse.sirius.components.diagrams.ImageNodeStyle) Size(org.eclipse.sirius.components.diagrams.Size) Test(org.junit.jupiter.api.Test)

Aggregations

ImageNodeStyle (org.eclipse.sirius.components.diagrams.ImageNodeStyle)2 Size (org.eclipse.sirius.components.diagrams.Size)2 ImageNodeStyleSizeProvider (org.eclipse.sirius.components.diagrams.layout.incremental.provider.ImageNodeStyleSizeProvider)2 Test (org.junit.jupiter.api.Test)2