forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestSetUuidCommand.js
More file actions
executable file
·37 lines (24 loc) · 1.04 KB
/
TestSetUuidCommand.js
File metadata and controls
executable file
·37 lines (24 loc) · 1.04 KB
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
/**
* @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( "SetUuidCommand" );
test( "Test SetUuidCommand (Undo and Redo)", function() {
var editor = new Editor();
var object = aBox( 'UUID test box' );
editor.execute( new AddObjectCommand( object ) );
var uuids = [ THREE.Math.generateUUID(), THREE.Math.generateUUID(), THREE.Math.generateUUID() ];
uuids.map( function( uuid ) {
var cmd = new SetUuidCommand( object, uuid );
cmd.updatable = false;
editor.execute( cmd );
} );
ok( object.uuid == uuids[ uuids.length - 1 ],
"OK, UUID on actual object matches last UUID in the test data array " );
editor.undo();
ok( object.uuid == uuids[ uuids.length - 2 ],
"OK, UUID on actual object matches second to the last UUID in the test data array (after undo)" );
editor.redo();
ok( object.uuid == uuids[ uuids.length - 1 ],
"OK, UUID on actual object matches last UUID in the test data array again (after redo) " );
} );