You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.5 KiB
Kotlin
29 lines
1.5 KiB
Kotlin
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package org.mozilla.fenix.ext
|
|
|
|
import mozilla.components.browser.state.state.content.DownloadState
|
|
import org.junit.Test
|
|
|
|
import org.junit.Assert.assertEquals
|
|
import org.mozilla.fenix.R
|
|
import org.mozilla.fenix.library.downloads.DownloadItem
|
|
|
|
class DownloadItemKtTest {
|
|
@Test
|
|
fun getIcon() {
|
|
val downloadItem = DownloadItem("0", "MyAwesomeFile", "", "", "image/png", DownloadState.Status.COMPLETED)
|
|
|
|
assertEquals(R.drawable.ic_file_type_image, downloadItem.getIcon())
|
|
assertEquals(R.drawable.ic_file_type_audio_note, downloadItem.copy(contentType = "audio/mp3").getIcon())
|
|
assertEquals(R.drawable.ic_file_type_video, downloadItem.copy(contentType = "video/mp4").getIcon())
|
|
assertEquals(R.drawable.ic_file_type_document, downloadItem.copy(contentType = "text/csv").getIcon())
|
|
assertEquals(R.drawable.ic_file_type_zip, downloadItem.copy(contentType = "application/gzip").getIcon())
|
|
assertEquals(R.drawable.ic_file_type_apk, downloadItem.copy(contentType = null, fileName = "Fenix.apk").getIcon())
|
|
assertEquals(R.drawable.ic_file_type_zip, downloadItem.copy(contentType = null, fileName = "Fenix.zip").getIcon())
|
|
assertEquals(R.drawable.ic_file_type_default, downloadItem.copy(contentType = null, fileName = null).getIcon())
|
|
}
|
|
}
|