mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 05:13:53 +01:00
Add PageTitle class to canonicalize page names
This commit is contained in:
parent
691acbf983
commit
d241d36d66
12 changed files with 234 additions and 50 deletions
23
app/src/androidTest/java/fr/free/nrw/commons/MediaTest.java
Normal file
23
app/src/androidTest/java/fr/free/nrw/commons/MediaTest.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
||||
// TODO: use Robolectric and make it runnable without a connected device
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class MediaTest {
|
||||
@Test public void displayTitleShouldStripExtension() {
|
||||
Media m = new Media("File:Example.jpg");
|
||||
Assert.assertThat(m.getDisplayTitle(), is("Example"));
|
||||
}
|
||||
|
||||
@Test public void displayTitleShouldUseSpaceForUnderscore() {
|
||||
Media m = new Media("File:Example 1_2.jpg");
|
||||
Assert.assertThat(m.getDisplayTitle(), is("Example 1 2"));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue