Merge remote-tracking branch 'upstream/master' into robo-staging
diff --git a/src/main/java/com/xtremelabs/robolectric/shadows/ShadowBitmapFactory.java b/src/main/java/com/xtremelabs/robolectric/shadows/ShadowBitmapFactory.java
index 642553d..f804eb1 100644
--- a/src/main/java/com/xtremelabs/robolectric/shadows/ShadowBitmapFactory.java
+++ b/src/main/java/com/xtremelabs/robolectric/shadows/ShadowBitmapFactory.java
@@ -31,6 +31,13 @@
         return bitmap;
     }
 
+    @Implementation
+    public static Bitmap decodeResource(Resources res, int id, BitmapFactory.Options options) {
+        Bitmap bitmap = create("resource:" + getResourceName(id), options);
+        shadowOf(bitmap).setLoadedFromResourceId(id);
+        return bitmap;
+    }
+    
     private static String getResourceName(int id) {
         return shadowOf(Robolectric.application).getResourceLoader().getNameForId(id);
     }
diff --git a/src/main/java/com/xtremelabs/robolectric/shadows/ShadowTextUtils.java b/src/main/java/com/xtremelabs/robolectric/shadows/ShadowTextUtils.java
index d5397ed..0770351 100644
--- a/src/main/java/com/xtremelabs/robolectric/shadows/ShadowTextUtils.java
+++ b/src/main/java/com/xtremelabs/robolectric/shadows/ShadowTextUtils.java
@@ -46,4 +46,13 @@
         }
         return true;
     }
+    
+    @Implementation
+    public static String[] split(String text, String expression) {
+    	if(text.length() == 0) {
+    		return new String[]{};
+    	}
+    	
+    	return text.split(expression);
+    }
 }
diff --git a/src/test/java/com/xtremelabs/robolectric/shadows/BitmapFactoryTest.java b/src/test/java/com/xtremelabs/robolectric/shadows/BitmapFactoryTest.java
index 85d3ac1..3874276 100644
--- a/src/test/java/com/xtremelabs/robolectric/shadows/BitmapFactoryTest.java
+++ b/src/test/java/com/xtremelabs/robolectric/shadows/BitmapFactoryTest.java
@@ -53,6 +53,14 @@
     }
 
     @Test
+    public void decodeResource_canTakeOptions() throws Exception {
+    	BitmapFactory.Options options = new BitmapFactory.Options();
+    	options.inSampleSize = 100;
+        Bitmap bitmap = BitmapFactory.decodeResource(Robolectric.application.getResources(), R.drawable.an_image, options);
+        assertEquals(true, shadowOf(bitmap).getDescription().contains("inSampleSize=100"));
+    }
+    
+    @Test
     public void decodeFile_shouldGetWidthAndHeightFromHints() throws Exception {
         ShadowBitmapFactory.provideWidthAndHeightHints("/some/file.jpg", 123, 456);
 
diff --git a/src/test/java/com/xtremelabs/robolectric/shadows/TextUtilsTest.java b/src/test/java/com/xtremelabs/robolectric/shadows/TextUtilsTest.java
index 197c09e..ed57527 100644
--- a/src/test/java/com/xtremelabs/robolectric/shadows/TextUtilsTest.java
+++ b/src/test/java/com/xtremelabs/robolectric/shadows/TextUtilsTest.java
@@ -3,11 +3,12 @@
 import android.text.TextUtils;
 import com.xtremelabs.robolectric.WithTestDefaultsRunner;
 import java.util.Arrays;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
 
 @RunWith(WithTestDefaultsRunner.class)
 public class TextUtilsTest {
@@ -37,4 +38,19 @@
         assertThat(TextUtils.isDigitsOnly("123456"), equalTo(true));
         assertThat(TextUtils.isDigitsOnly("124a56"), equalTo(false));
     }
+    
+    @Test
+    public void testSplit() {
+    	//empty
+    	assertThat(TextUtils.split("", ",").length, equalTo(0));
+    	
+    	//one value
+    	assertArrayEquals(TextUtils.split("abc", ","), new String[]{"abc"});
+    	
+    	//two values
+    	assertArrayEquals(TextUtils.split("abc,def", ","), new String[]{"abc", "def"});
+    	
+    	//two values with space
+    	assertArrayEquals(TextUtils.split("abc, def", ","), new String[]{"abc", " def"});
+   }
 }