Search in sources :

Example 1 with Config

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

the class LoaderTest method testScaled.

/**
 * Test with screen scaled.
 */
@Test
public 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.Test)

Example 2 with Config

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

the class LoaderTest method testNoIconWindowed.

/**
 * Test with no icon in windowed mode.
 */
@Test
public void testNoIconWindowed() {
    final Config config = new Config(OUTPUT, 16, true, Medias.create("void"));
    Loader.start(config, SequenceSingleMock.class).await();
}
Also used : Config(com.b3dgs.lionengine.Config) Test(org.junit.Test)

Example 3 with Config

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

the class LoaderTest method testInterruptedUnchecked.

/**
 * Test interrupted unchecked exception.
 *
 * @throws InterruptedException If error.
 */
@Test(timeout = SequenceInterruptMock.PAUSE_MILLI * 2L)
public void testInterruptedUnchecked() throws InterruptedException {
    try {
        Graphics.setFactoryGraphic(new FactoryGraphicMock() {

            @Override
            public Screen createScreen(Config config) {
                return null;
            }
        });
        final AtomicReference<Throwable> exception = new AtomicReference<>();
        final Semaphore semaphore = new Semaphore(0);
        final Thread thread = new Thread() {

            @Override
            public void run() {
                final TaskFuture future = Loader.start(CONFIG, SequenceInterruptMock.class);
                future.await();
            }
        };
        thread.setUncaughtExceptionHandler((t, throwable) -> {
            exception.set(throwable);
            semaphore.release();
        });
        Verbose.info("*********************************** EXPECTED VERBOSE ***********************************");
        thread.start();
        semaphore.acquire();
        Assert.assertTrue(exception.get().getCause() instanceof NullPointerException);
    } finally {
        Verbose.info("****************************************************************************************");
        Graphics.setFactoryGraphic(new FactoryGraphicMock());
    }
}
Also used : Config(com.b3dgs.lionengine.Config) Screen(com.b3dgs.lionengine.graphic.Screen) FactoryGraphicMock(com.b3dgs.lionengine.graphic.FactoryGraphicMock) AtomicReference(java.util.concurrent.atomic.AtomicReference) Semaphore(java.util.concurrent.Semaphore) Test(org.junit.Test)

Example 4 with Config

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

the class LoaderTest method testDirect.

/**
 * Test with screen direct.
 */
@Test
public void testDirect() {
    final Resolution output = new Resolution(320, 240, 60);
    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.Test)

Example 5 with Config

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

the class LoaderTest method testIconWindowed.

/**
 * Test with an icon in windowed mode.
 */
@Test
public void testIconWindowed() {
    final Config config = new Config(OUTPUT, 16, true, icon);
    Loader.start(config, SequenceSingleMock.class).await();
}
Also used : Config(com.b3dgs.lionengine.Config) Test(org.junit.Test)

Aggregations

Config (com.b3dgs.lionengine.Config)89 Resolution (com.b3dgs.lionengine.Resolution)75 Screen (com.b3dgs.lionengine.graphic.Screen)47 ScreenMock (com.b3dgs.lionengine.graphic.ScreenMock)45 Test (org.junit.jupiter.api.Test)42 Test (org.junit.Test)38 FactoryGraphicMock (com.b3dgs.lionengine.graphic.FactoryGraphicMock)2 Semaphore (java.util.concurrent.Semaphore)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Context (com.b3dgs.lionengine.Context)1 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 ImageBuffer (com.b3dgs.lionengine.graphic.ImageBuffer)1 Rasterbar (com.b3dgs.lionengine.graphic.engine.Rasterbar)1 Sequencer (com.b3dgs.lionengine.graphic.engine.Sequencer)1 SourceResolutionProvider (com.b3dgs.lionengine.graphic.engine.SourceResolutionProvider)1 FilterBilinear (com.b3dgs.lionengine.graphic.filter.FilterBilinear)1