Search in sources :

Example 61 with Resolution

use of com.b3dgs.lionengine.Resolution in project lionengine by b3dgs.

the class DpiTypeTest method testFrom.

/**
 * Test the from function.
 */
@Test
public void testFrom() {
    final Resolution baseline = new Resolution(640, 480, 60);
    Assert.assertEquals(DpiType.LDPI, DpiType.from(baseline, get(baseline, 0.75)));
    Assert.assertEquals(DpiType.MDPI, DpiType.from(baseline, get(baseline, 1.0)));
    Assert.assertEquals(DpiType.HDPI, DpiType.from(baseline, get(baseline, 1.5)));
    Assert.assertEquals(DpiType.XHDPI, DpiType.from(baseline, get(baseline, 2.0)));
    Assert.assertEquals(DpiType.XXHDPI, DpiType.from(baseline, get(baseline, 3.0)));
    Assert.assertEquals(DpiType.LDPI, DpiType.from(baseline, new Resolution(320, 200, 60)));
    Assert.assertEquals(DpiType.LDPI, DpiType.from(baseline, new Resolution(320, 240, 60)));
    Assert.assertEquals(DpiType.LDPI, DpiType.from(baseline, new Resolution(200, 320, 60)));
    Assert.assertEquals(DpiType.LDPI, DpiType.from(baseline, new Resolution(240, 320, 60)));
    Assert.assertEquals(DpiType.LDPI, DpiType.from(baseline, new Resolution(400, 640, 60)));
    Assert.assertEquals(DpiType.LDPI, DpiType.from(baseline, new Resolution(480, 640, 60)));
    Assert.assertEquals(DpiType.MDPI, DpiType.from(baseline, baseline));
    Assert.assertEquals(DpiType.MDPI, DpiType.from(baseline, new Resolution(800, 600, 60)));
    Assert.assertEquals(DpiType.MDPI, DpiType.from(baseline, new Resolution(720, 1280, 60)));
    Assert.assertEquals(DpiType.MDPI, DpiType.from(baseline, new Resolution(800, 1280, 60)));
    Assert.assertEquals(DpiType.HDPI, DpiType.from(baseline, new Resolution(1280, 720, 60)));
    Assert.assertEquals(DpiType.HDPI, DpiType.from(baseline, new Resolution(1280, 800, 60)));
    Assert.assertEquals(DpiType.HDPI, DpiType.from(baseline, new Resolution(960, 1280, 60)));
    Assert.assertEquals(DpiType.HDPI, DpiType.from(baseline, new Resolution(1080, 1920, 60)));
    Assert.assertEquals(DpiType.HDPI, DpiType.from(baseline, new Resolution(1200, 1920, 60)));
    Assert.assertEquals(DpiType.XHDPI, DpiType.from(baseline, new Resolution(1280, 960, 60)));
    Assert.assertEquals(DpiType.XHDPI, DpiType.from(baseline, new Resolution(1600, 2560, 60)));
    Assert.assertEquals(DpiType.XHDPI, DpiType.from(baseline, new Resolution(1920, 1080, 60)));
    Assert.assertEquals(DpiType.XHDPI, DpiType.from(baseline, new Resolution(1920, 1200, 60)));
    Assert.assertEquals(DpiType.XXHDPI, DpiType.from(baseline, new Resolution(2560, 1600, 60)));
    Assert.assertEquals(DpiType.XXHDPI, DpiType.from(baseline, new Resolution(2560, 1920, 60)));
    Assert.assertEquals(DpiType.XXHDPI, DpiType.from(baseline, new Resolution(1920, 2560, 60)));
}
Also used : Resolution(com.b3dgs.lionengine.Resolution) Test(org.junit.Test)

Example 62 with Resolution

use of com.b3dgs.lionengine.Resolution in project lionengine by b3dgs.

the class ScreenAwtTest method testFullscreenFail.

/**
 * Test full screen fail.
 *
 * @throws ReflectiveOperationException If error.
 */
