Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc-android
  • thresh/vlc-android
  • Dekans/vlc-android
  • robUx4/vlc-android
  • tguillem/vlc-android
  • Corbax/vlc-android
  • judeosby/vlc-android
  • chouquette/vlc-android
  • washingtonmurphy93/vlc-android
  • wipawanbeadklang540/vlc-android
  • xcorail/vlc-android
  • Aza/vlc-android
  • Skantes/vlc-android
  • filipjares/vlc-android
  • kazemihabib/vlc-android
  • amq10x/vlc-android
  • qadrian370/vlc-android
  • shivanshs9/vlc-android
  • vitaliyg2/vlc-android
  • orgads/vlc-android
  • rom1v/vlc-android
  • evidence/vlc-android
  • lk888/vlc-android
  • Klaus81/vlc-android
  • EwoutH/vlc-android
  • XilasZ/vlc-android
  • pawelpablo1975/vlc-android
  • uae2ae/vlc-android
  • Garf/vlc-android
  • abetatsunori7/vlc-android
  • ePirat/vlc-android
  • magsoft/vlc-android
  • quink/vlc-android
  • Ektos974/vlc-android
  • CymGen30/vlc-android
  • b1ue/vlc-android
  • alessiavalenti8/vlc-android
  • bars27101982/vlc-android
  • billybanda18/vlc-android
  • dklvip/vlc-android
  • sherylynn/vlc-android
  • ramcoach5/vlc-android
  • takise/vlc-android
  • peibolovedie/vlc-android
  • AMHeijboer/vlc-android
  • dahburj/vlc-android
  • gobennyb/vlc-android
  • masripmasrip824/vlc-android
  • bubu/vlc-android
  • tmk907/vlc-android
  • gorbahaaa/vlc-android
  • govind3321/vlc-android
  • jamieboyer42818/vlc-android
  • mrtakilapop/vlc-android
  • kazikarter90/vlc-android
  • chunyie771/vlc-android
  • nop404/vlc-android
  • hcalzazperz/vlc-android
  • zagwojtek69/vlc-android
  • nikonnick24/vlc-android
  • gmohiuddin215/vlc-android
  • stheinthan31/vlc-android
  • rogelioloreto29/vlc-android
  • philippestcyr5/vlc-android
  • Happyheather20/vlc-android
  • jimbobmcgee/vlc-android
  • mohwie/vlc-android
  • HeartBeat1608/vlc-android
  • jahan/vlc-android
  • Kevo1987/vlc-android
  • rrangel3584/vlc-android
  • xfridrich/vlc-android
  • devswami23/vlc-android
  • Isira-Seneviratne/vlc-android
  • PartyPhone22/vlc-android
  • kmajeshkrishnan/vlc-android
  • ramirotorresjr/vlc-android
  • aaronsalas469/vlc-android
  • arnan.np31/vlc-android
  • hkosacki/vlc-android
  • mg0691872/vlc-android
  • louregni/vlc-android
  • ritmapp/vlc-android
  • diegofn/vlc-android
  • s-ayush2903/vlc-android
  • chrisbohn1984/vlc-android
  • alexandre-janniaux/vlc-android
  • optimumpr/vlc-android
  • chirag-jn/vlc-android
  • e9ab98e991ab/vlc-android
  • suvDev/vlc-android
  • killthelord/vlc-android
  • Phoenix/vlc-android
  • soriyallc/vlc-android
  • tda1009/vlc-android
  • rhstone/vlc-android
  • ltnokiago/vlc-android
  • elbrujo1987/vlc-android
  • m1s4k1/vlc-android
  • mdc/vlc-android
  • arnaudj/vlc-android
  • abhinavmarwaha/vlc-android
  • dali546/vlc-android
  • Jeffset/vlc-android
  • megan30/vlc-android
  • lizhengdao/vlc-android
  • YajTPG/vlc-android
  • halcyon/vlc-android
  • ilya.yanok/vlc-android
  • jeramydhallmon/vlc-android
  • tijoemecano77/vlc-android
  • cjcj125125/vlc-android
  • dejan2609/vlc-android
  • JATIN2111999/vlc-android
  • imrohitkumar/vlc-android
  • sagudev/vlc-android
  • ILoveLin/vlc-android
  • tfighiera/vlc-android
  • snehil101/vlc-android
  • MKornelsen/vlc-android
  • m/vlc-android
  • core1024/vlc-android
  • vadimdolgachev/vlc-android
  • Kk77539/vlc-android
  • linzj/vlc-android
  • dantalian-pv/vlc-android
  • admkhalid/vlc-android
  • yaron/vlc-android
  • kn21091974/vlc-android
  • mylove1302/vlc-android
  • roblav96/vlc-android
  • alabiaga/vlc-android
  • kmnaveen101/vlc-android
  • nikiforoff1407/vlc-android
  • Android-Jester/vlc-android
  • frieda.rtwski/vlc-android
  • glaciers7506/vlc-android
  • rahul-gill/vlc-android
  • gaoxugang/vlc-android
  • Rishavgupta12345/vlc-android
  • dinho991556460/vlc-android
  • lighterowl/vlc-android
  • mary-kate/vlc-android
  • adnank20216/vlc-android
  • anthonylgutierrez79/vlc-android
  • Heliottw/vlc-android
  • mu1zix.ft3/vlc-android
  • yvesmaltais1212/vlc-android
  • ereme/vlc-android
  • jhonypalomino829/vlc-android
  • mx1up/vlc-android
  • sjwaddy/vlc-android
  • MohitMandalia/vlc-android
  • temaershov/vlc-android
  • js6pak/vlc-android
  • mishikallu/vlc-android
  • irfanmumtaz008/vlc-android
  • smurfohrachie/vlc-android
  • Goooler/vlc-android
  • eldo203050/vlc-android
  • dejesuszeus99/vlc-android
  • mfkl/vlc-android
  • Samfun75/vlc-android
  • markg85/vlc-android-ipfs
  • doktamelek911/vlc-android
  • wikwity/vlc-android
  • aangelmaker/vlc-android
  • krawczykradek119/vlc-android
  • ylz18180813163/vlc-android
  • galaxy9sx3/vlc-android
  • huajie2020/vlc-android
  • XuanTung95/vlc-android
  • kl/vlc-android
  • melihyolcu83/vlc-android
  • rt1shnik/vlc-android
  • jerryboy307/vlc-android
  • ikeuzochukwu6/vlc-android
  • patrikgolis/vlc-android
  • Ismavv/vlc-android
  • clementosumo/vlc-android
  • joshlamp66/vlc-android
  • nkmoyonyathiericyounge/vlc-android
  • DanTm99/vlc-android
  • Jeffrow41/vlc-android
  • fromphfr/vlc-android
  • 16project/vlc-android
  • Tomas8874/vlc-android
  • fixxxer87/vlc-android
  • sanjay/vlc-android
  • franciscojrp/vlc-android
  • cashellauswaus23/vlc-android
  • hengwu0/vlc-android
  • naythu2020rain/vlc-android
  • TongtengInhole/vlc-android
  • pupdoggy666/vlc-android
  • jcj921013/vlc-android
  • Gc6026/vlc-android
  • crijojc/vlc-android
  • mdrewight/vlc-android
  • davidhaywood0782/vlc-android
  • jbschtt/vlc-android
  • macfarlandcamel/vlc-android
  • syazairi/vlc-android
  • Commander01/vlc-android
  • baileyterry014/vlc-android
  • rodrickfranklin38/vlc-android
  • diego1245hernb/vlc-android
  • anton.canada/vlc-android
  • egazaekb/vlc-android
  • Marissa111113/vlc-android
  • jeinerbruno2/vlc-android
  • wehnie13/vlc-android
  • ozill87/vlc-android
  • legionfso/vlc-android
  • anazahirajoel/vlc-android
  • naomirojas1227/vlc-android
  • xbao/vlc-android
  • antoni.kozubek/vlc-android
  • pajela8482/vlc-android
  • karlfandango55/vlc-android
  • ruanbester07/vlc-android
  • chigita73/vlc-android
  • giu.pat6/vlc-android
  • Aura/vlc-android
  • marcwabo/vlc-android
  • contact.adgrafix/vlc-android
  • exlaverdad/vlc-android
  • simon.marquis88/vlc-android
  • youngkinsamantha421/vlc-android
  • edgard1161/vlc-android
  • agzx77/vlc-android
  • ha7204993/vlc-android
  • alghazwani.jar.6090/vlc-android
  • zrowton1206/vlc-android
  • darek1979513/vlc-android
  • matthiaskett18198/vlc-android
  • kubadyr77/vlc-android
  • romanstudeny1982/vlc-android
  • kumar107375/vlc-android
  • schong0525/vlc-android
  • Kt/vlc-android
  • jovelyn.esconde125/vlc-android
  • corriemacbarnard/vlc-android
  • apisbg91/vlc-android
  • yyusea/vlc-android
  • protechq88/vlc-android
  • rmangaraman/vlc-android
  • soutomikel/vlc-android
  • goregladaleksej5/vlc-android
  • tao/vlc-android
  • aruiz595/vlc-android
  • horvathpeter1202/vlc-android
  • litteh82/vlc-android
  • kerriochoa96/vlc-android
  • skshemul2022/vlc-android
  • popy/vlc-android
  • mizadpanahdev/vlc-android
  • pinarim2035/vlc-android
  • davidgooch1127/vlc-android
  • NyanCatTW1/vlc-android
  • Pendynurcahyo/vlc-android
  • fcartegnie/vlc-android
  • xiaoxiao921/vlc-android
  • rjtoell/vlc-android
  • devanshu6445/vlc-android
  • DopeDo69/vlc-android
  • quimsical/vlc-android
  • nickita.koltsoff/vlc-android
  • zeestander8617/vlc-android
  • alexsonarin06/vlc-android
  • minh189999h/vlc-android
  • JonnycatMeow/vlc-android
  • pup.ragnarok.1984/vlc-android2
  • jlcalderon13/vlc-android
  • franciszekk51214/vlc-android
  • yinsheng996/vlc-android
  • KenN3RD/vlc-android
  • leogps/vlc-android
  • alicuteo0407/vlc-android
  • MessirVoland/vlc-android
  • brett2uk/vlc-android
  • thomas.hermes/vlc-android
  • dgyudin/vlc-android
  • anuoshemohammad/vlc-android
  • r7truong/vlc-android
  • aaa1115910/vlc-android
  • arunkennedy78/vlc-android
  • nicholaszarra0069/vlc-android
  • georgipetrovdochev/vlc-android
  • Nikhil-z/vlc-android
  • misb1033/vlc-android
  • ktcoooot1/vlc-android
  • manmuc5/vlc-android
  • ahwhatisinttaken/vlc-android
  • m.nozka90/vlc-android
  • kabeermuhammad124319/vlc-android
  • ANGELONCE/vlc-android
  • manstabuk/vlc-android
  • yajcoca/vlc-android
  • dreamscell83/vlc-android
  • oldsssteveo/vlc-android
  • c0ff330k/vlc-android
  • ZhangXinmin528/vlc-android
  • lacsimarnald09/vlc-android
  • boykaisaac758/vlc-android
  • ooseidesmond/vlc-android
  • andresbott/vlc-android
  • yolandawanttoplay/vlc-android
  • lapaz17/vlc-android
  • sillyearl0138/vlc-android
  • NF-Repo/vlc-android
  • aaasg4001/vlc-android
  • mongia.puneet/vlc-android
  • slablaykon/vlc-android
  • Shabgardtanha1111/vlc-android
  • Benjamin_Loison/vlc-android
  • ashishami2002/vlc-android
  • Niram7777/vlc-android
  • Yashraj254/vlc-android
  • Choucroute_melba/vlc-android
  • Soete/vlc-android
  • MangalK/vlc-android
  • mohak2003/vlc-android
  • advait-0/vlc-android
  • McLP/vlc-android
  • fhuber/vlc-android
  • sami-sweng/vlc-android
  • josiahcarlson/vlc-android
