use of com.android.aapt.Resources.Source in project bundletool by google.
the class ResourceTableMergerTest method sourcePools_equal_sourceReferencesPreserved.
@Test
public void sourcePools_equal_sourceReferencesPreserved() throws Exception {
StringPool commonSourcePool = StringPool.newBuilder().setData(ByteString.copyFrom(DUMMY_BYTES)).build();
Source source1 = Source.newBuilder().setPathIdx(42).build();
Source source2 = Source.newBuilder().setPathIdx(24).build();
ResourceTable table1 = resourceTable(commonSourcePool, pkg(0x01, "package", type(0x11, "type", entry(0x21, "entry", value("ldpi", LDPI, source1)))));
ResourceTable table2 = resourceTable(commonSourcePool, pkg(0x02, "package", type(0x11, "type", entry(0x21, "entry", value("ldpi", LDPI, source2)))));
ResourceTable merged = new ResourceTableMerger().merge(table1, table2);
assertThat(merged).ignoringRepeatedFieldOrder().isEqualTo(resourceTable(commonSourcePool, pkg(0x01, "package", type(0x11, "type", entry(0x21, "entry", value("ldpi", LDPI, source1)))), pkg(0x02, "package", type(0x11, "type", entry(0x21, "entry", value("ldpi", LDPI, source2))))));
}
use of com.android.aapt.Resources.Source in project bundletool by google.
the class ResourceTableMergerTest method sourcePools_different_sourceReferencesInSecondTableStripped.
@Test
public void sourcePools_different_sourceReferencesInSecondTableStripped() throws Exception {
Source source1 = Source.newBuilder().setPathIdx(42).build();
Source source2 = Source.newBuilder().setPathIdx(24).build();
ResourceTable table1 = resourceTable(pkg(0x01, "package", type(0x11, "type", entry(0x21, "entry", value("ldpi", LDPI, source1)))));
ResourceTable table2 = resourceTable(StringPool.newBuilder().setData(ByteString.copyFrom(DUMMY_BYTES)).build(), pkg(0x02, "package", type(0x11, "type", entry(0x21, "entry", value("ldpi", LDPI, source2)))));
ResourceTable merged = new ResourceTableMerger().merge(table1, table2);
assertThat(merged).ignoringRepeatedFieldOrder().isEqualTo(resourceTable(pkg(0x01, "package", type(0x11, "type", entry(0x21, "entry", value("ldpi", LDPI, source1)))), pkg(0x02, "package", type(0x11, "type", entry(0x21, "entry", value("ldpi", LDPI))))));
}
Aggregations