Search in sources :

Example 71 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class VideoEditorAPITest method testAudioTrack.

/**
     * To test creation of Audio Track
     */
@LargeTest
public void testAudioTrack() throws Exception {
    final String audioFileName = INPUT_FILE_PATH + "AACLC_48KHz_256Kbps_s_1_17.3gp";
    final AudioTrack audioTrack = mVideoEditorHelper.createAudio(mVideoEditor, "audioTrack", audioFileName);
    mVideoEditor.addAudioTrack(audioTrack);
    assertEquals("Audio Track Item Duration", audioTrack.getDuration(), audioTrack.getTimelineDuration());
    assertEquals("Audio Track Start Time", 0, audioTrack.getStartTime());
    assertFalse("Audio Track is Looping", audioTrack.isLooping());
    audioTrack.getVolume();
    assertFalse("Audio Track Ducking is Disabled", audioTrack.isDuckingEnabled());
    assertTrue("Audio Track Filename", audioTrack.getFilename().equals(audioFileName));
    assertEquals("Audio Ducking Threshold", 0, audioTrack.getDuckingThreshhold());
    assertFalse("Audio Track Mute", audioTrack.isMuted());
    audioTrack.getDuckedTrackVolume();
}
Also used : AudioTrack(android.media.videoeditor.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 72 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class VideoEditorAPITest method testFrameOverlayInvalidTimeImage.

/**
     * To test  Frame Overlay for  Media Image Item :Invalid StartTime and
     * Duration
     */
@LargeTest
public void testFrameOverlayInvalidTimeImage() throws Exception {
    final String videoItemFilename1 = INPUT_FILE_PATH + "IMG_640x480.jpg";
    final String overlayFile1 = INPUT_FILE_PATH + "IMG_640x480_Overlay1.png";
    boolean flagForException = false;
    final MediaImageItem mediaImageItem1 = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", videoItemFilename1, 10000, MediaItem.RENDERING_MODE_BLACK_BORDER);
    mVideoEditor.addMediaItem(mediaImageItem1);
    try {
        final Bitmap mBitmap = mVideoEditorHelper.getBitmap(overlayFile1, 640, 480);
        mVideoEditorHelper.createOverlay(mediaImageItem1, "overlayId1", mBitmap, 400000000, 2000);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Overlay With Invalid Start Time", flagForException);
    flagForException = false;
    try {
        final Bitmap mBitmap = mVideoEditorHelper.getBitmap(overlayFile1, 640, 480);
        mVideoEditorHelper.createOverlay(mediaImageItem1, "overlayId2", mBitmap, -1, 2000);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Overlay With Invalid Start Time", flagForException);
    flagForException = false;
    try {
        final Bitmap mBitmap = mVideoEditorHelper.getBitmap(overlayFile1, 640, 480);
        mVideoEditorHelper.createOverlay(mediaImageItem1, "overlayId3", mBitmap, 2000, -1);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Overlay With Invalid Start Time", flagForException);
}
Also used : Bitmap(android.graphics.Bitmap) MediaImageItem(android.media.videoeditor.MediaImageItem) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 73 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class VideoEditorAPITest method testNullAPIs.

/**
     * To test: NULL arguments to the Video Editor APIs
     *
     * @throws Exception
     */
@LargeTest
public void testNullAPIs() throws Exception {
    final String videoItemFilename1 = INPUT_FILE_PATH + "H264_BP_640x480_30fps_256kbps_1_17.mp4";
    final String maskFilename = INPUT_FILE_PATH + "IMG_640x480_Overlay1.png";
    final String audioFileName = INPUT_FILE_PATH + "AACLC_48KHz_256Kbps_s_1_17.3gp";
    boolean flagForException = false;
    try {
        mVideoEditor.addAudioTrack(null);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Video Editor with null Audio Track", flagForException);
    flagForException = false;
    try {
        mVideoEditor.addMediaItem(null);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Video Editor with NULL Image Item ", flagForException);
    flagForException = false;
    try {
        mVideoEditor.addMediaItem(null);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Video Editor with NULL Video Item ", flagForException);
    MediaVideoItem mediaVideoItem1 = null;
    try {
        mediaVideoItem1 = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", videoItemFilename1, MediaItem.RENDERING_MODE_BLACK_BORDER);
    } catch (IllegalArgumentException e) {
        assertTrue("Cannot Create Video Item", false);
    }
    mediaVideoItem1.setExtractBoundaries(0, 15000);
    mVideoEditor.addMediaItem(mediaVideoItem1);
    flagForException = false;
    try {
        mediaVideoItem1.addEffect(null);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Video with null effect ", flagForException);
    flagForException = false;
    try {
        mediaVideoItem1.addOverlay(null);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Video with null overlay ", flagForException);
    final MediaImageItem mediaImageItem = mVideoEditorHelper.createMediaItem(mVideoEditor, "m2", maskFilename, 10000, MediaItem.RENDERING_MODE_BLACK_BORDER);
    mediaImageItem.setDuration(15000);
    mVideoEditor.addMediaItem(mediaImageItem);
    flagForException = false;
    try {
        mediaImageItem.addEffect(null);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Image with null effect ", flagForException);
    flagForException = false;
    try {
        mediaImageItem.addOverlay(null);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Image with null overlay ", flagForException);
    final AudioTrack audioTrack = mVideoEditorHelper.createAudio(mVideoEditor, "audioTrack", audioFileName);
    mVideoEditor.addAudioTrack(audioTrack);
    flagForException = false;
    try {
        mVideoEditor.addTransition(null);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Added null transition ", flagForException);
    flagForException = false;
    try {
        mVideoEditor.addTransition(null);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Added null transition ", flagForException);
}
Also used : MediaVideoItem(android.media.videoeditor.MediaVideoItem) MediaImageItem(android.media.videoeditor.MediaImageItem) AudioTrack(android.media.videoeditor.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 74 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class CameraFunctionalTest method testFunctionalCameraFlashModes.

/**
     * Functional test iterating on the various flash modes (on, off, auto, torch)
     */
@LargeTest
public void testFunctionalCameraFlashModes() throws Exception {
    try {
        SurfaceHolder surfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
        Parameters params = mCameraTestHelper.getCameraParameters();
        List<String> supportedFlashModes = params.getSupportedFlashModes();
        assertNotNull("No flash modes supported", supportedFlashModes);
        for (int i = 0; i < supportedFlashModes.size(); i++) {
            runOnLooper(new Runnable() {

                @Override
                public void run() {
                    mCameraTestHelper.setupCameraTest();
                }
            });
            Log.v(TAG, "Setting flash mode to " + supportedFlashModes.get(i));
            params.setFlashMode(supportedFlashModes.get(i));
            mCameraTestHelper.setParameters(params);
            mCameraTestHelper.startCameraPreview(surfaceHolder);
            mCameraTestHelper.capturePhoto();
        }
        mCameraTestHelper.cleanupTestImages();
    } catch (Exception e) {
        Log.e(TAG, e.toString());
        fail("Camera flash mode test Exception");
    }
}
Also used : SurfaceHolder(android.view.SurfaceHolder) Parameters(android.hardware.Camera.Parameters) IOException(java.io.IOException) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 75 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class CameraFunctionalTest method testFunctionalCameraWhiteBalance.

/**
     * Functional test iterating on the various white balances (auto, daylight, cloudy, etc.)
     */
@LargeTest
public void testFunctionalCameraWhiteBalance() throws Exception {
    try {
        SurfaceHolder surfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
        Parameters params = mCameraTestHelper.getCameraParameters();
        List<String> supportedWhiteBalance = params.getSupportedWhiteBalance();
        assertNotNull("No white balance modes supported", supportedWhiteBalance);
        for (int i = 0; i < supportedWhiteBalance.size(); i++) {
            runOnLooper(new Runnable() {

                @Override
                public void run() {
                    mCameraTestHelper.setupCameraTest();
                }
            });
            Log.v(TAG, "Setting white balance to: " + supportedWhiteBalance.get(i));
            params.setWhiteBalance(supportedWhiteBalance.get(i));
            mCameraTestHelper.setParameters(params);
            mCameraTestHelper.startCameraPreview(surfaceHolder);
            mCameraTestHelper.capturePhoto();
        }
        mCameraTestHelper.cleanupTestImages();
    } catch (Exception e) {
        Log.e(TAG, e.toString());
        fail("Camera focus modes test Exception");
    }
}
Also used : SurfaceHolder(android.view.SurfaceHolder) Parameters(android.hardware.Camera.Parameters) IOException(java.io.IOException) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

LargeTest (android.test.suitebuilder.annotation.LargeTest)1579 AudioEffect (android.media.audiofx.AudioEffect)234 AudioTrack (android.media.AudioTrack)222 View (android.view.View)147 File (java.io.File)144 MediaVideoItem (android.media.videoeditor.MediaVideoItem)115 Uri (android.net.Uri)99 ListView (android.widget.ListView)72 Cursor (android.database.Cursor)69 Bitmap (android.graphics.Bitmap)62 Instrumentation (android.app.Instrumentation)61 MediaPlayer (android.media.MediaPlayer)60 WifiConfiguration (android.net.wifi.WifiConfiguration)53 SurfaceHolder (android.view.SurfaceHolder)50 MediaImageItem (android.media.videoeditor.MediaImageItem)49 IOException (java.io.IOException)48 AudioManager (android.media.AudioManager)42 LegacyVpnInfo (com.android.internal.net.LegacyVpnInfo)42 VpnProfile (com.android.internal.net.VpnProfile)42 Request (android.app.DownloadManager.Request)41