Search in sources :

Example 91 with Resolution

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

the class LoaderTest method testFilterHq3x.

/**
 * Test with a hq3x filter.
 */
@Test
void testFilterHq3x() {
    final Resolution output = new Resolution(960, 720, 60);
    final Config config = new Config(output, 16, false);
    Loader.start(config, SequenceFilterMock.class, new FilterHq3x()).await();
}
Also used : Config(com.b3dgs.lionengine.Config) FilterHq3x(com.b3dgs.lionengine.graphic.filter.FilterHq3x) Resolution(com.b3dgs.lionengine.Resolution) Test(org.junit.jupiter.api.Test)

Example 92 with Resolution

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

the class LoaderTest method testScaled.

/**
 * Test with screen scaled.
 */
@Test
void testScaled() {
    final Resolution output = new Resolution(640, 480, 0);
    final Config config = new Config(output, 16, true);
    Loader.start(config, SequenceSingleMock.class).await();
}
Also used : Config(com.b3dgs.lionengine.Config) Resolution(com.b3dgs.lionengine.Resolution) Test(org.junit.jupiter.api.Test)

Example 93 with Resolution

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

the class DrawableTest method testMissingDpi.

/**
 * Test success cases with missing DPI.
 */
@Test
void testMissingDpi() {
    Drawable.setDpi(new Resolution(320, 240, 60), new Config(new Resolution(1920, 1200, 16), 60, false));
    assertNotNull(Drawable.loadImage(Graphics.createImageBuffer(16, 32)));
    assertNotNull(Drawable.loadImage(media));
    assertNotNull(Drawable.loadSprite(Graphics.createImageBuffer(16, 32)));
    assertNotNull(Drawable.loadSprite(media));
    assertNotNull(Drawable.loadSpriteAnimated(Graphics.createImageBuffer(16, 32), 1, 1));
    assertNotNull(Drawable.loadSpriteAnimated(media, 1, 1));
    assertNotNull(Drawable.loadSpriteTiled(Graphics.createImageBuffer(16, 32), 1, 1));
    assertNotNull(Drawable.loadSpriteTiled(media, 1, 1));
    assertNotNull(Drawable.loadSpriteFont(media, font, 1, 1));
    assertNotNull(Drawable.loadSpriteParallaxed(media, 1, 1, 1));
    assertNotNull(Drawable.loadSpriteDigit(Graphics.createImageBuffer(16, 32), 1, 1, 1));
    assertNotNull(Drawable.loadSpriteDigit(media, 1, 1, 1));
    Drawable.setDpi(null);
}
Also used : Config(com.b3dgs.lionengine.Config) Resolution(com.b3dgs.lionengine.Resolution) Test(org.junit.jupiter.api.Test)

Example 94 with Resolution

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

the class DpiTypeTest method testFrom.

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

Example 95 with Resolution

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

the class LauncherModelTest method prepare.

/**
 * Clean test.
 */
@BeforeEach
public void prepare() {
    services.add(new SourceResolutionDelegate(new Resolution(320, 240, 60)));
    launcher = UtilLaunchable.createLauncher(services, setup, featurable);
}
Also used : SourceResolutionDelegate(com.b3dgs.lionengine.graphic.engine.SourceResolutionDelegate) Resolution(com.b3dgs.lionengine.Resolution) BeforeEach(org.junit.jupiter.api.BeforeEach)

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