@Test
void testFullscreenFail() throws ReflectiveOperationException {
    final Resolution resolution = new Resolution(Integer.MAX_VALUE, Integer.MAX_VALUE, 0);
    final Config config = new Config(resolution, 32, false);
    assertThrowsPrefix(() -> testScreen(config), ScreenFullAwt.ERROR_UNSUPPORTED_FULLSCREEN);
}
Also used : Config(com.b3dgs.lionengine.Config) Resolution(com.b3dgs.lionengine.Resolution) Test(org.junit.jupiter.api.Test)

Example 63 with Resolution

use of com.b3dgs.lionengine.Resolution in project lionengine by b3dgs.

the class ScreenAwtTest method testFullscreen.

/**
 * Test full screen.
 */
@Test
void testFullscreen() {
    Medias.setLoadFromJar(ScreenAwtTest.class);
    final DisplayMode res = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayModes()[0];
    final Config config = new Config(new Resolution(res.getWidth(), res.getHeight(), res.getRefreshRate()), res.getBitDepth(), false, Medias.create("image.png"));
    try {
        testScreen(config);
    } catch (final LionEngineException exception) {
        // Skip test
        if (!ScreenFullAwt.ERROR_SWITCH.equals(exception.getMessage())) {
            throw exception;
        }
    }
}
Also used : DisplayMode(java.awt.DisplayMode) LionEngineException(com.b3dgs.lionengine.LionEngineException) Config(com.b3dgs.lionengine.Config) Resolution(com.b3dgs.lionengine.Resolution) Test(org.junit.jupiter.api.Test)

Example 64 with Resolution

use of com.b3dgs.lionengine.Resolution in project lionengine by b3dgs.

the class ScreenHeadlessTest method testFullscreen.

/**
 * Test full screen.
 *
 * @throws Exception If error.
 */
@Test
void testFullscreen() throws Exception {
    final Resolution resolution = com.b3dgs.lionengine.UtilTests.RESOLUTION_320_240;
    final Config config = new Config(resolution, 32, false, Medias.create(IMAGE));
    assertTimeout(1000L, () -> testScreen(config));
}
Also used : Config(com.b3dgs.lionengine.Config) Resolution(com.b3dgs.lionengine.Resolution) Test(org.junit.jupiter.api.Test)

Example 65 with Resolution

use of com.b3dgs.lionengine.Resolution in project lionengine by b3dgs.

the class MapTileRasteredModelIT method testRaster.

/**
 * Test the raster.
 */
@Test
void testRaster() {
    EngineAwt.start(getClass().getSimpleName(), Version.create(1, 0, 0), getClass());
    final Resolution output = new Resolution(640, 480, 60);
    Loader.start(Config.windowed(output), SceneMapTileRastered.class).await();
}
Also used : Resolution(com.b3dgs.lionengine.Resolution) Test(org.junit.jupiter.api.Test)

Aggregations

Resolution (com.b3dgs.lionengine.Resolution)95 Config (com.b3dgs.lionengine.Config)75 Screen (com.b3dgs.lionengine.graphic.Screen)45 ScreenMock (com.b3dgs.lionengine.graphic.ScreenMock)45 Test (org.junit.jupiter.api.Test)45 Test (org.junit.Test)33 Graphic (com.b3dgs.lionengine.graphic.Graphic)3 Media (com.b3dgs.lionengine.Media)2 LionEngineException (com.b3dgs.lionengine.LionEngineException)1 FilterBilinear (com.b3dgs.lionengine.core.filter.FilterBilinear)1 FilterBlur (com.b3dgs.lionengine.core.filter.FilterBlur)1 FilterHq2x (com.b3dgs.lionengine.core.filter.FilterHq2x)1 FilterHq3x (com.b3dgs.lionengine.core.filter.FilterHq3x)1 SourceResolutionDelegate (com.b3dgs.lionengine.graphic.engine.SourceResolutionDelegate)1 FilterBilinear (com.b3dgs.lionengine.graphic.filter.FilterBilinear)1 FilterBlur (com.b3dgs.lionengine.graphic.filter.FilterBlur)1 FilterHq2x (com.b3dgs.lionengine.graphic.filter.FilterHq2x)1 FilterHq3x (com.b3dgs.lionengine.graphic.filter.FilterHq3x)1 DisplayMode (java.awt.DisplayMode)1 GraphicsDevice (java.awt.GraphicsDevice)1