tests removed
This commit is contained in:
parent
f7ad4594fd
commit
7020bcfe74
|
|
@ -1,30 +1,17 @@
|
|||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'signing'
|
||||
//apply from: '../.publishing/sonatype.gradle'
|
||||
|
||||
archivesBaseName = 'android-crop'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion '23.0.1'
|
||||
buildToolsVersion '23.0.2'
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 10
|
||||
targetSdkVersion 22
|
||||
|
||||
testApplicationId 'com.soundcloud.android.crop.test'
|
||||
testInstrumentationRunner 'android.test.InstrumentationTestRunner'
|
||||
targetSdkVersion 23
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:support-annotations:23.0.1'
|
||||
compile 'com.android.support:support-v4:23.0.1'
|
||||
androidTestCompile 'com.squareup:fest-android:1.0.7'
|
||||
androidTestCompile 'com.android.support:support-v4:23.0.1'
|
||||
androidTestCompile 'org.mockito:mockito-core:1.9.5'
|
||||
androidTestCompile 'com.google.dexmaker:dexmaker:1.0'
|
||||
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.0'
|
||||
compile 'com.android.support:support-annotations:23.1.1'
|
||||
compile 'com.android.support:support-v4:23.1.1'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
package com.soundcloud.android.crop;
|
||||
|
||||
import android.test.InstrumentationTestCase;
|
||||
|
||||
public class BaseTestCase extends InstrumentationTestCase {
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
// Work around dexmaker issue when running tests on Android 4.3
|
||||
System.setProperty("dexmaker.dexcache",
|
||||
getInstrumentation().getTargetContext().getCacheDir().getPath());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
package com.soundcloud.android.crop;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.fest.assertions.api.ANDROID;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.provider.MediaStore;
|
||||
|
||||
public class CropBuilderTest extends BaseTestCase {
|
||||
|
||||
private Activity activity;
|
||||
private Crop builder;
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
activity = mock(Activity.class);
|
||||
when(activity.getPackageName()).thenReturn("com.example");
|
||||
|
||||
builder = Crop.of(Uri.parse("image:input"), Uri.parse("image:output"));
|
||||
}
|
||||
|
||||
public void testInputUriSetAsData() {
|
||||
ANDROID.assertThat(builder.getIntent(activity)).hasData("image:input");
|
||||
}
|
||||
|
||||
public void testOutputUriSetAsExtra() {
|
||||
Intent intent = builder.getIntent(activity);
|
||||
Uri output = intent.getParcelableExtra(MediaStore.EXTRA_OUTPUT);
|
||||
|
||||
assertThat(output.toString()).isEqualTo("image:output");
|
||||
}
|
||||
|
||||
public void testAspectRatioSetAsExtras() {
|
||||
builder.withAspect(16, 10);
|
||||
|
||||
Intent intent = builder.getIntent(activity);
|
||||
|
||||
assertThat(intent.getIntExtra("aspect_x", 0)).isEqualTo(16);
|
||||
assertThat(intent.getIntExtra("aspect_y", 0)).isEqualTo(10);
|
||||
}
|
||||
|
||||
public void testFixedAspectRatioSetAsExtras() {
|
||||
builder.asSquare();
|
||||
|
||||
Intent intent = builder.getIntent(activity);
|
||||
|
||||
assertThat(intent.getIntExtra("aspect_x", 0)).isEqualTo(1);
|
||||
assertThat(intent.getIntExtra("aspect_y", 0)).isEqualTo(1);
|
||||
}
|
||||
|
||||
public void testMaxSizeSetAsExtras() {
|
||||
builder.withMaxSize(400, 300);
|
||||
|
||||
Intent intent = builder.getIntent(activity);
|
||||
|
||||
assertThat(intent.getIntExtra("max_x", 0)).isEqualTo(400);
|
||||
assertThat(intent.getIntExtra("max_y", 0)).isEqualTo(300);
|
||||
}
|
||||
|
||||
public void testBuildsIntentWithMultipleOptions() {
|
||||
builder.asSquare().withMaxSize(200, 200);
|
||||
|
||||
Intent intent = builder.getIntent(activity);
|
||||
|
||||
assertThat(intent.getIntExtra("aspect_x", 0)).isEqualTo(1);
|
||||
assertThat(intent.getIntExtra("aspect_y", 0)).isEqualTo(1);
|
||||
assertThat(intent.getIntExtra("max_x", 0)).isEqualTo(200);
|
||||
assertThat(intent.getIntExtra("max_y", 0)).isEqualTo(200);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue