Merge "Fix for TabHost_TabSpecTest"
diff --git a/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java b/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
index 1af26af..19f3f46 100755
--- a/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
@@ -16,9 +16,6 @@
package android.graphics.cts;
-import com.android.cts.stub.R;
-
-import dalvik.annotation.KnownFailure;
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargetNew;
@@ -28,13 +25,7 @@
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
import android.graphics.Typeface;
-import android.graphics.Bitmap.Config;
import android.os.ParcelFileDescriptor;
import android.test.AndroidTestCase;
@@ -185,29 +176,6 @@
Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), "samplefont.ttf");
assertNotNull(typeface);
-
- Bitmap bitmap = Bitmap.createBitmap(100, 100, Config.ARGB_8888);
- bitmap.eraseColor(Color.BLACK);
- Canvas canvas = new Canvas(bitmap);
- Paint p = new Paint();
- p.setTypeface(typeface);
- p.setColor(Color.WHITE);
- p.setTextAlign(Paint.Align.CENTER);
- p.setTextSize(50);
- p.setFlags(0); // clear all flags (not sure what defaults flags are set)
- canvas.drawText("test", bitmap.getWidth() / 2, 3 * bitmap.getHeight() / 4 , p);
-
- BitmapFactory.Options opt = new BitmapFactory.Options();
- opt.inScaled = false;
- Bitmap expected = BitmapFactory.decodeResource(
- getContext().getResources(), R.drawable.typeface_test, opt);
- assertEquals(expected.getWidth(), bitmap.getWidth());
- assertEquals(expected.getHeight(), bitmap.getHeight());
- for (int y = 0; y < bitmap.getHeight(); y++) {
- for (int x = 0; x < bitmap.getWidth(); x++) {
- assertEquals(expected.getPixel(x, y), bitmap.getPixel(x, y));
- }
- }
}
@TestTargetNew(
@@ -226,29 +194,6 @@
File file = new File(obtainPath());
Typeface typeface = Typeface.createFromFile(file);
assertNotNull(typeface);
-
- Bitmap bitmap = Bitmap.createBitmap(100, 100, Config.ARGB_8888);
- bitmap.eraseColor(Color.BLACK);
- Canvas canvas = new Canvas(bitmap);
- Paint p = new Paint();
- p.setTypeface(typeface);
- p.setColor(Color.WHITE);
- p.setTextAlign(Paint.Align.CENTER);
- p.setTextSize(50);
- p.setFlags(0); // clear all flags (not sure what defaults flags are set)
- canvas.drawText("test", bitmap.getWidth() / 2, 3 * bitmap.getHeight() / 4, p);
-
- BitmapFactory.Options opt = new BitmapFactory.Options();
- opt.inScaled = false;
- Bitmap expected = BitmapFactory.decodeResource(getContext().getResources(),
- R.drawable.typeface_test, opt);
- assertEquals(expected.getWidth(), bitmap.getWidth());
- assertEquals(expected.getHeight(), bitmap.getHeight());
- for (int y = 0; y < bitmap.getHeight(); y++) {
- for (int x = 0; x < bitmap.getWidth(); x++) {
- assertEquals(expected.getPixel(x, y), bitmap.getPixel(x, y));
- }
- }
}
@TestTargetNew(
@@ -267,29 +212,6 @@
Typeface typeface = Typeface.createFromFile(obtainPath());
assertNotNull(typeface);
-
- Bitmap bitmap = Bitmap.createBitmap(100, 100, Config.ARGB_8888);
- bitmap.eraseColor(Color.BLACK);
- Canvas canvas = new Canvas(bitmap);
- Paint p = new Paint();
- p.setTypeface(typeface);
- p.setColor(Color.WHITE);
- p.setTextAlign(Paint.Align.CENTER);
- p.setTextSize(50);
- p.setFlags(0); // clear all flags (not sure what defaults flags are set)
- canvas.drawText("test", bitmap.getWidth() / 2, 3 * bitmap.getHeight() / 4, p);
-
- BitmapFactory.Options opt = new BitmapFactory.Options();
- opt.inScaled = false;
- Bitmap expected = BitmapFactory.decodeResource(getContext().getResources(),
- R.drawable.typeface_test, opt);
- assertEquals(expected.getWidth(), bitmap.getWidth());
- assertEquals(expected.getHeight(), bitmap.getHeight());
- for (int y = 0; y < bitmap.getHeight(); y++) {
- for (int x = 0; x < bitmap.getWidth(); x++) {
- assertEquals(expected.getPixel(x, y), bitmap.getPixel(x, y));
- }
- }
}
private String obtainPath() throws IOException {
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerStreamingTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerStreamingTest.java
index 7d2bc81..3388b9d 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerStreamingTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerStreamingTest.java
@@ -25,6 +25,89 @@
public class MediaPlayerStreamingTest extends MediaPlayerTestBase {
private CtsTestServer mServer;
+ // Streaming RTSP video from YouTube
+ // TODO: Enable RTSP tests once network issues are sorted out.
+ /*
+ public void testRTSP_H263_AMR_Video1() throws Exception {
+ playVideoTest("rtsp://v2.cache7.c.youtube.com/video.3gp?cid=0x271de9756065677e"
+ + "&fmt=13&user=android-device-test", 176, 144);
+ }
+ public void testRTSP_H263_AMR_Video2() throws Exception {
+ playVideoTest("rtsp://v2.cache7.c.youtube.com/video.3gp?cid=0xc80658495af60617"
+ + "&fmt=13&user=android-device-test", 176, 144);
+ }
+
+ public void testRTSP_MPEG4SP_AAC_Video1() throws Exception {
+ playVideoTest("rtsp://v2.cache7.c.youtube.com/video.3gp?cid=0x271de9756065677e"
+ + "&fmt=17&user=android-device-test", 176, 144);
+ }
+ public void testRTSP_MPEG4SP_AAC_Video2() throws Exception {
+ playVideoTest("rtsp://v2.cache7.c.youtube.com/video.3gp?cid=0xc80658495af60617"
+ + "&fmt=17&user=android-device-test", 176, 144);
+ }
+
+ public void testRTSP_H264Base_AAC_Video1() throws Exception {
+ playVideoTest("rtsp://v2.cache7.c.youtube.com/video.3gp?cid=0x271de9756065677e"
+ + "&fmt=18&user=android-device-test", 176, 144);
+ }
+ public void testRTSP_H264Base_AAC_Video2() throws Exception {
+ playVideoTest("rtsp://v2.cache7.c.youtube.com/video.3gp?cid=0xc80658495af60617"
+ + "&fmt=18&user=android-device-test", 176, 144);
+ }
+ */
+
+ // Streaming HTTP video from YouTube
+ public void testHTTP_H263_AMR_Video1() throws Exception {
+ playVideoTest("http://v20.lscache8.c.youtube.com/videoplayback?id=271de9756065677e"
+ + "&itag=13&ip=0.0.0.0&ipbits=0&expire=999999999999999999"
+ + "&sparams=ip,ipbits,expire,ip,ipbits,expire,id,itag"
+ + "&signature=372FA4C532AA49D14EAF049BCDA66460EEE161E9"
+ + ".6D8BF096B73B7A68A7032CA8685053CFB498D30A"
+ + "&key=test_key1&user=android-device-test", 176, 144);
+ }
+ public void testHTTP_H263_AMR_Video2() throws Exception {
+ playVideoTest("http://v20.lscache8.c.youtube.com/videoplayback?id=c80658495af60617"
+ + "&itag=13&ip=0.0.0.0&ipbits=0&expire=999999999999999999"
+ + "&sparams=ip,ipbits,expire,ip,ipbits,expire,id,itag"
+ + "&signature=191FCD5C4B7400065C20845D7AC2B437B1291F26"
+ + ".66F8B8D7EFF7F144141AC67E8E35E078468CE6FB"
+ + "&key=test_key1&user=android-device-test", 176, 144);
+ }
+
+ public void testHTTP_MPEG4SP_AAC_Video1() throws Exception {
+ playVideoTest("http://v20.lscache8.c.youtube.com/videoplayback?id=271de9756065677e"
+ + "&itag=17&ip=0.0.0.0&ipbits=0&expire=999999999999999999"
+ + "&sparams=ip,ipbits,expire,ip,ipbits,expire,id,itag"
+ + "&signature=3DCD3F79E045F95B6AF661765F046FB0440FF016"
+ + ".06A42661B3AF6BAF046F012549CC9BA34EBC80A9"
+ + "&key=test_key1&user=android-device-test", 176, 144);
+ }
+ public void testHTTP_MPEG4SP_AAC_Video2() throws Exception {
+ playVideoTest("http://v20.lscache8.c.youtube.com/videoplayback?id=c80658495af60617"
+ + "&itag=17&ip=0.0.0.0&ipbits=0&expire=999999999999999999"
+ + "&sparams=ip,ipbits,expire,ip,ipbits,expire,id,itag"
+ + "&signature=242B7AEF3AB38519F593203FDEF420E2A585DA6E"
+ + ".4A57C03AF6859FE4694CD69C3225E386373A98B0"
+ + "&key=test_key1&user=android-device-test", 176, 144);
+ }
+
+ public void testHTTP_H264Base_AAC_Video1() throws Exception {
+ playVideoTest("http://v20.lscache8.c.youtube.com/videoplayback?id=271de9756065677e"
+ + "&itag=18&ip=0.0.0.0&ipbits=0&expire=999999999999999999"
+ + "&sparams=ip,ipbits,expire,ip,ipbits,expire,id,itag"
+ + "&signature=1219C2B07AF0638C27916307A6093C0E43CB894E"
+ + ".126B6B916BD57157782738AA7C03E59F21DBC168"
+ + "&key=test_key1&user=android-device-test", 480, 270);
+ }
+ public void testHTTP_H264Base_AAC_Video2() throws Exception {
+ playVideoTest("http://v20.lscache8.c.youtube.com/videoplayback?id=c80658495af60617"
+ + "&itag=18&ip=0.0.0.0&ipbits=0&expire=999999999999999999"
+ + "&sparams=ip,ipbits,expire,ip,ipbits,expire,id,itag"
+ + "&signature=61674BC069F2C812A18C390DE785CECD296228C7"
+ + ".11F5FCE823FB8FA31269A06A483C2F9B2C22F357"
+ + "&key=test_key1&user=android-device-test", 480, 270);
+ }
+
// Streaming audio from local HTTP server
public void testPlayMp3Stream1() throws Throwable {
localHttpAudioStreamTest("ringer.mp3", false, false);
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
index 660b539..1c3b28a 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
@@ -100,11 +100,20 @@
}
}
- protected void playVideoTest(int resid, final int width, final int height) throws Exception {
+ protected void playVideoTest(String path, int width, int height) throws Exception {
+ mMediaPlayer.setDataSource(path);
+ playLoadedVideo(width, height);
+ }
+
+ protected void playVideoTest(int resid, int width, int height) throws Exception {
+ loadResource(resid);
+ playLoadedVideo(width, height);
+ }
+
+ private void playLoadedVideo(final int width, final int height) throws Exception {
final float leftVolume = 0.5f;
final float rightVolume = 0.5f;
- loadResource(resid);
mMediaPlayer.setDisplay(getActivity().getSurfaceHolder());
mMediaPlayer.setScreenOnWhilePlaying(true);
mMediaPlayer.setOnVideoSizeChangedListener(new MediaPlayer.OnVideoSizeChangedListener() {