#3780 Create media using a combination of Entities & MwQueryResult - construct media with an entity - move fields from media down to contribution - move dynamic fields outside of media - remove unused constructors - remove all unnecessary fetching of captions/descriptions - bump database version

This commit is contained in:
Sean Mac Gillicuddy 2020-05-29 14:30:10 +01:00
parent d85d11441d
commit e96b7f6f81
45 changed files with 927 additions and 1486 deletions

View file

@ -1,5 +1,6 @@
package fr.free.nrw.commons
import media
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@ -11,13 +12,15 @@ import org.robolectric.annotation.Config
class MediaTest {
@Test
fun displayTitleShouldStripExtension() {
val m = Media("File:Example.jpg")
val m = media(filename = "File:Example.jpg")
assertEquals("Example", m.displayTitle)
}
@Test
fun displayTitleShouldUseSpaceForUnderscore() {
val m = Media("File:Example 1_2.jpg")
val m = media(filename = "File:Example 1_2.jpg")
assertEquals("Example 1 2", m.displayTitle)
}
}