-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into issue/23-extract-callback-handler
- Loading branch information
Showing
4 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<lint> | ||
<issue id="InvalidPackage"> | ||
<ignore regexp="robolectric-2.4.jar" /> | ||
</issue> | ||
</lint> |
77 changes: 77 additions & 0 deletions
77
...sEditor/src/androidTest/java/org/wordpress/android/editor/EditorFragmentAbstractTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package org.wordpress.android.editor; | ||
|
||
import android.app.Activity; | ||
import android.text.Spanned; | ||
|
||
import com.android.volley.toolbox.ImageLoader; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.Robolectric; | ||
import org.robolectric.RobolectricTestRunner; | ||
import org.robolectric.annotation.Config; | ||
import org.wordpress.android.util.helpers.MediaFile; | ||
import org.wordpress.android.util.helpers.MediaGallery; | ||
|
||
@Config(emulateSdk = 18) | ||
@RunWith(RobolectricTestRunner.class) | ||
public class EditorFragmentAbstractTest { | ||
@Test | ||
public void testActivityMustImplementEditorFragmentListener() { | ||
// Host Activity must implement EditorFragmentListener, exception expected if not | ||
boolean didPassTest = false; | ||
Activity hostActivity = Robolectric.buildActivity(Activity.class).create().get(); | ||
EditorFragmentAbstract testFragment = new DefaultEditorFragment(); | ||
|
||
try { | ||
testFragment.onAttach(hostActivity); | ||
} catch (ClassCastException classCastException) { | ||
didPassTest = true; | ||
} | ||
|
||
Assert.assertTrue(didPassTest); | ||
} | ||
|
||
@Test | ||
public void testOnBackPressReturnsFalseByDefault() { | ||
// The default behavior of onBackPressed should return false | ||
Assert.assertFalse(new DefaultEditorFragment().onBackPressed()); | ||
} | ||
|
||
/** | ||
* Used to test default behavior of non-abstract methods. | ||
*/ | ||
public static class DefaultEditorFragment extends EditorFragmentAbstract { | ||
@Override | ||
public void setTitle(CharSequence text) { | ||
} | ||
|
||
@Override | ||
public void setContent(CharSequence text) { | ||
} | ||
|
||
@Override | ||
public CharSequence getTitle() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public CharSequence getContent() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void appendMediaFile(MediaFile mediaFile, String imageUrl, ImageLoader imageLoader) { | ||
} | ||
|
||
@Override | ||
public void appendGallery(MediaGallery mediaGallery) { | ||
} | ||
|
||
@Override | ||
public Spanned getSpannedContent() { | ||
return null; | ||
} | ||
} | ||
} |