From 08f25a3505ab11fe0becb1df6ece384fea177e2b Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 8 May 2023 16:10:44 +0200 Subject: [PATCH] add test Signed-off-by: tobiasKaminsky --- ...pfolderListFragmentIT_showGroupfolders.png | Bin 0 -> 6921 bytes .../ui/fragment/GroupfolderListFragmentIT.kt | 78 ++++++++++++++++++ .../ui/fragment/GroupfolderListFragment.kt | 2 +- 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 app/screenshots/gplay/debug/com.owncloud.android.ui.fragment.GroupfolderListFragmentIT_showGroupfolders.png create mode 100644 app/src/androidTest/java/com/owncloud/android/ui/fragment/GroupfolderListFragmentIT.kt diff --git a/app/screenshots/gplay/debug/com.owncloud.android.ui.fragment.GroupfolderListFragmentIT_showGroupfolders.png b/app/screenshots/gplay/debug/com.owncloud.android.ui.fragment.GroupfolderListFragmentIT_showGroupfolders.png new file mode 100644 index 0000000000000000000000000000000000000000..cdc2a725b4c91b32d5edacf1a66f38ac8ebaefc7 GIT binary patch literal 6921 zcmd5>d010-*1l8}tzx8Fqbxy1WRz`?MPx~&imWD8&?vH4s6_-sWKAG|SjUAWT2W9o zD*_@*WS1ogBby=;ngBtN1X&Y82xK87A<1{`^yxCs({DO$=bP_&?my@LmUHht=e+Ox zJNL%tNGJ7=H9rObK;6ap&@li|5dy#pht;dVJDZX2X8}O7*X59dXY3GnB<@!KS$WHX zn$K8Ol7F&vh02OguRj0F$`W`%v6J=KyNlXe(mjDctXdYn>EIjpZH5HL%o|0Y ztrFuOU%H!edG$A22K_&39DVA2=*n2<^mo0@^=K`Ef}ScC|EpArSK^ z(6ajboqpT0A3XoFC-~P6iD%^lo+JgA$RKsH%ZXH=_g1o^$q8Lt0;zb?k6Q&=%3+#LV^TUN=>+PFqz=u%FPuF)LfHBE6h;Cj-npS3@s{eUi z0G{Ch$*vDU>DxLjnH?jP(tYEM6YbuAz43e$SzXJ@Grg?zJd=b|Eb(8P()Y0XYlG<( ze2l725+t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KasERN58*O_OHMAza7^PTmFmo+<(C9KP8~4%70G&{Ei^~x?=jxqU(2f{pFIzOyGyM z>K|%`{;U}P?bP^1kU--X_U~@?{()>7aRdJQ_4_l)4o2*kLHkch`2WSroIdd1uiu~b z{eNug|A9FF(SHEqPyT-e>HiKjemw!>{;Z!he^OjQVEPf8z%7#?x0Pz2M1F1(v1(@o R_=^j0aYP=f`0Pyb{{XrFas~hZ literal 0 HcmV?d00001 diff --git a/app/src/androidTest/java/com/owncloud/android/ui/fragment/GroupfolderListFragmentIT.kt b/app/src/androidTest/java/com/owncloud/android/ui/fragment/GroupfolderListFragmentIT.kt new file mode 100644 index 0000000000..f596e79eeb --- /dev/null +++ b/app/src/androidTest/java/com/owncloud/android/ui/fragment/GroupfolderListFragmentIT.kt @@ -0,0 +1,78 @@ +/* + * + * Nextcloud Android client application + * + * @author Tobias Kaminsky + * Copyright (C) 2023 Tobias Kaminsky + * Copyright (C) 2023 Nextcloud GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.owncloud.android.ui.fragment + +import androidx.test.espresso.intent.rule.IntentsTestRule +import com.nextcloud.android.lib.resources.groupfolders.Groupfolder +import com.nextcloud.test.TestActivity +import com.owncloud.android.AbstractIT +import com.owncloud.android.utils.ScreenshotTest +import org.junit.Before +import org.junit.Rule +import org.junit.Test + +class GroupfolderListFragmentIT : AbstractIT() { + @get:Rule + val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false) + + lateinit var activity: TestActivity + + @Before + fun before() { + activity = testActivityRule.launchActivity(null) + } + + @ScreenshotTest + @Test + fun showEmpty() { + val sut = GroupfolderListFragment() + activity.addFragment(sut) + + waitForIdleSync() + + screenshot(activity) + } + + @Test + @ScreenshotTest + fun showGroupfolders() { + val sut = GroupfolderListFragment() + activity.addFragment(sut) + + waitForIdleSync() + + activity.runOnUiThread { + sut.setAdapter(null) + sut.setData( + mapOf( + Pair("1", Groupfolder(1, "/test/")), + Pair("2", Groupfolder(2, "/subfolder/group")) + ) + ) + } + + waitForIdleSync() + shortSleep() + screenshot(activity) + } +} diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/GroupfolderListFragment.kt b/app/src/main/java/com/owncloud/android/ui/fragment/GroupfolderListFragment.kt index 51071156bf..7c05f6033b 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/GroupfolderListFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/fragment/GroupfolderListFragment.kt @@ -75,7 +75,7 @@ class GroupfolderListFragment : OCFileListFragment(), Injectable, GroupfolderLis search() } - override fun setAdapter(args: Bundle?) { + public override fun setAdapter(args: Bundle?) { adapter = GroupfolderListAdapter(requireContext(), viewThemeUtils, this) setRecyclerViewAdapter(adapter)