328 results
Show changes
Showing
with 208 additions and 137 deletions
package org.videolan.vlc
import android.content.pm.ActivityInfo
import androidx.test.espresso.ViewAction
import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
import android.content.pm.ActivityInfo
import android.view.View
import android.view.ViewGroup
import androidx.test.espresso.UiController
import androidx.test.espresso.ViewAction
import androidx.test.espresso.matcher.ViewMatchers.isEnabled
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry
import androidx.test.runner.lifecycle.Stage
......@@ -75,12 +76,21 @@ class OrientationChangeAction internal constructor(private val orientation: Int)
if (context is Activity) {
return context
}
context = (context as ContextWrapper).baseContext
context = context.baseContext
}
return null
}
}
class ForceClickAction : ViewAction {
override fun getConstraints() = isEnabled()
override fun getDescription() = "Force click a view even if 90% condition is not satisfied"
override fun perform(uiController: UiController?, view: View?) {
view?.performClick()
}
}
fun orientationLandscape(): ViewAction {
return OrientationChangeAction(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
}
......
......@@ -17,15 +17,15 @@ import androidx.appcompat.view.menu.ActionMenuItemView
import androidx.core.content.ContextCompat
import androidx.databinding.ViewDataBinding
import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.UiController
import androidx.test.espresso.ViewAction
import androidx.test.espresso.matcher.BoundedMatcher
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import com.google.android.material.tabs.TabLayout
import org.hamcrest.BaseMatcher
import org.hamcrest.Description
import org.hamcrest.Matcher
import org.hamcrest.TypeSafeMatcher
import org.videolan.medialibrary.interfaces.media.MediaWrapper
import org.videolan.vlc.gui.browser.BaseBrowserAdapter
import org.videolan.vlc.gui.helpers.SelectorViewHolder
import org.videolan.vlc.gui.helpers.ThreeStatesCheckbox
......@@ -91,8 +91,6 @@ fun withBgColor(@ColorInt color: Int): Matcher<View> {
}
}
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
class MediaRecyclerViewMatcher<VH : SelectorViewHolder<out ViewDataBinding>>(@IdRes private val recyclerViewId: Int) {
var recyclerView: RecyclerView? = null
......@@ -106,10 +104,7 @@ class MediaRecyclerViewMatcher<VH : SelectorViewHolder<out ViewDataBinding>>(@Id
override fun matchesSafely(view: View): Boolean {
if (!fillMatchesIfRequired(mapVH, view.rootView) { vh ->
if (vh is BaseBrowserAdapter.MediaViewHolder) {
val item = (vh as BaseBrowserAdapter.MediaViewHolder).binding.item as? MediaWrapper
item?.type == mediaType
} else false
false
}) return false
return mapVH[view]?.let {
......@@ -147,6 +142,23 @@ class MediaRecyclerViewMatcher<VH : SelectorViewHolder<out ViewDataBinding>>(@Id
}
}
class TabsMatcher internal constructor(var position: Int) : ViewAction {
override fun getConstraints(): Matcher<View> = isDisplayed()
override fun getDescription(): String = "Click on tab"
override fun perform(uiController: UiController?, view: View) {
if (view is TabLayout) {
val tabLayout: TabLayout = view as TabLayout
val tab: TabLayout.Tab? = tabLayout.getTabAt(position)
if (tab != null) {
tab.select()
}
}
}
}
class FirstViewMatcher : BaseMatcher<View>() {
var matchedBefore = false
......
......@@ -25,8 +25,8 @@ import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.*
import org.junit.Test
import org.junit.runner.RunWith
import org.videolan.vlc.util.getValue
import org.videolan.vlc.util.TestUtil
import org.videolan.vlc.util.getValue
@RunWith(AndroidJUnit4::class)
......@@ -58,7 +58,7 @@ class BrowserFavDaoTest: DbTest() {
/*===========================================================*/
val networkFavs = getValue(db.browserFavDao().getAllNetwrokFavs())
val networkFavs = getValue(db.browserFavDao().getAllNetworkFavs())
assertThat(networkFavs.size, equalTo(2))
assertThat(networkFavs, hasItem(fakeNetworkFavs[0]))
......
/*
* ************************************************************************
* MigrationTest.kt
* *************************************************************************
* Copyright © 2020 VLC authors and VideoLAN
* Author: Nicolas POMEPUY
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* **************************************************************************
*
*
*/
/*******************************************************************************
* MigrationTest.kt
* ****************************************************************************
......@@ -20,12 +44,13 @@
package org.videolan.vlc.database
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.core.content.edit
import androidx.core.net.toUri
import androidx.room.Room
import androidx.room.migration.Migration
import androidx.room.testing.MigrationTestHelper
import android.net.Uri
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
import androidx.test.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.hamcrest.CoreMatchers.`is`
......@@ -36,9 +61,9 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.videolan.libvlc.interfaces.IMedia
import org.videolan.resources.AppContextProvider
import org.videolan.vlc.database.helpers.*
import org.videolan.tools.Settings
import org.videolan.resources.TYPE_NETWORK_FAV
import org.videolan.tools.Settings
import org.videolan.vlc.database.helpers.*
import org.videolan.vlc.util.TestUtil
import org.videolan.vlc.util.getValue
......@@ -64,7 +89,7 @@ class MigrationTest {
val exSubMedisubsFolder = "/storage/emulated/0/Android/data/org.videolan.vlc.debug/files/subs/"
val exSubfile1Sub1 = "${exSubMedisubsFolder}file1.eng.srt"
// Favs
val favUri = Uri.parse("/storage/emulated/0/Android/data/org.videolan.vlc.debug/files/subs/file1.mkv")
val favUri = "/storage/emulated/0/Android/data/org.videolan.vlc.debug/files/subs/file1.mkv".toUri()
val favTitle = "test1"
val sqliteTestDbOpenHelper = SqliteTestDbOpenHelper(InstrumentationRegistry.getTargetContext(), TEST_DB_NAME, 26)
......@@ -102,11 +127,12 @@ class MigrationTest {
@Test fun migrateFrom27() {
migrationTestHelper.createDatabase(TEST_DB_NAME, 27)
val preferences = Settings.getInstance(AppContextProvider.appContext).edit()
val fakeCustomDirectories = TestUtil.createCustomDirectories(2)
// 27_28 migration rule moves the data from prefs to room
val prefCustomDirectories = fakeCustomDirectories.map { it.path }.reduce{ acc, path -> "$acc:$path" }
preferences.putString("custom_paths", prefCustomDirectories ).commit()
Settings.getInstance(AppContextProvider.appContext).edit(commit = true) {
putString("custom_paths", prefCustomDirectories)
}
migrationTestHelper.runMigrationsAndValidate(TEST_DB_NAME, 28, true, migration_27_28, migration_28_29)
val roomCustomDirectories = getMigratedRoomDatabase(migration_27_28, migration_28_29).customDirectoryDao().getAll()
......@@ -118,7 +144,7 @@ class MigrationTest {
fun getMigratedRoomDatabase(vararg migrations:Migration): MediaDatabase {
val database: MediaDatabase = Room.databaseBuilder(
InstrumentationRegistry.getTargetContext(),
MediaDatabase::class.java, TEST_DB_NAME )
MediaDatabase::class.java, TEST_DB_NAME)
.addMigrations(*migrations)
.build()
......
......@@ -20,9 +20,8 @@
package org.videolan.vlc.database.helpers
import android.content.ContentValues
import android.net.Uri
import android.text.TextUtils
import androidx.core.content.contentValuesOf
private val NETWORK_FAV_TABLE_NAME = "fav_table"
private val NETWORK_FAV_URI = "uri"
......@@ -59,33 +58,28 @@ fun createNetworkFavsTable(helper: SqliteTestDbOpenHelper) {
fun saveSlave(mediaPath: String, type: Int, priority: Int, uriString: String, helper: SqliteTestDbOpenHelper) {
val db = helper.writableDatabase
val values = ContentValues()
values.put(SLAVES_MEDIA_PATH, mediaPath)
values.put(SLAVES_TYPE, type)
values.put(SLAVES_PRIORITY, priority)
values.put(SLAVES_URI, uriString)
db.replace(SLAVES_TABLE_NAME, null, values)
db.replace(SLAVES_TABLE_NAME, null,
contentValuesOf(SLAVES_MEDIA_PATH to mediaPath, SLAVES_TYPE to type,
SLAVES_PRIORITY to priority, SLAVES_URI to uriString))
db.close()
}
fun saveExSubtitle(path: String, mediaName: String, helper: SqliteTestDbOpenHelper) {
val db = helper.writableDatabase
if (TextUtils.isEmpty(path) || TextUtils.isEmpty(mediaName))
if (path.isEmpty() || mediaName.isEmpty())
return
val values = ContentValues()
values.put(EXTERNAL_SUBTITLES_URI, path)
values.put(EXTERNAL_SUBTITLES_MEDIA_NAME, mediaName)
db.replace(EXTERNAL_SUBTITLES_TABLE_NAME, null, values)
db.replace(EXTERNAL_SUBTITLES_TABLE_NAME, null,
contentValuesOf(EXTERNAL_SUBTITLES_URI to path,
EXTERNAL_SUBTITLES_MEDIA_NAME to mediaName))
db.close()
}
fun saveNetworkFavItem(uri: Uri, title: String, iconUrl: String?, helper: SqliteTestDbOpenHelper) {
val db = helper.writableDatabase
val values = ContentValues()
values.put(NETWORK_FAV_URI, uri.toString())
values.put(NETWORK_FAV_TITLE, Uri.encode(title))
values.put(NETWORK_FAV_ICON_URL, Uri.encode(iconUrl))
db.replace(NETWORK_FAV_TABLE_NAME, null, values)
db.replace(NETWORK_FAV_TABLE_NAME, null,
contentValuesOf(NETWORK_FAV_URI to uri.toString(),
NETWORK_FAV_TITLE to Uri.encode(title),
NETWORK_FAV_ICON_URL to Uri.encode(iconUrl)))
db.close()
}
......
package org.videolan.vlc.gui
import android.content.Intent
import androidx.test.espresso.Espresso.*
import androidx.test.espresso.action.*
import androidx.test.espresso.action.ViewActions.*
import androidx.test.espresso.assertion.ViewAssertions.*
import androidx.test.espresso.contrib.DrawerActions.*
import androidx.test.espresso.matcher.RootMatchers.*
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.espresso.Espresso.onView
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.assertThat
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.rule.ActivityTestRule
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import org.hamcrest.Matchers.*
import org.hamcrest.Matchers.equalTo
import org.junit.Rule
import org.junit.Test
import org.videolan.medialibrary.interfaces.Medialibrary
import org.videolan.vlc.BaseUITest
import org.videolan.vlc.R
import org.videolan.vlc.*
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
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
class PlaylistActivityUITest: BaseUITest() {
class HeaderMediaListActivityUITest: BaseUITest() {
@Rule
@JvmField
val activityTestRule = ActivityTestRule(PlaylistActivity::class.java, true, false)
val activityTestRule = ActivityTestRule(HeaderMediaListActivity::class.java, true, false)
lateinit var activity: PlaylistActivity
lateinit var activity: HeaderMediaListActivity
override fun beforeTest() {
// TODO: Hack because of IO Dispatcher used in MediaParsingService channel
Thread.sleep(3 * 1000)
val ml = Medialibrary.getInstance()
val pl = ml.createPlaylist("test")
pl.append(ml.getPagedVideos(Medialibrary.SORT_DEFAULT, false, 5, 0).map { it.id })
pl.append(ml.getPagedAudio(Medialibrary.SORT_DEFAULT, false, 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,28 +5,39 @@ 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 kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
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
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
class PlaylistFragmentUITest: BaseUITest() {
@Rule
@JvmField
......@@ -47,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)
pl.append(ml.getPagedVideos(Medialibrary.SORT_DEFAULT, false, 5, 0).map { it.id })
pl.append(ml.getPagedAudio(Medialibrary.SORT_DEFAULT, false, 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
......@@ -66,8 +77,8 @@ class PlaylistFragmentUITest: BaseUITest() {
@Test
fun whenPlaylistAddedFromDirectoriesView_checkPlaylistUpdated() {
// Navigate to directories view
onView(withId(R.id.root_container))
.perform(open())
// onView(withId(R.id.root_container))
// .perform(open())
onView(allOf(instanceOf(NavigationMenuItemView::class.java), hasDescendant(withText(R.string.directories))))
.check(matches(isDisplayed()))
......@@ -85,8 +96,8 @@ class PlaylistFragmentUITest: BaseUITest() {
.perform(click())
// Navigate back to playlists view
onView(withId(R.id.root_container))
.perform(open())
// onView(withId(R.id.root_container))
// .perform(open())
onView(allOf(instanceOf(NavigationMenuItemView::class.java), hasDescendant(withText(R.string.playlists))))
.check(matches(isDisplayed()))
......
......@@ -2,32 +2,29 @@ package org.videolan.vlc.gui.browser
import android.content.Intent
import android.widget.AutoCompleteTextView
import androidx.core.content.edit
import androidx.databinding.ViewDataBinding
import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu
import androidx.test.espresso.action.ViewActions.*
import androidx.test.espresso.assertion.ViewAssertions.*
import androidx.test.espresso.contrib.RecyclerViewActions.*
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition
import androidx.test.espresso.matcher.RootMatchers.isPlatformPopup
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.rule.ActivityTestRule
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import org.hamcrest.Matchers.*
import org.junit.Rule
import org.junit.Test
import org.videolan.medialibrary.interfaces.media.MediaWrapper
import org.videolan.medialibrary.media.MediaLibraryItem
import org.videolan.resources.EXTRA_TARGET
import org.videolan.tools.Settings
import org.videolan.vlc.*
import org.videolan.vlc.gui.DiffUtilAdapter
import org.videolan.vlc.gui.MainActivity
import org.videolan.vlc.gui.helpers.SelectorViewHolder
import org.videolan.resources.EXTRA_TARGET
import org.videolan.tools.Settings
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
class FileBrowserFragmentUITest : BaseUITest() {
@Rule
@JvmField
......@@ -303,9 +300,7 @@ class FileBrowserFragmentUITest : BaseUITest() {
@Test
fun whenAtInternalStorageAndContainsUnknownFile_checkShownIfSettingIsTrue() {
Settings.getInstance(context).edit()
.putBoolean("browser_show_all_files", true)
.commit()
Settings.getInstance(context).edit(commit = true) { putBoolean("browser_show_all_files", true) }
onView(withRecyclerView(R.id.network_list).atPosition(1)).perform(click())
......@@ -328,9 +323,7 @@ class FileBrowserFragmentUITest : BaseUITest() {
@Test
fun whenAtInternalStorageAndContainsUnknownFile_checkNotShownIfSettingIsFalse() {
// TODO: Fails, because this preference value doesn't get reflected in the provider
Settings.getInstance(context).edit()
.putBoolean("browser_show_all_files", false)
.commit()
Settings.getInstance(context).edit(commit = true) { putBoolean("browser_show_all_files", false) }
onView(withRecyclerView(R.id.network_list).atPosition(1)).perform(click())
......@@ -398,9 +391,9 @@ class FileBrowserFragmentUITest : BaseUITest() {
onView(withRecyclerView(R.id.network_list).atPosition(0)).perform(click())
onView(withId(R.id.ml_menu_save))
.check(matches(withActionIconDrawable(R.drawable.ic_menu_bookmark_outline_w)))
.check(matches(withActionIconDrawable(R.drawable.ic_fav_add)))
.perform(click())
.check(matches(withActionIconDrawable(R.drawable.ic_menu_bookmark_w)))
.check(matches(withActionIconDrawable(R.drawable.ic_fav_remove)))
onView(isRoot()).perform(pressBack())
onView(isRoot()).perform(pressBack())
......@@ -421,9 +414,9 @@ class FileBrowserFragmentUITest : BaseUITest() {
onView(withRecyclerView(R.id.network_list).atPosition(3)).perform(click())
onView(withId(R.id.ml_menu_save))
.check(matches(withActionIconDrawable(R.drawable.ic_menu_bookmark_w)))
.check(matches(withActionIconDrawable(R.drawable.ic_fav_remove)))
.perform(click())
.check(matches(withActionIconDrawable(R.drawable.ic_menu_bookmark_outline_w)))
.check(matches(withActionIconDrawable(R.drawable.ic_fav_add)))
onView(isRoot()).perform(pressBack())
......
/*
* ************************************************************************
* FilePickerFragmentUITest.kt
* *************************************************************************
* Copyright © 2020 VLC authors and VideoLAN
* Author: Nicolas POMEPUY
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* **************************************************************************
*
*
*/
package org.videolan.vlc.gui.browser
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.rule.ActivityTestRule
import org.hamcrest.Matchers.equalTo
import org.hamcrest.Matchers.greaterThan
import org.junit.Rule
import org.junit.Test
import org.videolan.vlc.R
class FilePickerFragmentUITest : org.videolan.vlc.BaseUITest() {
@Rule
@JvmField
val activityTestRule = ActivityTestRule(FilePickerActivity::class.java)
lateinit var activity: FilePickerActivity
override fun beforeTest() {
activity = activityTestRule.activity
}
@Test
fun whenAtSomeFolder_clickOnHomeIconReturnsBackToRoot() {
onView(org.videolan.vlc.withRecyclerView(R.id.network_list).atPosition(0)).perform(click())
onView(org.videolan.vlc.withRecyclerView(R.id.network_list).atPosition(0)).perform(click())
onView(withId(R.id.network_list)).check(matches(org.videolan.vlc.withCount(greaterThan(2))))
}
}
......@@ -11,8 +11,6 @@ import androidx.test.espresso.contrib.RecyclerViewActions.*
import androidx.test.espresso.matcher.RootMatchers.isPlatformPopup
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.rule.ActivityTestRule
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import org.hamcrest.Description
import org.hamcrest.Matcher
import org.hamcrest.Matchers.*
......@@ -25,8 +23,6 @@ import org.videolan.vlc.gui.SecondaryActivity
import org.videolan.vlc.*
import org.videolan.vlc.gui.helpers.ThreeStatesCheckbox
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
class StorageBrowserFragmentUITest : BaseUITest() {
@Rule
@JvmField
......
......@@ -9,11 +9,11 @@ import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.matcher.ViewMatchers
import org.hamcrest.Matchers
import org.hamcrest.Matchers.allOf
import org.videolan.tools.Settings
import org.videolan.vlc.BaseUITest
import org.videolan.vlc.PreferenceMatchers
import org.videolan.vlc.R
import org.videolan.vlc.onPreferenceRow
import org.videolan.tools.Settings
abstract class BasePreferenceUITest : BaseUITest() {
val settings: SharedPreferences = Settings.getInstance(context)
......
......@@ -4,8 +4,6 @@ import android.os.Build
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.intent.rule.IntentsTestRule
import androidx.test.filters.SdkSuppress
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import org.junit.Rule
import org.junit.Test
import org.videolan.vlc.PreferenceMatchers.withKey
......@@ -14,8 +12,6 @@ import org.videolan.vlc.onPreferenceRow
import org.videolan.tools.KEY_PLAYBACK_SPEED_PERSIST
import org.videolan.tools.RESUME_PLAYBACK
@ExperimentalCoroutinesApi
@ObsoleteCoroutinesApi
class PreferencesAudioUITest: BasePreferenceUITest() {
@get:Rule
val intentsTestRule = IntentsTestRule(PreferencesActivity::class.java)
......@@ -85,9 +81,10 @@ class PreferencesAudioUITest: BasePreferenceUITest() {
checkModeChanged(key, "0", "0", MAP_AOUT)
checkModeChanged(key, "1", "0", MAP_AOUT)
checkModeChanged(key, "2", "0", MAP_AOUT)
}
companion object {
val MAP_AOUT = mapOf("0" to R.string.aout_audiotrack, "1" to R.string.aout_opensles)
val MAP_AOUT = mapOf("0" to R.string.aout_aaudio, "1" to R.string.aout_audiotrack, "2" to R.string.aout_opensles)
}
}
\ No newline at end of file
}
......@@ -4,8 +4,6 @@ import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.intent.rule.IntentsTestRule
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import org.hamcrest.Matchers.not
import org.junit.Rule
import org.junit.Test
......@@ -14,8 +12,6 @@ import org.videolan.vlc.PreferenceMatchers.withKey
import org.videolan.vlc.R
import org.videolan.vlc.onPreferenceRow
@ExperimentalCoroutinesApi
@ObsoleteCoroutinesApi
class PreferencesCastingUITest: BasePreferenceUITest() {
@get:Rule
val intentsTestRule = IntentsTestRule(PreferencesActivity::class.java)
......
......@@ -8,8 +8,6 @@ import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
import androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra
import androidx.test.espresso.intent.rule.IntentsTestRule
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import org.hamcrest.Matchers.allOf
import org.junit.Rule
import org.junit.Test
......@@ -22,8 +20,6 @@ import org.videolan.tools.KEY_VIDEO_APP_SWITCH
import org.videolan.tools.PLAYBACK_HISTORY
import org.videolan.tools.SCREEN_ORIENTATION
@ExperimentalCoroutinesApi
@ObsoleteCoroutinesApi
class PreferencesFragmentUITest: BasePreferenceUITest() {
@get:Rule
val intentsTestRule = IntentsTestRule(PreferencesActivity::class.java)
......@@ -91,6 +87,6 @@ class PreferencesFragmentUITest: BasePreferenceUITest() {
companion object {
val MAP_PIP_MODE = mapOf("0" to R.string.stop, "1" to R.string.play_as_audio_background, "2" to R.string.play_pip_title)
val MAP_HARDWARE_ACCEL = mapOf("-1" to R.string.automatic, "0" to R.string.hardware_acceleration_disabled, "1" to R.string.hardware_acceleration_decoding, "2" to R.string.hardware_acceleration_full)
val MAP_ORIENTATION = mapOf("99" to R.string.screen_orientation_sensor, "100" to R.string.screen_orientation_start_lock, "101" to R.string.screen_orientation_landscape, "102" to R.string.screen_orientation_portrait)
val MAP_ORIENTATION = mapOf("99" to R.string.screen_orientation_sensor, "101" to R.string.screen_orientation_landscape, "102" to R.string.screen_orientation_portrait)
}
}
\ No newline at end of file
......@@ -2,16 +2,12 @@ package org.videolan.vlc.gui.preferences
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.intent.rule.IntentsTestRule
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import org.junit.Rule
import org.junit.Test
import org.videolan.vlc.PreferenceMatchers.withKey
import org.videolan.vlc.R
import org.videolan.vlc.onPreferenceRow
@ExperimentalCoroutinesApi
@ObsoleteCoroutinesApi
class PreferencesSubtitlesUITest: BasePreferenceUITest() {
@get:Rule
val intentsTestRule = IntentsTestRule(PreferencesActivity::class.java)
......@@ -41,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() {
......@@ -75,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)"
)
......