Skip to content

Commit 01bc57e

Browse files
authored
Merge pull request #61 from UCSDOalads/addInputBoxTest
Add AddInputBoxActionTest
2 parents ea6006a + 75eba5f commit 01bc57e

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package actions;
2+
3+
import static org.junit.Assert.*;
4+
5+
import org.junit.Test;
6+
7+
import paintcomponents.data.DataInputTextfieldPaintComponent;
8+
import ui.PaintPanel;
9+
10+
public class AddDataInputBoxActionTest {
11+
12+
@Test
13+
public void test() {
14+
PaintPanel panel = new PaintPanel();
15+
16+
AddDataInputBoxAction action = new AddDataInputBoxAction(panel);
17+
18+
assertEquals(0, panel.getPaintComponents().size());
19+
20+
action.performAction();
21+
22+
assertEquals(1, panel.getPaintComponents().size());
23+
24+
assertTrue(panel.getPaintComponents().get(0) instanceof DataInputTextfieldPaintComponent);
25+
26+
}
27+
28+
}

src/actions/edit/undoredo/SharedUndoRedoActionManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public boolean canRedo() {
5353
public void pushUndoableAction( UndoRedoableInterface undoredoableAction ) {
5454
undoStack.push(undoredoableAction);
5555
redoStack.clear();
56-
delegate.didAddNewAction(undoredoableAction);
56+
if(delegate != null){
57+
delegate.didAddNewAction(undoredoableAction);
58+
}
5759
}
5860

5961

0 commit comments

Comments
 (0)