Search in sources :

Example 31 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class MetadataBuilderTest method testTrivialMetadata.

@Test
public void testTrivialMetadata() throws Exception {
    DefaultClassMetadata<Trivial> metadata = new DefaultClassMetadata<>(new SimpleUri(), Trivial.class, factory, copyStrategyLibrary);
    assertNotNull(metadata);
    assertEquals(0, metadata.getFieldCount());
    assertTrue(metadata.isConstructable());
}
Also used : DefaultClassMetadata(org.terasology.reflection.metadata.DefaultClassMetadata) SimpleUri(org.terasology.engine.SimpleUri) Test(org.junit.Test)

Example 32 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class MetadataBuilderTest method testDetectsLackOfDefaultConstructor.

@Test
public void testDetectsLackOfDefaultConstructor() throws Exception {
    DefaultClassMetadata<NoDefaultConstructor> metadata = new DefaultClassMetadata<>(new SimpleUri(), NoDefaultConstructor.class, factory, copyStrategyLibrary);
    assertFalse(metadata.isConstructable());
}
Also used : DefaultClassMetadata(org.terasology.reflection.metadata.DefaultClassMetadata) SimpleUri(org.terasology.engine.SimpleUri) Test(org.junit.Test)

Example 33 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class InputSystemTests method testKeyBinding.

@Test
public void testKeyBinding() {
    Map<Integer, BindableButton> keyBinds = new HashMap<>();
    // mock binding to the TestEventButton, this is done by the BindsManager over the annotations by default
    keyBinds.put(KeyId.T, new BindableButtonImpl(new SimpleUri("engine-tests", "testEvent"), "theTestEvent", new TestEventButton()));
    when(bindsManager.getKeyBinds()).thenReturn(keyBinds);
    pressKey(Key.T);
    inputSystem.update(1f);
    verify(clientEntity).send(Mockito.any(TestEventButton.class));
}
Also used : HashMap(java.util.HashMap) SimpleUri(org.terasology.engine.SimpleUri) BindableButtonImpl(org.terasology.input.internal.BindableButtonImpl) Test(org.junit.Test)

Example 34 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class BindsSubsystemTest method testRegisterBinds.

@Test
public void testRegisterBinds() {
    registerBindButtonClasses.add(TestEventButton.class);
    bindsSubsystem.updateConfigWithDefaultBinds();
    bindsSubsystem.registerBinds();
    BindableButton button = bindsSubsystem.getKeyBinds().get(KeyId.T);
    assertThat(button, is(not(nullValue())));
    assertThat(button.getId(), is(new SimpleUri(TEST_MODULE, "testEvent")));
    assertThat(button.getDisplayName(), is("${engine-tests:menu#theTestEvent}"));
}
Also used : BindableButton(org.terasology.input.BindableButton) SimpleUri(org.terasology.engine.SimpleUri) Test(org.junit.Test)

Example 35 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class DisplayResolutionDependentFBOs method request.

@Override
public FBO request(FBOConfig fboConfig) {
    FBO fbo;
    SimpleUri fboName = fboConfig.getName();
    if (fboConfigs.containsKey(fboName)) {
        if (!fboConfig.equals(fboConfigs.get(fboName))) {
            throw new IllegalArgumentException("Requested FBO is already available with different configuration");
        }
        fbo = fboLookup.get(fboConfig.getName());
    } else {
        fbo = generateWithDimensions(fboConfig, fullScale.multiplyBy(fboConfig.getScale()));
    }
    retain(fboName);
    return fbo;
}
Also used : SwappableFBO(org.terasology.rendering.opengl.SwappableFBO) FBO(org.terasology.rendering.opengl.FBO) SimpleUri(org.terasology.engine.SimpleUri)

Aggregations

SimpleUri (org.terasology.engine.SimpleUri)71 Test (org.junit.Test)18 Map (java.util.Map)10 Name (org.terasology.naming.Name)9 ResourceUrn (org.terasology.assets.ResourceUrn)7 DefaultClassMetadata (org.terasology.reflection.metadata.DefaultClassMetadata)7 Config (org.terasology.config.Config)6 Input (org.terasology.input.Input)6 FBO (org.terasology.rendering.opengl.FBO)6 ModuleManager (org.terasology.engine.module.ModuleManager)5 Command (org.terasology.logic.console.commandSystem.annotations.Command)5 ModuleEnvironment (org.terasology.module.ModuleEnvironment)5 List (java.util.List)4 DependencyResolver (org.terasology.module.DependencyResolver)4 ResolutionResult (org.terasology.module.ResolutionResult)4 UILabel (org.terasology.rendering.nui.widgets.UILabel)4 Lists (com.google.common.collect.Lists)3 IOException (java.io.IOException)3 Type (java.lang.reflect.Type)3 Locale (java.util.Locale)3