use of com.google.gwt.resources.client.TextResource in project actor-platform by actorapp.
the class JsAssetsProvider method loadAsset.
@Override
public String loadAsset(String name) {
name = name.replace('.', '_');
Log.d("AssetsRuntime", "loadAsset: " + name);
for (ClientBundleWithLookup b : bundles) {
ResourcePrototype res = b.getResource(name);
if (res != null) {
Log.d("AssetsRuntime", "loadAsset " + res);
return ((TextResource) res).getText();
}
}
return null;
}
use of com.google.gwt.resources.client.TextResource in project gwt-test-utils by gwt-test-utils.
the class ClientBundleTest method textResource_Txt.
@Test
public void textResource_Txt() {
// Given
TextResource textResource = MyClientBundle.INSTANCE.textResourceTxt();
String expectedText = "Hello gwt-test-utils !\r\nThis is a test with a simple text file";
// When
String name = textResource.getName();
String text = textResource.getText();
String toString = textResource.toString();
// Then
assertThat(name).isEqualTo("textResourceTxt");
assertThat(text).isEqualTo(expectedText);
assertThat(toString).isEqualTo("com.googlecode.gwt.test.internal.resources.TextResourceCallback generated for 'com.googlecode.gwt.test.resources.MyClientBundle.textResourceTxt()'");
assertThat(MyClientBundle.INSTANCE.textResourceTxt()).isEqualTo(textResource);
}
use of com.google.gwt.resources.client.TextResource in project gwt-test-utils by gwt-test-utils.
the class ClientBundleTest method textResource_Xml.
@Test
public void textResource_Xml() {
// Given
TextResource textResource = MyClientBundle.INSTANCE.textResourceXml();
String expectedText = "<gwt-test-utils>\r\n <test>this is a test</test>\r\n</gwt-test-utils>";
// When
String name = textResource.getName();
String text = textResource.getText();
String toString = textResource.toString();
// Then
assertThat(name).isEqualTo("textResourceXml");
assertThat(text).isEqualTo(expectedText);
assertThat(toString).isEqualTo("com.googlecode.gwt.test.internal.resources.TextResourceCallback generated for 'com.googlecode.gwt.test.resources.MyClientBundle.textResourceXml()'");
assertThat(MyClientBundle.INSTANCE.textResourceXml()).isEqualTo(textResource);
}
use of com.google.gwt.resources.client.TextResource in project gwt-test-utils by gwt-test-utils.
the class MyOverridedClientBundleTest method textResourceTxt_OverrideWithoutAnnotation.
@Test
public void textResourceTxt_OverrideWithoutAnnotation() {
// Given
TextResource textResource = MyOverridedClientBundle.INSTANCE.textResourceTxt();
String expectedText = "Overrided text resource !";
// When
String name = textResource.getName();
String text = textResource.getText();
// Then
assertThat(name).isEqualTo("textResourceTxt");
assertThat(text).isEqualTo(expectedText);
assertThat(MyOverridedClientBundle.INSTANCE.textResourceTxt()).isEqualTo(textResource);
}
Aggregations