-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix "current" week calculation outside the regular season (#983)
* Fix "current" week calculation outside the regular season EventWeekTab now represents a range of weeks so we can find the right one * Import cleanup
- Loading branch information
Showing
5 changed files
with
67 additions
and
14 deletions.
There are no files selected for viewing
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
44 changes: 44 additions & 0 deletions
44
android/src/test/java/com/thebluealliance/androidclient/models/EventWeekTabTest.java
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,44 @@ | ||
package com.thebluealliance.androidclient.models; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(AndroidJUnit4.class) | ||
public class EventWeekTabTest { | ||
|
||
@Test | ||
public void addEventSetsStartEndWeek() { | ||
EventWeekTab tab = new EventWeekTab("label"); | ||
Event event = new Event(); | ||
event.setWeek(5); | ||
tab.addEvent(event); | ||
|
||
assertFalse(tab.includesWeek(4)); | ||
assertTrue(tab.includesWeek(5)); | ||
assertFalse(tab.includesWeek(6)); | ||
} | ||
|
||
@Test | ||
public void addMultipleEvents_multipleWeeks() { | ||
EventWeekTab tab = new EventWeekTab("label"); | ||
|
||
Event event = new Event(); | ||
event.setWeek(5); | ||
tab.addEvent(event); | ||
|
||
Event event2 = new Event(); | ||
event2.setWeek(7); | ||
tab.addEvent(event2); | ||
|
||
assertFalse(tab.includesWeek(4)); | ||
assertTrue(tab.includesWeek(5)); | ||
assertTrue(tab.includesWeek(6)); | ||
assertTrue(tab.includesWeek(7)); | ||
assertFalse(tab.includesWeek(8)); | ||
} | ||
} |
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