Search in sources :

Example 6 with FactoryGraphicMock

use of com.b3dgs.lionengine.graphic.FactoryGraphicMock in project lionengine by b3dgs.

the class FilterBilinearTest method setUp.

/**
 * Prepare test.
 */
@BeforeClass
public static void setUp() {
    Medias.setLoadFromJar(FilterBilinearTest.class);
    Graphics.setFactoryGraphic(new FactoryGraphicMock());
    media = Medias.create("image.png");
}
Also used : FactoryGraphicMock(com.b3dgs.lionengine.graphic.FactoryGraphicMock) BeforeClass(org.junit.BeforeClass)

Example 7 with FactoryGraphicMock

use of com.b3dgs.lionengine.graphic.FactoryGraphicMock in project lionengine by b3dgs.

the class FilterHq3xTest method setUp.

/**
 * Prepare test.
 */
@BeforeClass
public static void setUp() {
    Medias.setLoadFromJar(FilterHq3xTest.class);
    Graphics.setFactoryGraphic(new FactoryGraphicMock());
    media = Medias.create("image.png");
}
Also used : FactoryGraphicMock(com.b3dgs.lionengine.graphic.FactoryGraphicMock) BeforeClass(org.junit.BeforeClass)

Example 8 with FactoryGraphicMock

use of com.b3dgs.lionengine.graphic.FactoryGraphicMock in project lionengine by b3dgs.

the class LoaderTest method prepareTest.

/**
 * Prepare the test.
 */
@BeforeClass
public static void prepareTest() {
    Medias.setLoadFromJar(LoaderTest.class);
    Graphics.setFactoryGraphic(new FactoryGraphicMock());
    icon = Medias.create("image.png");
}
Also used : FactoryGraphicMock(com.b3dgs.lionengine.graphic.FactoryGraphicMock) BeforeClass(org.junit.BeforeClass)

Example 9 with FactoryGraphicMock

use of com.b3dgs.lionengine.graphic.FactoryGraphicMock 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 10 with FactoryGraphicMock

use of com.b3dgs.lionengine.graphic.FactoryGraphicMock in project lionengine by b3dgs.

the class RasterImageTest method setUp.

/**
 * Prepare test.
 *
 * @throws IOException If error.
 */
@BeforeClass
public static void setUp() throws IOException {
    Medias.setLoadFromJar(RasterImageTest.class);
    Graphics.setFactoryGraphic(new FactoryGraphicMock());
    mediaRaster = Medias.create("raster.xml");
}
Also used : FactoryGraphicMock(com.b3dgs.lionengine.graphic.FactoryGraphicMock) BeforeClass(org.junit.BeforeClass)

Aggregations

FactoryGraphicMock (com.b3dgs.lionengine.graphic.FactoryGraphicMock)61 BeforeAll (org.junit.jupiter.api.BeforeAll)35 BeforeClass (org.junit.BeforeClass)24 EngineMock (com.b3dgs.lionengine.EngineMock)11 FactoryMediaDefault (com.b3dgs.lionengine.FactoryMediaDefault)3 Config (com.b3dgs.lionengine.Config)2 Screen (com.b3dgs.lionengine.graphic.Screen)2 Semaphore (java.util.concurrent.Semaphore)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Animation (com.b3dgs.lionengine.Animation)1 Xml (com.b3dgs.lionengine.Xml)1 Collision (com.b3dgs.lionengine.game.feature.collidable.Collision)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1