forked from nus-cs2103-AY1617S1/addressbook-level4
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from CS2103AUG2016-W10-C2/gui-tests
Gui tests
- Loading branch information
Showing
26 changed files
with
522 additions
and
311 deletions.
There are no files selected for viewing
21 changes: 0 additions & 21 deletions
21
src/main/java/seedu/address/commons/events/ui/JumpToListRequestEvent.java
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,35 @@ | ||
package guitests; | ||
|
||
import org.junit.Test; | ||
import seedu.address.logic.commands.ClearCommand; | ||
import seedu.address.logic.commands.DeleteCommand; | ||
import seedu.address.testutil.TestEntry; | ||
import seedu.address.testutil.TypicalTestTasks; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
public class ClearCommandTest extends AddressBookGuiTest { | ||
public class ClearCommandTest extends TaskManagerGuiTest { | ||
|
||
@Test | ||
public void clear() { | ||
|
||
//verify a non-empty list can be cleared | ||
assertTrue(taskList.isListMatching(td.getTypicalSortedPersons())); | ||
assertClearCommandSuccess(); | ||
|
||
//verify other commands can work after a clear command | ||
commandBox.runCommand(td.homework.getAddCommand()); | ||
assertTrue(taskList.isListMatching(td.homework)); | ||
commandBox.runCommand("delete 1"); | ||
TestEntry testEntry = td.getTestEntry(TypicalTestTasks.BuyTasks.TASK_1); | ||
commandBox.runCommand(testEntry.getAddCommand()); | ||
assertTrue(taskList.isListMatching(testEntry)); | ||
commandBox.runCommand(DeleteCommand.COMMAND_WORD + " 1"); | ||
assertListSize(0); | ||
|
||
//verify clear command works when the list is empty | ||
assertClearCommandSuccess(); | ||
} | ||
|
||
private void assertClearCommandSuccess() { | ||
commandBox.runCommand("clear"); | ||
commandBox.runCommand(ClearCommand.COMMAND_WORD); | ||
assertListSize(0); | ||
assertResultMessage("Todo list has been cleared!"); | ||
assertResultMessage(ClearCommand.MESSAGE_SUCCESS); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package guitests; | ||
|
||
import org.junit.Test; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.LocalTime; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static seedu.address.ui.util.GuiUtil.*; | ||
|
||
//@@author A0116603R | ||
public class GuiUtilTest { | ||
|
||
private LocalDateTime now = LocalDateTime.now(); | ||
private LocalDateTime midnight = LocalDateTime.of(now.toLocalDate().plusDays(1), LocalTime.MIDNIGHT); | ||
|
||
@Test | ||
public void taskStyling() { | ||
assertEquals("Unmarked floating tasks have no styling", "", getTaskStyling(false)); | ||
assertEquals("Marked floating tasks have ." + PAST_STYLE_CLASS + " style class", PAST_STYLE_CLASS, getTaskStyling(true)); | ||
} | ||
|
||
@Test | ||
public void deadlineStyling_marked_havePastStyleRegardlessOfDeadline() { | ||
String styleClass = getDeadlineStyling(true, now.minusWeeks(1)); | ||
assertEquals(PAST_STYLE_CLASS, styleClass); | ||
|
||
styleClass = getDeadlineStyling(true, now.plusWeeks(1)); | ||
assertEquals(PAST_STYLE_CLASS, styleClass); | ||
} | ||
|
||
@Test | ||
public void deadlineStyling_unmarked() { | ||
assertEquals(OVERDUE_STYLE_CLASS, getDeadlineStyling(false, now.minusWeeks(1))); | ||
assertEquals(ACTIVE_STYLE_CLASS, getDeadlineStyling(false, midnight.minusMinutes(1))); | ||
assertEquals("", getDeadlineStyling(false, now.plusWeeks(1))); | ||
} | ||
|
||
@Test | ||
public void eventStyling_past() { | ||
assertEquals(PAST_STYLE_CLASS, getEventStyling(now.minusDays(5), now.minusDays(4))); | ||
assertEquals(ACTIVE_STYLE_CLASS, getEventStyling(now.minusSeconds(1), now.plusHours(1))); | ||
assertEquals("", getEventStyling(now.plusDays(1), now.plusDays(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.