Skip to content
Snippets Groups Projects
Commit 1442e0f5 authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Fix tests compilation

parent c2450746
No related branches found
No related tags found
1 merge request!1772Get rid of a lot of memory leaks
......@@ -2,18 +2,29 @@ package org.videolan.vlc.gui
import android.content.Intent
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.*
import androidx.test.espresso.action.CoordinatesProvider
import androidx.test.espresso.action.GeneralLocation
import androidx.test.espresso.action.GeneralSwipeAction
import androidx.test.espresso.action.Press
import androidx.test.espresso.action.Swipe
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.espresso.matcher.ViewMatchers.assertThat
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.rule.ActivityTestRule
import org.hamcrest.Matchers.equalTo
import org.junit.Rule
import org.junit.Test
import org.videolan.medialibrary.interfaces.Medialibrary
import org.videolan.vlc.*
import org.videolan.vlc.BaseUITest
import org.videolan.vlc.R
import org.videolan.vlc.databinding.AudioBrowserItemBinding
import org.videolan.vlc.findFirstPosition
import org.videolan.vlc.gui.audio.AudioBrowserAdapter
import org.videolan.vlc.gui.audio.AudioBrowserFragment
import org.videolan.vlc.sizeOfAtLeast
import org.videolan.vlc.withMediaItem
import org.videolan.vlc.withRecyclerView
class HeaderMediaListActivityUITest: BaseUITest() {
@Rule
......@@ -27,9 +38,9 @@ class HeaderMediaListActivityUITest: BaseUITest() {
Thread.sleep(3 * 1000)
val ml = Medialibrary.getInstance()
val pl = ml.createPlaylist("test", true)
pl.append(ml.getPagedVideos(Medialibrary.SORT_DEFAULT, false, true, 5, 0).map { it.id })
pl.append(ml.getPagedAudio(Medialibrary.SORT_DEFAULT, false, true, 5, 0).map { it.id })
val pl = ml.createPlaylist("test", true, false)
pl.append(ml.getPagedVideos(Medialibrary.SORT_DEFAULT, false, true, false, 5, 0).map { it.id })
pl.append(ml.getPagedAudio(Medialibrary.SORT_DEFAULT, false, true, false, 5, 0).map { it.id })
val intent = Intent().apply {
putExtra(AudioBrowserFragment.TAG_ITEM, pl)
......
......@@ -5,23 +5,38 @@ import android.widget.EditText
import androidx.test.espresso.Espresso
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu
import androidx.test.espresso.action.ViewActions.*
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.action.ViewActions.longClick
import androidx.test.espresso.action.ViewActions.typeTextIntoFocusedView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.DrawerActions.open
import androidx.test.espresso.matcher.RootMatchers.isPlatformPopup
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.espresso.matcher.ViewMatchers.assertThat
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
import androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.rule.ActivityTestRule
import com.google.android.material.internal.NavigationMenuItemView
import org.hamcrest.Matchers.*
import org.hamcrest.Matchers.allOf
import org.hamcrest.Matchers.anyOf
import org.hamcrest.Matchers.equalTo
import org.hamcrest.Matchers.instanceOf
import org.hamcrest.Matchers.notNullValue
import org.junit.After
import org.junit.Rule
import org.junit.Test
import org.videolan.medialibrary.interfaces.Medialibrary
import org.videolan.vlc.*
import org.videolan.vlc.gui.dialogs.SavePlaylistDialog
import org.videolan.tools.CoroutineContextProvider
import org.videolan.medialibrary.interfaces.media.Playlist
import org.videolan.resources.EXTRA_TARGET
import org.videolan.tools.CoroutineContextProvider
import org.videolan.vlc.BaseUITest
import org.videolan.vlc.R
import org.videolan.vlc.gui.dialogs.SavePlaylistDialog
import org.videolan.vlc.sizeOfAtLeast
import org.videolan.vlc.util.TestCoroutineContextProvider
import org.videolan.vlc.withCount
import org.videolan.vlc.withRecyclerView
class PlaylistFragmentUITest: BaseUITest() {
@Rule
......@@ -43,14 +58,14 @@ class PlaylistFragmentUITest: BaseUITest() {
@After
fun resetData() {
Medialibrary.getInstance().playlists.map { it.delete() }
Medialibrary.getInstance().getPlaylists(Playlist.Type.All, false).map { it.delete() }
}
private fun createDummyPlaylist() {
val ml = Medialibrary.getInstance()
val pl = ml.createPlaylist(DUMMY_PLAYLIST, true)
pl.append(ml.getPagedVideos(Medialibrary.SORT_DEFAULT, false, true, 5, 0).map { it.id })
pl.append(ml.getPagedAudio(Medialibrary.SORT_DEFAULT, false, true, 5, 0).map { it.id })
val pl = ml.createPlaylist(DUMMY_PLAYLIST, true, false)
pl.append(ml.getPagedVideos(Medialibrary.SORT_DEFAULT, false, true, false, 5, 0).map { it.id })
pl.append(ml.getPagedAudio(Medialibrary.SORT_DEFAULT, false, true, false, 5, 0).map { it.id })
}
@Test
......
......@@ -37,17 +37,6 @@ class PreferencesSubtitlesUITest: BasePreferenceUITest() {
checkModeChanged(key, "10", "16", MAP_SUBTITLE_SIZE)
}
@Test
fun checkSubtitleColorSetting() {
val key = "subtitles_color"
checkModeChanged(key, "65535", "16777215", MAP_SUBTITLE_COLOR)
checkModeChanged(key, "16776960", "16777215", MAP_SUBTITLE_COLOR)
checkModeChanged(key, "65280", "16777215", MAP_SUBTITLE_COLOR)
checkModeChanged(key, "16711935", "16777215", MAP_SUBTITLE_COLOR)
checkModeChanged(key, "12632256", "16777215", MAP_SUBTITLE_COLOR)
checkModeChanged(key, "16777215", "16777215", MAP_SUBTITLE_COLOR)
}
@Test
fun checkSubtitleBackgroundSetting() {
......@@ -71,10 +60,6 @@ class PreferencesSubtitlesUITest: BasePreferenceUITest() {
companion object {
val MAP_SUBTITLE_SIZE = mapOf("19" to R.string.subtitles_size_small, "16" to R.string.subtitles_size_normal, "13" to R.string.subtitles_size_big, "10" to R.string.subtitles_size_huge)
val MAP_SUBTITLE_COLOR = mapOf(
"16777215" to R.string.subtitles_color_white, "12632256" to R.string.subtitles_color_gray, "16711935" to R.string.subtitles_color_pink,
"65535" to R.string.subtitles_color_blue, "16776960" to R.string.subtitles_color_yellow, "65280" to R.string.subtitles_color_green
)
val MAP_SUBTITLE_ENCODING = mapOf(
"" to "Default (Windows-1252)", "UTF-8" to "Universal (UTF-8)"
)
......
......@@ -40,6 +40,7 @@ object DpadHelper {
Direction.LEFT -> device.pressDPadLeft()
Direction.UP -> device.pressDPadUp()
Direction.RIGHT -> device.pressDPadRight()
else -> {}
}
if (i < nbTimes - 1) SystemClock.sleep(300)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment