forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestMassUndoAndRedo.js
More file actions
55 lines (35 loc) · 998 Bytes
/
TestMassUndoAndRedo.js
File metadata and controls
55 lines (35 loc) · 998 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* @author lxxxvi / https://github.com/lxxxvi
* Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch)
*/
module( "MassUndoAndRedo" );
test( "MassUndoAndRedo (stress test)", function() {
var editor = new Editor();
var MAX_OBJECTS = 100;
// add objects
var i = 0;
while ( i < MAX_OBJECTS ) {
var object = aSphere( 'Sphere #' + i );
var cmd = new AddObjectCommand( object );
cmd.updatable = false;
editor.execute( cmd );
i ++;
}
ok( editor.scene.children.lenght = MAX_OBJECTS,
"OK, " + MAX_OBJECTS + " objects have been added" );
// remove all objects
i = 0;
while ( i < MAX_OBJECTS ) {
editor.undo();
i ++;
}
ok( editor.scene.children.length == 0,
"OK, all objects have been removed by undos" );
i = 0;
while ( i < MAX_OBJECTS ) {
editor.redo();
i ++;
}
ok( editor.scene.children.lenght = MAX_OBJECTS,
"OK, " + MAX_OBJECTS + " objects have been added again by redos" );
} );