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)));
}
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);
}
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;
}
}
}
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));
}
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();
}
Aggregations