forked from orgzly/orgzly-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support searching by plain timestamps and agenda
Part of orgzly#76.
- Loading branch information
Showing
19 changed files
with
1,842 additions
and
32 deletions.
There are no files selected for viewing
1,361 changes: 1,361 additions & 0 deletions
1,361
app/schemas/com.orgzly.android.db.OrgzlyDatabase/151.json
Large diffs are not rendered by default.
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
120 changes: 120 additions & 0 deletions
120
app/src/androidTest/java/com/orgzly/android/espresso/NoteTimestampTest.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,120 @@ | ||
package com.orgzly.android.espresso | ||
|
||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import com.orgzly.android.OrgzlyTest | ||
import com.orgzly.android.espresso.EspressoUtils.* | ||
import com.orgzly.android.ui.main.MainActivity | ||
import com.orgzly.org.datetime.OrgDateTime | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class NoteTimestampTest : OrgzlyTest() { | ||
@get:Rule | ||
var activityRule = EspressoActivityTestRule(MainActivity::class.java, true, false) | ||
|
||
private val now: String | ||
get() = OrgDateTime(true).toString() | ||
|
||
private val today: String | ||
get() = OrgDateTime.Builder() | ||
.setDay(System.currentTimeMillis()) | ||
.setIsActive(true) | ||
.build() | ||
.toString() | ||
|
||
private val tomorrow: String | ||
get() = OrgDateTime.Builder() | ||
.setDay(System.currentTimeMillis() + 86400000L) | ||
.setIsActive(true) | ||
.build() | ||
.toString() | ||
|
||
private val inFewDays: String | ||
get() = OrgDateTime.Builder() | ||
.setDay(System.currentTimeMillis() + 86400000L * 3) | ||
.setIsActive(true) | ||
.build() | ||
.toString() | ||
|
||
private val fewDaysAgo: String | ||
get() = OrgDateTime.Builder() | ||
.setDay(System.currentTimeMillis() - 86400000L * 3) | ||
.setIsActive(true) | ||
.build() | ||
.toString() | ||
|
||
|
||
@Test | ||
fun search_OneInTitle() { | ||
testUtils.setupBook("book-a", "* Note $now") | ||
activityRule.launchActivity(null) | ||
searchForText("e.ge.today") | ||
onNotesInSearch().check(matches(recyclerViewItemCount(1))) | ||
} | ||
|
||
@Test | ||
fun search_OneInContent() { | ||
testUtils.setupBook("book-a", "* Note\n$now") | ||
activityRule.launchActivity(null) | ||
searchForText("e.ge.today") | ||
onNotesInSearch().check(matches(recyclerViewItemCount(1))) | ||
} | ||
|
||
@Test | ||
fun search_TwoSameInContent() { | ||
testUtils.setupBook("book-a", "* Note\n$now $now") | ||
activityRule.launchActivity(null) | ||
searchForText("e.ge.today") | ||
onNotesInSearch().check(matches(recyclerViewItemCount(1))) | ||
} | ||
|
||
@Test | ||
fun agenda_OneInTitle() { | ||
testUtils.setupBook("book-a", "* Note $now") | ||
activityRule.launchActivity(null) | ||
searchForText("ad.1") | ||
onNotesInAgenda().check(matches(recyclerViewItemCount(2))) | ||
} | ||
|
||
@Test | ||
fun agenda_TwoInTitle() { | ||
testUtils.setupBook("book-a", "* Note $now $tomorrow") | ||
activityRule.launchActivity(null) | ||
searchForText("ad.2") | ||
onNotesInAgenda().check(matches(recyclerViewItemCount(4))) | ||
} | ||
|
||
@Test | ||
fun agenda_OneInContent() { | ||
testUtils.setupBook("book-a", "* Note\n$now") | ||
activityRule.launchActivity(null) | ||
searchForText("ad.1") | ||
onNotesInAgenda().check(matches(recyclerViewItemCount(2))) | ||
} | ||
|
||
@Test | ||
fun agenda_TwoInContent() { | ||
testUtils.setupBook("book-a", "* Note\n$now $tomorrow") | ||
activityRule.launchActivity(null) | ||
searchForText("ad.2") | ||
onNotesInAgenda().check(matches(recyclerViewItemCount(4))) | ||
} | ||
|
||
@Test | ||
fun search_TodayAndInFewDays() { | ||
testUtils.setupBook( | ||
"book-a", | ||
"* Today $today\n* In few days $inFewDays\n* Today & In few days $today $inFewDays") | ||
activityRule.launchActivity(null) | ||
searchForText("e.gt.1d") | ||
onNotesInSearch().check(matches(recyclerViewItemCount(2))) | ||
} | ||
|
||
@Test | ||
fun agenda_PastEvent() { | ||
testUtils.setupBook("book-a", "* Few days ago\n$fewDaysAgo") | ||
activityRule.launchActivity(null) | ||
searchForText("ad.2") | ||
onNotesInAgenda().check(matches(recyclerViewItemCount(2))) | ||
} | ||
} |
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.