File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments