• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.robolectric.res;
2 
3 import static com.google.common.truth.Truth.assertThat;
4 
5 import org.junit.Test;
6 import org.junit.runner.RunWith;
7 import org.junit.runners.JUnit4;
8 
9 /**
10  * Tests for {@link ResourceIds}
11  */
12 @RunWith(JUnit4.class)
13 public class ResourceIdsTest {
14   @Test
testIsFrameworkResource()15   public void testIsFrameworkResource() {
16     assertThat(ResourceIds.isFrameworkResource(0x01000000)).isTrue();
17     assertThat(ResourceIds.isFrameworkResource(0x7F000000)).isFalse();
18   }
19 
20   @Test
testGetPackageIdentifier()21   public void testGetPackageIdentifier() {
22     assertThat(ResourceIds.getPackageIdentifier(0x01000000)).isEqualTo(0x01);
23     assertThat(ResourceIds.getPackageIdentifier(0x7F000000)).isEqualTo(0x7F);
24   }
25 
26   @Test
testGetTypeIdentifier()27   public void testGetTypeIdentifier() {
28     assertThat(ResourceIds.getTypeIdentifier(0x01019876)).isEqualTo(0x01);
29     assertThat(ResourceIds.getTypeIdentifier(0x7F781234)).isEqualTo(0x78);
30   }
31 
32   @Test
testGetEntryIdentifier()33   public void testGetEntryIdentifier() {
34     assertThat(ResourceIds.getEntryIdentifier(0x01019876)).isEqualTo(0x9876);
35     assertThat(ResourceIds.getEntryIdentifier(0x7F781234)).isEqualTo(0x1234);
36   }
37 
38   @Test
testMakeIdentifier()39   public void testMakeIdentifier() {
40     assertThat(ResourceIds.makeIdentifer(0x01, 0x01, 0x9876)).isEqualTo(0x01019876);
41     assertThat(ResourceIds.makeIdentifer(0x7F, 0x78, 0x1234)).isEqualTo(0x7F781234);
42   }
43 }
44