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