This commit is contained in:
2022-05-29 11:01:03 +08:00 committed by GitHub
parent ffbfdabb3a
commit c5b527f450
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 10 deletions

View file

@ -466,6 +466,25 @@ class MediaDetailFragmentUnitTests {
Assert.assertEquals(map, method.invoke(fragment, s))
}
@Test
@Throws(Exception::class)
fun testGetDescriptionsWithLongSpaces() {
`when`(media.filename).thenReturn("")
val method: Method = MediaDetailFragment::class.java.getDeclaredMethod("getDescriptions", String::class.java)
method.isAccessible = true
val s = "=={{int:filedesc}}==\n" +
"{{Information\n" +
"|Description ={{en|1=The interior of Sacred Heart RC Church, Wimbledon, London.}}\n" +
"|Source ={{own}}\n" +
"|Author =[[User:Diliff|Diliff]]\n" +
"|Date =2015-02-17\n" +
"|Permission ={{Diliff/Licensing}}\n" +
"|other_versions=\n" +
"}}"
val map = linkedMapOf("en" to "The interior of Sacred Heart RC Church, Wimbledon, London.")
Assert.assertEquals(map, method.invoke(fragment, s))
}
@Test
@Throws(Exception::class)
fun testGetDescriptionList() {