-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MovedFile.originalName & fix saveQuickMoveDestination
- Loading branch information
Showing
18 changed files
with
157 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...test/kotlin/com/w2sv/datastore/proto/navigatorconfig/NavigatorConfigDataSourceImplTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.w2sv.datastore.proto.navigatorconfig | ||
|
||
import com.w2sv.domain.model.movedestination.LocalDestination | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.robolectric.RobolectricTestRunner | ||
|
||
@RunWith(RobolectricTestRunner::class) | ||
class NavigatorConfigDataSourceImplTest { | ||
|
||
private val localDestinationA = | ||
LocalDestination.parse("content://com.android.externalstorage.documents/document/primary%3AMoved%2FGIFs") | ||
private val localDestinationB = | ||
LocalDestination.parse("content://com.android.externalstorage.documents/document/primary%3AMoved%2FScreenshots") | ||
private val localDestinationC = | ||
LocalDestination.parse("content://com.android.externalstorage.documents/document/primary%3AMoved") | ||
|
||
@Test | ||
fun testUpdatedQuickMoveDestinations() { | ||
// When current destinations empty -> destination is added | ||
assertEquals( | ||
listOf(localDestinationA), | ||
updatedQuickMoveDestinations( | ||
currentDestinations = emptyList(), | ||
destination = localDestinationA | ||
) | ||
) | ||
|
||
// When new destination equals first destination -> list stays as is | ||
assertEquals( | ||
listOf(localDestinationA), | ||
updatedQuickMoveDestinations( | ||
currentDestinations = listOf(localDestinationA), | ||
destination = localDestinationA | ||
) | ||
) | ||
|
||
// When new destination equals first destination -> list stays as is | ||
assertEquals( | ||
listOf(localDestinationA, localDestinationB), | ||
updatedQuickMoveDestinations( | ||
currentDestinations = listOf(localDestinationA, localDestinationB), | ||
destination = localDestinationA | ||
) | ||
) | ||
|
||
// When new destination equals second destination -> list gets reversed | ||
assertEquals( | ||
listOf(localDestinationB, localDestinationA), | ||
updatedQuickMoveDestinations( | ||
currentDestinations = listOf(localDestinationA, localDestinationB), | ||
destination = localDestinationB | ||
) | ||
) | ||
|
||
// When new destination not in list -> second is removed, first becomes second, new becomes first | ||
assertEquals( | ||
listOf(localDestinationC, localDestinationA), | ||
updatedQuickMoveDestinations( | ||
currentDestinations = listOf(localDestinationA, localDestinationB), | ||
destination = localDestinationC | ||
) | ||
) | ||
|
||
// When new destination not in list -> first becomes second, new becomes first | ||
assertEquals( | ||
listOf(localDestinationB, localDestinationA), | ||
updatedQuickMoveDestinations( | ||
currentDestinations = listOf(localDestinationA), | ||
destination = localDestinationB | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.