mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-09 00:15:48 -07:00
Generalize component/AI serialization system to any user-defined JS object. This includes Vector2D/3D, fixing an old issue. As with components/AI, JS Objects may implement a Serialize/Deserialize function to store custom data instead of the default, which attemps to serialize all enumerable properties. Fixes #4698 Differential Revision: https://code.wildfiregames.com/D2746 This was SVN commit r24462.
9 lines
243 B
JavaScript
9 lines
243 B
JavaScript
function test_serialization()
|
|
{
|
|
let test_val = new Vector2D(1, 2);
|
|
let rt = Engine.SerializationRoundTrip(test_val);
|
|
TS_ASSERT_EQUALS(test_val.constructor, rt.constructor);
|
|
TS_ASSERT_EQUALS(rt.add(test_val).x, 2);
|
|
}
|
|
|
|
test_serialization();
|