Skip to content

Commit 90b8f10

Browse files
alperozturk96backportbot[bot]
authored andcommitted
fix codacy
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent 91065c1 commit 90b8f10

1 file changed

Lines changed: 16 additions & 63 deletions

File tree

app/src/androidTest/java/com/owncloud/android/ui/adapter/UnifiedSearchListAdapterIT.kt

Lines changed: 16 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class UnifiedSearchListAdapterIT : AbstractIT() {
3535
private lateinit var overlayManager: OverlayManager
3636
private lateinit var preferences: AppPreferences
3737

38+
@Suppress("DEPRECATION")
3839
@Before
3940
fun setup() {
4041
preferences = AppPreferencesImpl.fromContext(targetContext)
@@ -46,7 +47,7 @@ class UnifiedSearchListAdapterIT : AbstractIT() {
4647
thumbnailUrl = "",
4748
title = "My Folder",
4849
subline = "Documents/My Folder",
49-
resourceUrl = "https://cloud.example.com/index.php/apps/files/?dir=/Documents/My%20Folder&scrollto=My%20Folder",
50+
resourceUrl = "",
5051
icon = "icon-folder",
5152
rounded = false,
5253
attributes = mapOf("path" to "/Documents/My Folder")
@@ -56,17 +57,17 @@ class UnifiedSearchListAdapterIT : AbstractIT() {
5657
thumbnailUrl = "",
5758
title = "report.pdf",
5859
subline = "Documents/report.pdf",
59-
resourceUrl = "https://cloud.example.com/index.php/apps/files/?dir=/Documents&scrollto=report.pdf",
60-
icon = "icon-pdf",
60+
resourceUrl = "",
61+
icon = "application-pdf",
6162
rounded = false,
6263
attributes = mapOf("path" to "/Documents/report.pdf", "fileId" to "12345")
6364
)
6465

6566
private fun makeContactEntry() = SearchResultEntry(
66-
thumbnailUrl = "https://cloud.example.com/avatar/john",
67+
thumbnailUrl = "",
6768
title = "John Doe",
6869
subline = "john@example.com",
69-
resourceUrl = "https://cloud.example.com/apps/contacts/123",
70+
resourceUrl = "",
7071
icon = "icon-contacts",
7172
rounded = true,
7273
attributes = emptyMap()
@@ -76,32 +77,22 @@ class UnifiedSearchListAdapterIT : AbstractIT() {
7677
thumbnailUrl = "",
7778
title = "Team Meeting",
7879
subline = "Today at 10:00 AM",
79-
resourceUrl = "https://cloud.example.com/apps/calendar/event/456",
80+
resourceUrl = "",
8081
icon = "icon-calendar",
8182
rounded = false,
8283
attributes = emptyMap()
8384
)
8485

8586
private fun makeAppEntry() = SearchResultEntry(
86-
thumbnailUrl = "https://cloud.example.com/apps/settings/icon",
87+
thumbnailUrl = "",
8788
title = "Settings",
8889
subline = "App",
89-
resourceUrl = "https://cloud.example.com/apps/settings",
90+
resourceUrl = "",
9091
icon = "icon-settings",
9192
rounded = false,
9293
attributes = emptyMap()
9394
)
9495

95-
private fun makeEntryWithoutSubline() = SearchResultEntry(
96-
thumbnailUrl = "",
97-
title = "No Subline Entry",
98-
subline = "",
99-
resourceUrl = "https://cloud.example.com/apps/files/?dir=/&scrollto=file.txt",
100-
icon = "icon-file",
101-
rounded = false,
102-
attributes = emptyMap()
103-
)
104-
10596
private fun makeSections(vararg pairs: Pair<String, List<SearchResultEntry>>): List<UnifiedSearchSection> =
10697
pairs.map { (name, entries) ->
10798
UnifiedSearchSection(
@@ -205,22 +196,7 @@ class UnifiedSearchListAdapterIT : AbstractIT() {
205196

206197
// endregion
207198

208-
// region Empty state
209-
210-
@Test
211-
@ScreenshotTest
212-
fun showEmptyAdapter() {
213-
launchActivity<FileDisplayActivity>().use { scenario ->
214-
scenario.onActivity { sut -> setupAdapterOnActivity(sut) }
215-
waitForIdle()
216-
scenario.onActivity { sut -> screenshot(sut, "emptyAdapter") }
217-
}
218-
}
219-
220-
// endregion
221-
222199
// region Remote thumbnails (contacts, calendar, apps)
223-
224200
@Test
225201
@ScreenshotTest
226202
fun showContactEntry() {
@@ -265,11 +241,9 @@ class UnifiedSearchListAdapterIT : AbstractIT() {
265241
scenario.onActivity { sut -> screenshot(sut, "appEntry") }
266242
}
267243
}
268-
269244
// endregion
270245

271246
// region File entries
272-
273247
@Test
274248
@ScreenshotTest
275249
fun showFileEntry() {
@@ -305,26 +279,9 @@ class UnifiedSearchListAdapterIT : AbstractIT() {
305279
scenario.onActivity { sut -> screenshot(sut, "folderEntry") }
306280
}
307281
}
308-
309-
@Test
310-
@ScreenshotTest
311-
fun showEntryWithoutSubline() {
312-
launchActivity<FileDisplayActivity>().use { scenario ->
313-
scenario.onActivity { sut ->
314-
setupAdapterOnActivity(
315-
sut,
316-
sections = makeSections("Files" to listOf(makeEntryWithoutSubline()))
317-
)
318-
}
319-
waitForIdle()
320-
scenario.onActivity { sut -> screenshot(sut, "entryWithoutSubline") }
321-
}
322-
}
323-
324282
// endregion
325283

326284
// region Multiple sections
327-
328285
@Test
329286
@ScreenshotTest
330287
fun showMultipleSections() {
@@ -361,11 +318,9 @@ class UnifiedSearchListAdapterIT : AbstractIT() {
361318
scenario.onActivity { sut -> screenshot(sut, "sectionsWithLoadMoreFooter") }
362319
}
363320
}
364-
365321
// endregion
366322

367323
// region Current directory items
368-
369324
@Test
370325
@ScreenshotTest
371326
fun showCurrentDirectoryItems() {
@@ -399,7 +354,8 @@ class UnifiedSearchListAdapterIT : AbstractIT() {
399354
launchActivity<FileDisplayActivity>().use { scenario ->
400355
scenario.onActivity { sut ->
401356
val localFile = OCFile("/Documents/notes.txt").apply {
402-
mimeType = "text/plain"
357+
mimeType = MimeType.TEXT_PLAIN
358+
remoteId = "00005"
403359
fileLength = 1024
404360
modificationTimestamp = System.currentTimeMillis()
405361
}
@@ -413,33 +369,31 @@ class UnifiedSearchListAdapterIT : AbstractIT() {
413369
scenario.onActivity { sut -> screenshot(sut, "currentDirItemsWithUnifiedSections") }
414370
}
415371
}
416-
417372
// endregion
418373

419374
// region Scroll / recycle stress test
420-
421375
@Test
422376
@ScreenshotTest
423-
fun showManyEntriesForScrollStressTest() {
377+
fun showManyEntries() {
424378
launchActivity<FileDisplayActivity>().use { scenario ->
425379
scenario.onActivity { sut ->
426380
val fileEntries = (1..10).map { i ->
427381
SearchResultEntry(
428382
thumbnailUrl = "",
429383
title = "File $i.pdf",
430384
subline = "Documents/File $i.pdf",
431-
resourceUrl = "https://cloud.example.com/index.php/apps/files/?dir=/Documents&scrollto=File%20$i.pdf",
432-
icon = "icon-pdf",
385+
resourceUrl = "",
386+
icon = "application-pdf",
433387
rounded = false,
434388
attributes = mapOf("fileId" to "$i")
435389
)
436390
}
437391
val contactEntries = (1..5).map { i ->
438392
SearchResultEntry(
439-
thumbnailUrl = "https://cloud.example.com/avatar/user$i",
393+
thumbnailUrl = "",
440394
title = "Contact $i",
441395
subline = "user$i@example.com",
442-
resourceUrl = "https://cloud.example.com/apps/contacts/$i",
396+
resourceUrl = "",
443397
icon = "icon-contacts",
444398
rounded = true,
445399
attributes = emptyMap()
@@ -457,6 +411,5 @@ class UnifiedSearchListAdapterIT : AbstractIT() {
457411
scenario.onActivity { sut -> screenshot(sut, "manyEntriesScrollStress") }
458412
}
459413
}
460-
461414
// endregion
462415
}

0 commit comments

Comments
 (0)