@fluid-experimental/property-properties 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/containerSerializer.d.ts.map +1 -1
- package/dist/containerSerializer.js +5 -5
- package/dist/containerSerializer.js.map +1 -1
- package/dist/enableValidations.js.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.js +70 -53
- package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/dist/properties/arrayProperty.d.ts.map +1 -1
- package/dist/properties/arrayProperty.js +152 -103
- package/dist/properties/arrayProperty.js.map +1 -1
- package/dist/properties/baseProperty.d.ts +4 -4
- package/dist/properties/baseProperty.d.ts.map +1 -1
- package/dist/properties/baseProperty.js +69 -47
- package/dist/properties/baseProperty.js.map +1 -1
- package/dist/properties/boolProperty.d.ts.map +1 -1
- package/dist/properties/boolProperty.js +3 -3
- package/dist/properties/boolProperty.js.map +1 -1
- package/dist/properties/containerProperty.d.ts +8 -8
- package/dist/properties/containerProperty.d.ts.map +1 -1
- package/dist/properties/containerProperty.js +33 -26
- package/dist/properties/containerProperty.js.map +1 -1
- package/dist/properties/enumArrayProperty.d.ts.map +1 -1
- package/dist/properties/enumArrayProperty.js +14 -14
- package/dist/properties/enumArrayProperty.js.map +1 -1
- package/dist/properties/enumProperty.d.ts.map +1 -1
- package/dist/properties/enumProperty.js +17 -17
- package/dist/properties/enumProperty.js.map +1 -1
- package/dist/properties/floatProperties.js +4 -4
- package/dist/properties/floatProperties.js.map +1 -1
- package/dist/properties/index.d.ts +23 -23
- package/dist/properties/index.d.ts.map +1 -1
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.js +47 -37
- package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/dist/properties/intProperties.d.ts.map +1 -1
- package/dist/properties/intProperties.js +10 -10
- package/dist/properties/intProperties.js.map +1 -1
- package/dist/properties/lazyLoadedProperties.js.map +1 -1
- package/dist/properties/mapProperty.d.ts.map +1 -1
- package/dist/properties/mapProperty.js +21 -17
- package/dist/properties/mapProperty.js.map +1 -1
- package/dist/properties/namedNodeProperty.d.ts.map +1 -1
- package/dist/properties/namedNodeProperty.js +3 -3
- package/dist/properties/namedNodeProperty.js.map +1 -1
- package/dist/properties/namedProperty.d.ts.map +1 -1
- package/dist/properties/namedProperty.js +7 -5
- package/dist/properties/namedProperty.js.map +1 -1
- package/dist/properties/nodeProperty.d.ts.map +1 -1
- package/dist/properties/nodeProperty.js +5 -3
- package/dist/properties/nodeProperty.js.map +1 -1
- package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/dist/properties/primitiveTypeCasts.js +9 -9
- package/dist/properties/primitiveTypeCasts.js.map +1 -1
- package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
- package/dist/properties/referenceArrayProperty.js +31 -25
- package/dist/properties/referenceArrayProperty.js.map +1 -1
- package/dist/properties/referenceMapProperty.d.ts.map +1 -1
- package/dist/properties/referenceMapProperty.js +18 -18
- package/dist/properties/referenceMapProperty.js.map +1 -1
- package/dist/properties/referenceProperty.d.ts.map +1 -1
- package/dist/properties/referenceProperty.js +33 -29
- package/dist/properties/referenceProperty.js.map +1 -1
- package/dist/properties/setProperty.d.ts.map +1 -1
- package/dist/properties/setProperty.js +31 -29
- package/dist/properties/setProperty.js.map +1 -1
- package/dist/properties/stringProperty.d.ts.map +1 -1
- package/dist/properties/stringProperty.js +56 -40
- package/dist/properties/stringProperty.js.map +1 -1
- package/dist/properties/uintProperties.js +5 -5
- package/dist/properties/uintProperties.js.map +1 -1
- package/dist/properties/valueArrayProperty.d.ts +1 -1
- package/dist/properties/valueArrayProperty.d.ts.map +1 -1
- package/dist/properties/valueArrayProperty.js +30 -29
- package/dist/properties/valueArrayProperty.js.map +1 -1
- package/dist/properties/valueMapProperty.d.ts.map +1 -1
- package/dist/properties/valueMapProperty.js +31 -29
- package/dist/properties/valueMapProperty.js.map +1 -1
- package/dist/properties/valueProperty.d.ts.map +1 -1
- package/dist/properties/valueProperty.js +11 -9
- package/dist/properties/valueProperty.js.map +1 -1
- package/dist/propertyFactory.d.ts.map +1 -1
- package/dist/propertyFactory.js +309 -252
- package/dist/propertyFactory.js.map +1 -1
- package/dist/propertyTemplate.d.ts +17 -17
- package/dist/propertyTemplate.d.ts.map +1 -1
- package/dist/propertyTemplate.js +64 -45
- package/dist/propertyTemplate.js.map +1 -1
- package/dist/propertyTemplateWrapper.d.ts.map +1 -1
- package/dist/propertyTemplateWrapper.js +40 -25
- package/dist/propertyTemplateWrapper.js.map +1 -1
- package/dist/propertyUtils.d.ts.map +1 -1
- package/dist/propertyUtils.js.map +1 -1
- package/dist/test/properties/arrayProperty.spec.js +566 -490
- package/dist/test/properties/arrayProperty.spec.js.map +1 -1
- package/dist/test/properties/baseProperty.spec.js +293 -280
- package/dist/test/properties/baseProperty.spec.js.map +1 -1
- package/dist/test/properties/containerProperty.spec.js +100 -94
- package/dist/test/properties/containerProperty.spec.js.map +1 -1
- package/dist/test/properties/customArrayProperty.spec.js +174 -147
- package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumArrayProperty.spec.js +67 -63
- package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumProperty.spec.js +115 -97
- package/dist/test/properties/enumProperty.spec.js.map +1 -1
- package/dist/test/properties/float32.spec.js +5 -5
- package/dist/test/properties/float32.spec.js.map +1 -1
- package/dist/test/properties/int64ArrayProperty.spec.js +157 -93
- package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/int64MapProperty.spec.js +185 -166
- package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
- package/dist/test/properties/int64Property.spec.js +109 -109
- package/dist/test/properties/int64Property.spec.js.map +1 -1
- package/dist/test/properties/isLeafNode.spec.js +75 -76
- package/dist/test/properties/isLeafNode.spec.js.map +1 -1
- package/dist/test/properties/mapProperty.spec.js +571 -531
- package/dist/test/properties/mapProperty.spec.js.map +1 -1
- package/dist/test/properties/namedNodeProperty.spec.js +31 -31
- package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
- package/dist/test/properties/nodeProperty.spec.js +805 -795
- package/dist/test/properties/nodeProperty.spec.js.map +1 -1
- package/dist/test/properties/referenceProperty.spec.js +729 -679
- package/dist/test/properties/referenceProperty.spec.js.map +1 -1
- package/dist/test/properties/relationshipProperty.spec.js +16 -16
- package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
- package/dist/test/properties/setProperty.spec.js +288 -227
- package/dist/test/properties/setProperty.spec.js.map +1 -1
- package/dist/test/properties/stringProperty.spec.js +326 -318
- package/dist/test/properties/stringProperty.spec.js.map +1 -1
- package/dist/test/properties/uint64Property.spec.js +46 -36
- package/dist/test/properties/uint64Property.spec.js.map +1 -1
- package/dist/test/properties/valueMapProperty.spec.js +259 -246
- package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
- package/dist/test/properties/valueProperty.spec.js +49 -43
- package/dist/test/properties/valueProperty.spec.js.map +1 -1
- package/dist/test/propertyFactory.spec.js +2038 -1631
- package/dist/test/propertyFactory.spec.js.map +1 -1
- package/dist/test/propertyTemplateWrapper.spec.js +72 -102
- package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
- package/dist/test/propertyUtils.spec.js +22 -21
- package/dist/test/propertyUtils.spec.js.map +1 -1
- package/dist/test/reversibleChangeset.spec.js +857 -703
- package/dist/test/reversibleChangeset.spec.js.map +1 -1
- package/dist/test/setup.js +5 -5
- package/dist/test/setup.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/utils.spec.js +1334 -1144
- package/dist/test/utils.spec.js.map +1 -1
- package/dist/test/validation/badMissingSemverInTypeid.js +20 -20
- package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/validation/badPrimitiveTypeid.js +12 -12
- package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/validation/goodColorId.js +91 -91
- package/dist/test/validation/goodColorId.js.map +1 -1
- package/dist/test/validation/goodColorPalette.js +4 -4
- package/dist/test/validation/goodColorPalette.js.map +1 -1
- package/dist/test/validation/goodPointId.js +20 -20
- package/dist/test/validation/goodPointId.js.map +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js +23841 -2
- package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
- package/lib/containerSerializer.d.ts.map +1 -1
- package/lib/containerSerializer.js +5 -5
- package/lib/containerSerializer.js.map +1 -1
- package/lib/enableValidations.js.map +1 -1
- package/lib/index.d.ts +19 -19
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -19
- package/lib/index.js.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/lib/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.js +70 -53
- package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/lib/properties/arrayProperty.d.ts.map +1 -1
- package/lib/properties/arrayProperty.js +152 -103
- package/lib/properties/arrayProperty.js.map +1 -1
- package/lib/properties/baseProperty.d.ts +4 -4
- package/lib/properties/baseProperty.d.ts.map +1 -1
- package/lib/properties/baseProperty.js +73 -51
- package/lib/properties/baseProperty.js.map +1 -1
- package/lib/properties/boolProperty.d.ts.map +1 -1
- package/lib/properties/boolProperty.js +3 -3
- package/lib/properties/boolProperty.js.map +1 -1
- package/lib/properties/containerProperty.d.ts +8 -8
- package/lib/properties/containerProperty.d.ts.map +1 -1
- package/lib/properties/containerProperty.js +33 -26
- package/lib/properties/containerProperty.js.map +1 -1
- package/lib/properties/enumArrayProperty.d.ts.map +1 -1
- package/lib/properties/enumArrayProperty.js +14 -14
- package/lib/properties/enumArrayProperty.js.map +1 -1
- package/lib/properties/enumProperty.d.ts.map +1 -1
- package/lib/properties/enumProperty.js +17 -17
- package/lib/properties/enumProperty.js.map +1 -1
- package/lib/properties/floatProperties.js +4 -4
- package/lib/properties/floatProperties.js.map +1 -1
- package/lib/properties/index.d.ts +23 -23
- package/lib/properties/index.d.ts.map +1 -1
- package/lib/properties/index.js +23 -23
- package/lib/properties/index.js.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.js +47 -37
- package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/lib/properties/intProperties.d.ts.map +1 -1
- package/lib/properties/intProperties.js +10 -10
- package/lib/properties/intProperties.js.map +1 -1
- package/lib/properties/lazyLoadedProperties.js.map +1 -1
- package/lib/properties/mapProperty.d.ts.map +1 -1
- package/lib/properties/mapProperty.js +21 -17
- package/lib/properties/mapProperty.js.map +1 -1
- package/lib/properties/namedNodeProperty.d.ts.map +1 -1
- package/lib/properties/namedNodeProperty.js +3 -3
- package/lib/properties/namedNodeProperty.js.map +1 -1
- package/lib/properties/namedProperty.d.ts.map +1 -1
- package/lib/properties/namedProperty.js +7 -5
- package/lib/properties/namedProperty.js.map +1 -1
- package/lib/properties/nodeProperty.d.ts.map +1 -1
- package/lib/properties/nodeProperty.js +5 -3
- package/lib/properties/nodeProperty.js.map +1 -1
- package/lib/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/lib/properties/primitiveTypeCasts.js +9 -9
- package/lib/properties/primitiveTypeCasts.js.map +1 -1
- package/lib/properties/referenceArrayProperty.d.ts.map +1 -1
- package/lib/properties/referenceArrayProperty.js +31 -25
- package/lib/properties/referenceArrayProperty.js.map +1 -1
- package/lib/properties/referenceMapProperty.d.ts.map +1 -1
- package/lib/properties/referenceMapProperty.js +18 -18
- package/lib/properties/referenceMapProperty.js.map +1 -1
- package/lib/properties/referenceProperty.d.ts.map +1 -1
- package/lib/properties/referenceProperty.js +33 -29
- package/lib/properties/referenceProperty.js.map +1 -1
- package/lib/properties/setProperty.d.ts.map +1 -1
- package/lib/properties/setProperty.js +31 -29
- package/lib/properties/setProperty.js.map +1 -1
- package/lib/properties/stringProperty.d.ts.map +1 -1
- package/lib/properties/stringProperty.js +56 -40
- package/lib/properties/stringProperty.js.map +1 -1
- package/lib/properties/uintProperties.js +5 -5
- package/lib/properties/uintProperties.js.map +1 -1
- package/lib/properties/valueArrayProperty.d.ts +1 -1
- package/lib/properties/valueArrayProperty.d.ts.map +1 -1
- package/lib/properties/valueArrayProperty.js +30 -29
- package/lib/properties/valueArrayProperty.js.map +1 -1
- package/lib/properties/valueMapProperty.d.ts.map +1 -1
- package/lib/properties/valueMapProperty.js +31 -29
- package/lib/properties/valueMapProperty.js.map +1 -1
- package/lib/properties/valueProperty.d.ts.map +1 -1
- package/lib/properties/valueProperty.js +11 -9
- package/lib/properties/valueProperty.js.map +1 -1
- package/lib/propertyFactory.d.ts.map +1 -1
- package/lib/propertyFactory.js +309 -252
- package/lib/propertyFactory.js.map +1 -1
- package/lib/propertyTemplate.d.ts +17 -17
- package/lib/propertyTemplate.d.ts.map +1 -1
- package/lib/propertyTemplate.js +64 -45
- package/lib/propertyTemplate.js.map +1 -1
- package/lib/propertyTemplateWrapper.d.ts.map +1 -1
- package/lib/propertyTemplateWrapper.js +40 -25
- package/lib/propertyTemplateWrapper.js.map +1 -1
- package/lib/propertyUtils.d.ts.map +1 -1
- package/lib/propertyUtils.js.map +1 -1
- package/package.json +28 -28
- package/src/index.d.ts +2750 -2681
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @fileoverview In this file, we will test the functions of the property factory.
|
|
8
8
|
*/
|
|
9
|
-
const _ = require(
|
|
10
|
-
const { ChangeSet } = require(
|
|
11
|
-
const { Int64, Uint64 } = require(
|
|
12
|
-
const { PropertyFactory } = require(
|
|
9
|
+
const _ = require("lodash");
|
|
10
|
+
const { ChangeSet } = require("@fluid-experimental/property-changeset");
|
|
11
|
+
const { Int64, Uint64 } = require("@fluid-experimental/property-common");
|
|
12
|
+
const { PropertyFactory } = require("..");
|
|
13
13
|
const deepCopy = _.cloneDeep;
|
|
14
|
-
describe(
|
|
14
|
+
describe("Reversible ChangeSets", function () {
|
|
15
15
|
var testRevAndInvCS = function (initialProperty, modificationFunction, expectedRevCS, expectedAfterCS, expectedInverseCS) {
|
|
16
16
|
var initialChangeSet = new ChangeSet(initialProperty._serialize(false));
|
|
17
17
|
initialChangeSet.setIsNormalized(true);
|
|
@@ -60,118 +60,123 @@ describe('Reversible ChangeSets', function () {
|
|
|
60
60
|
};
|
|
61
61
|
before(function () {
|
|
62
62
|
var TaskSubjectParentTemplate = {
|
|
63
|
-
typeid:
|
|
63
|
+
typeid: "autodesk.tests:ChangeSetApplyAfterTask.parentTemplate-1.0.0",
|
|
64
64
|
properties: [
|
|
65
|
-
{ id: 'directMember', typeid: 'autodesk.tests:ChangeSetApplyAfterTask.memberTemplate-1.0.0' },
|
|
66
65
|
{
|
|
67
|
-
id:
|
|
68
|
-
|
|
66
|
+
id: "directMember",
|
|
67
|
+
typeid: "autodesk.tests:ChangeSetApplyAfterTask.memberTemplate-1.0.0",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: "nested",
|
|
71
|
+
properties: [
|
|
72
|
+
{
|
|
73
|
+
id: "member",
|
|
74
|
+
typeid: "autodesk.tests:ChangeSetApplyAfterTask.nestedTemplate-1.0.0",
|
|
75
|
+
},
|
|
69
76
|
],
|
|
70
77
|
},
|
|
71
78
|
],
|
|
72
79
|
};
|
|
73
80
|
var TaskSubjectMemberTemplate = {
|
|
74
|
-
typeid:
|
|
81
|
+
typeid: "autodesk.tests:ChangeSetApplyAfterTask.memberTemplate-1.0.0",
|
|
75
82
|
properties: [
|
|
76
|
-
{ id:
|
|
77
|
-
{ id:
|
|
83
|
+
{ id: "progress", typeid: "Uint32" },
|
|
84
|
+
{ id: "timeRemaining", typeid: "Uint32" },
|
|
78
85
|
],
|
|
79
86
|
};
|
|
80
87
|
var TaskSubjectTestTemplate = {
|
|
81
|
-
typeid:
|
|
88
|
+
typeid: "autodesk.tests:ChangeSetApplyAfterTask.nodeTemplate-1.0.0",
|
|
82
89
|
properties: [
|
|
83
|
-
{ id:
|
|
84
|
-
{ id:
|
|
90
|
+
{ id: "result", typeid: "NodeProperty" },
|
|
91
|
+
{ id: "integer", typeid: "Uint32" },
|
|
85
92
|
],
|
|
86
93
|
};
|
|
87
94
|
// Register the templates from the discussion document
|
|
88
95
|
var Vec3Template = {
|
|
89
|
-
typeid:
|
|
96
|
+
typeid: "autodesk.test:vector3-1.0.0",
|
|
90
97
|
properties: [
|
|
91
|
-
{ id:
|
|
92
|
-
{ id:
|
|
93
|
-
{ id:
|
|
98
|
+
{ id: "x", typeid: "Float32" },
|
|
99
|
+
{ id: "y", typeid: "Float32" },
|
|
100
|
+
{ id: "z", typeid: "Float32" },
|
|
94
101
|
],
|
|
95
102
|
};
|
|
96
103
|
var Point2DTemplate = {
|
|
97
|
-
typeid:
|
|
104
|
+
typeid: "autodesk.test:point2d-1.0.0",
|
|
98
105
|
properties: [
|
|
99
106
|
{
|
|
100
|
-
id:
|
|
101
|
-
|
|
102
|
-
{ id:
|
|
107
|
+
id: "position",
|
|
108
|
+
properties: [
|
|
109
|
+
{ id: "x", typeid: "Float32" },
|
|
110
|
+
{ id: "y", typeid: "Float32" },
|
|
103
111
|
],
|
|
104
112
|
},
|
|
105
|
-
{ id:
|
|
106
|
-
{ id:
|
|
107
|
-
{ id:
|
|
113
|
+
{ id: "normal", typeid: "autodesk.test:vector3-1.0.0" },
|
|
114
|
+
{ id: "neighbours", typeid: "autodesk.test:vector3-1.0.0", context: "map" },
|
|
115
|
+
{ id: "temperature", typeid: "Float32" },
|
|
108
116
|
],
|
|
109
117
|
};
|
|
110
118
|
var TestArrayFloat32 = {
|
|
111
|
-
typeid:
|
|
112
|
-
properties: [
|
|
113
|
-
{ id: 'data', typeid: 'Float32', context: 'array' },
|
|
114
|
-
],
|
|
119
|
+
typeid: "autodesk.test:test.arrayfloat32-1.0.0",
|
|
120
|
+
properties: [{ id: "data", typeid: "Float32", context: "array" }],
|
|
115
121
|
};
|
|
116
122
|
var SimpleStringTestPropertyTemplate = {
|
|
117
|
-
typeid:
|
|
118
|
-
properties: [
|
|
119
|
-
{ id: 'data', typeid: 'String' },
|
|
120
|
-
],
|
|
123
|
+
typeid: "autodesk.tests:DataStringTestProperty-1.0.0",
|
|
124
|
+
properties: [{ id: "data", typeid: "String" }],
|
|
121
125
|
};
|
|
122
126
|
var SimpleRefTestPropertyTemplate = {
|
|
123
|
-
typeid:
|
|
124
|
-
properties: [
|
|
125
|
-
{ id: 'data', typeid: 'Reference' },
|
|
126
|
-
],
|
|
127
|
+
typeid: "autodesk.tests:DataRefTestProperty-1.0.0",
|
|
128
|
+
properties: [{ id: "data", typeid: "Reference" }],
|
|
127
129
|
};
|
|
128
130
|
var SimpleMapTestPropertyTemplate = {
|
|
129
|
-
typeid:
|
|
130
|
-
properties: [
|
|
131
|
-
{ id: 'data', typeid: 'Float32', context: 'map' },
|
|
132
|
-
],
|
|
131
|
+
typeid: "autodesk.tests:MapTestPropertyID-1.0.0",
|
|
132
|
+
properties: [{ id: "data", typeid: "Float32", context: "map" }],
|
|
133
133
|
};
|
|
134
134
|
var TestPropertyTemplate = {
|
|
135
|
-
typeid:
|
|
136
|
-
inherits: [
|
|
135
|
+
typeid: "autodesk.tests:MapTestNamedPropertyID-1.0.0",
|
|
136
|
+
inherits: ["NamedProperty"],
|
|
137
137
|
properties: [
|
|
138
|
-
{ id:
|
|
139
|
-
{ id:
|
|
140
|
-
{ id:
|
|
138
|
+
{ id: "stringProperty", typeid: "String" },
|
|
139
|
+
{ id: "stringProperty2", typeid: "String" },
|
|
140
|
+
{ id: "map", context: "map", typeid: "NamedProperty" },
|
|
141
141
|
],
|
|
142
142
|
};
|
|
143
143
|
var AnonymousTestPropertyTemplate = {
|
|
144
|
-
typeid:
|
|
145
|
-
properties: [
|
|
146
|
-
{ id: 'stringProperty', typeid: 'String' },
|
|
147
|
-
],
|
|
144
|
+
typeid: "autodesk.tests:AnonymousMapTestPropertyID-1.0.0",
|
|
145
|
+
properties: [{ id: "stringProperty", typeid: "String" }],
|
|
148
146
|
};
|
|
149
147
|
var CuststomArrayTemplate = {
|
|
150
|
-
typeid:
|
|
148
|
+
typeid: "autodesk.tests:CustomArrayChangesetTestID-1.0.0",
|
|
151
149
|
properties: [
|
|
152
|
-
{
|
|
150
|
+
{
|
|
151
|
+
id: "data",
|
|
152
|
+
typeid: "autodesk.tests:AnonymousMapTestPropertyID-1.0.0",
|
|
153
|
+
context: "array",
|
|
154
|
+
},
|
|
153
155
|
],
|
|
154
156
|
};
|
|
155
157
|
var TestEnumTemplate = {
|
|
156
|
-
typeid:
|
|
157
|
-
inherits:
|
|
158
|
-
annotation: { description:
|
|
158
|
+
typeid: "autodesk.core:UnitsEnum-1.0.0",
|
|
159
|
+
inherits: "Enum",
|
|
160
|
+
annotation: { description: "The metric units" },
|
|
159
161
|
properties: [
|
|
160
|
-
{ id:
|
|
161
|
-
{ id:
|
|
162
|
-
{ id:
|
|
162
|
+
{ id: "m", value: 1, annotation: { description: "meter" } },
|
|
163
|
+
{ id: "cm", value: 2, annotation: { description: "centimeter" } },
|
|
164
|
+
{ id: "mm", value: 3, annotation: { description: "millimeter" } },
|
|
163
165
|
],
|
|
164
166
|
};
|
|
165
167
|
PropertyFactory._reregister(TestEnumTemplate);
|
|
166
168
|
var TestBaseContainingEnumTemplate = {
|
|
167
|
-
typeid:
|
|
168
|
-
properties: [
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
typeid: "autodesk.core:CustomWithEnumID-1.0.0",
|
|
170
|
+
properties: [
|
|
171
|
+
{
|
|
172
|
+
id: "data",
|
|
173
|
+
typeid: "autodesk.core:UnitsEnum-1.0.0",
|
|
174
|
+
},
|
|
175
|
+
],
|
|
171
176
|
};
|
|
172
177
|
var TestInheritsNodePropertyObject = {
|
|
173
|
-
inherits: [
|
|
174
|
-
typeid:
|
|
178
|
+
inherits: ["NodeProperty"],
|
|
179
|
+
typeid: "autodesk.tests:SimpleInheritsNodeProperty-1.0.0",
|
|
175
180
|
};
|
|
176
181
|
PropertyFactory._reregister(TestInheritsNodePropertyObject);
|
|
177
182
|
PropertyFactory._reregister(TestEnumTemplate);
|
|
@@ -189,148 +194,200 @@ describe('Reversible ChangeSets', function () {
|
|
|
189
194
|
PropertyFactory._reregister(TaskSubjectTestTemplate);
|
|
190
195
|
PropertyFactory._reregister(TestArrayFloat32);
|
|
191
196
|
});
|
|
192
|
-
describe(
|
|
193
|
-
it(
|
|
194
|
-
var prop = PropertyFactory.create(
|
|
195
|
-
testRevAndInvCS(prop, function () {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
});
|
|
205
|
-
it(
|
|
206
|
-
var prop = PropertyFactory.create(
|
|
207
|
-
testRevAndInvCS(prop, function () {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
});
|
|
217
|
-
it(
|
|
218
|
-
var prop = PropertyFactory.create(
|
|
219
|
-
testRevAndInvCS(prop, function () {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
});
|
|
229
|
-
it(
|
|
230
|
-
var prop = PropertyFactory.create(
|
|
231
|
-
testRevAndInvCS(prop, function () {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
197
|
+
describe("Make inversible, apply and reverse for primitive properties.", function () {
|
|
198
|
+
it("should work for modifying Int8", function () {
|
|
199
|
+
var prop = PropertyFactory.create("Int8");
|
|
200
|
+
testRevAndInvCS(prop, function () {
|
|
201
|
+
prop.setValue(10);
|
|
202
|
+
}, { oldValue: 0, value: 10 }, 10, { oldValue: 10, value: 0 });
|
|
203
|
+
});
|
|
204
|
+
it("should work for modifying Uint8", function () {
|
|
205
|
+
var prop = PropertyFactory.create("Uint8");
|
|
206
|
+
testRevAndInvCS(prop, function () {
|
|
207
|
+
prop.setValue(10);
|
|
208
|
+
}, { oldValue: 0, value: 10 }, 10, { oldValue: 10, value: 0 });
|
|
209
|
+
});
|
|
210
|
+
it("should work for modifying Int16", function () {
|
|
211
|
+
var prop = PropertyFactory.create("Int16");
|
|
212
|
+
testRevAndInvCS(prop, function () {
|
|
213
|
+
prop.setValue(10);
|
|
214
|
+
}, { oldValue: 0, value: 10 }, 10, { oldValue: 10, value: 0 });
|
|
215
|
+
});
|
|
216
|
+
it("should work for modifying Uint16", function () {
|
|
217
|
+
var prop = PropertyFactory.create("Uint16");
|
|
218
|
+
testRevAndInvCS(prop, function () {
|
|
219
|
+
prop.setValue(10);
|
|
220
|
+
}, { oldValue: 0, value: 10 }, 10, { oldValue: 10, value: 0 });
|
|
221
|
+
});
|
|
222
|
+
it("should work for modifying Int32", function () {
|
|
223
|
+
var prop = PropertyFactory.create("Int32");
|
|
224
|
+
testRevAndInvCS(prop, function () {
|
|
225
|
+
prop.setValue(10);
|
|
226
|
+
}, { oldValue: 0, value: 10 }, 10, { oldValue: 10, value: 0 });
|
|
227
|
+
});
|
|
228
|
+
it("should work for modifying Uint32", function () {
|
|
229
|
+
var prop = PropertyFactory.create("Uint32");
|
|
230
|
+
testRevAndInvCS(prop, function () {
|
|
231
|
+
prop.setValue(10);
|
|
232
|
+
}, { oldValue: 0, value: 10 }, 10, { oldValue: 10, value: 0 });
|
|
233
|
+
});
|
|
234
|
+
it("should work for modifying Int64", function () {
|
|
235
|
+
var prop = PropertyFactory.create("Int64");
|
|
236
|
+
testRevAndInvCS(prop, function () {
|
|
237
|
+
prop.setValue(new Int64(10, 10));
|
|
238
|
+
}, { oldValue: [0, 0], value: [10, 10] }, [10, 10], { oldValue: [10, 10], value: [0, 0] });
|
|
239
|
+
});
|
|
240
|
+
it("should work for modifying Uint64", function () {
|
|
241
|
+
var prop = PropertyFactory.create("Uint64");
|
|
242
|
+
testRevAndInvCS(prop, function () {
|
|
243
|
+
prop.setValue(new Uint64(10, 10));
|
|
244
|
+
}, { oldValue: [0, 0], value: [10, 10] }, [10, 10], { oldValue: [10, 10], value: [0, 0] });
|
|
245
|
+
});
|
|
246
|
+
it("should work for modifying Float32", function () {
|
|
247
|
+
var prop = PropertyFactory.create("Float32");
|
|
248
|
+
testRevAndInvCS(prop, function () {
|
|
249
|
+
prop.setValue(0.5);
|
|
250
|
+
}, { oldValue: 0, value: 0.5 }, 0.5, { oldValue: 0.5, value: 0 });
|
|
251
|
+
});
|
|
252
|
+
it("should work for modifying Float64", function () {
|
|
253
|
+
var prop = PropertyFactory.create("Float64");
|
|
254
|
+
testRevAndInvCS(prop, function () {
|
|
255
|
+
prop.setValue(0.5);
|
|
256
|
+
}, { oldValue: 0, value: 0.5 }, 0.5, { oldValue: 0.5, value: 0 });
|
|
257
|
+
});
|
|
258
|
+
it("should work for modifying Bool", function () {
|
|
259
|
+
var prop = PropertyFactory.create("Bool");
|
|
260
|
+
testRevAndInvCS(prop, function () {
|
|
261
|
+
prop.setValue(true);
|
|
262
|
+
}, { oldValue: false, value: true }, true, { oldValue: true, value: false });
|
|
236
263
|
});
|
|
237
264
|
// These tests have been disabled, since the interface of
|
|
238
265
|
// the ChangeSet class is ambiguous when inserting a string
|
|
239
|
-
it.skip(
|
|
240
|
-
var prop = PropertyFactory.create(
|
|
241
|
-
testRevAndInvCS(prop, function () {
|
|
266
|
+
it.skip("@bugfix should work for modifying String", function () {
|
|
267
|
+
var prop = PropertyFactory.create("String");
|
|
268
|
+
testRevAndInvCS(prop, function () {
|
|
269
|
+
prop.setValue("test");
|
|
270
|
+
}, { oldValue: "", value: "test" }, "test", { oldValue: "test", value: "" });
|
|
242
271
|
});
|
|
243
272
|
// These tests have been disabled, since the interface of
|
|
244
273
|
// the ChangeSet class is ambiguous when inserting a string
|
|
245
|
-
it.skip(
|
|
246
|
-
var prop = PropertyFactory.create(
|
|
247
|
-
testRevAndInvCS(prop, function () {
|
|
274
|
+
it.skip("@bugfix should work for modifying Reference", function () {
|
|
275
|
+
var prop = PropertyFactory.create("Reference");
|
|
276
|
+
testRevAndInvCS(prop, function () {
|
|
277
|
+
prop.setValue("/");
|
|
278
|
+
}, { oldValue: "", value: "/" }, "/", { oldValue: "/", value: "" });
|
|
248
279
|
});
|
|
249
280
|
});
|
|
250
|
-
describe(
|
|
251
|
-
it(
|
|
252
|
-
var node = PropertyFactory.create(
|
|
253
|
-
var prop = PropertyFactory.create(
|
|
254
|
-
node.insert(
|
|
255
|
-
testRevAndInvCS(node, function () {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
node.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
});
|
|
275
|
-
it(
|
|
276
|
-
var node = PropertyFactory.create(
|
|
277
|
-
var prop = PropertyFactory.create(
|
|
278
|
-
node.insert(
|
|
279
|
-
testRevAndInvCS(node, function () {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
node.
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
});
|
|
299
|
-
it(
|
|
300
|
-
var node = PropertyFactory.create(
|
|
301
|
-
var prop = PropertyFactory.create(
|
|
302
|
-
node.insert(
|
|
303
|
-
testRevAndInvCS(node, function () {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
node.
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
});
|
|
323
|
-
it(
|
|
324
|
-
var node = PropertyFactory.create(
|
|
325
|
-
var prop = PropertyFactory.create(
|
|
326
|
-
node.insert(
|
|
327
|
-
testRevAndInvCS(node, function () {
|
|
281
|
+
describe("Make inversible, apply and reverse for primitive properties in a NodeProperty.", function () {
|
|
282
|
+
it("should work for modifying Int8", function () {
|
|
283
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
284
|
+
var prop = PropertyFactory.create("Int8");
|
|
285
|
+
node.insert("prop", prop);
|
|
286
|
+
testRevAndInvCS(node, function () {
|
|
287
|
+
prop.setValue(10);
|
|
288
|
+
}, { modify: { Int8: { prop: { oldValue: 0, value: 10 } } } }, { insert: { Int8: { prop: 10 } } }, { modify: { Int8: { prop: { oldValue: 10, value: 0 } } } });
|
|
289
|
+
});
|
|
290
|
+
it("should work for modifying Uint8", function () {
|
|
291
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
292
|
+
var prop = PropertyFactory.create("Uint8");
|
|
293
|
+
node.insert("prop", prop);
|
|
294
|
+
testRevAndInvCS(node, function () {
|
|
295
|
+
prop.setValue(10);
|
|
296
|
+
}, { modify: { Uint8: { prop: { oldValue: 0, value: 10 } } } }, { insert: { Uint8: { prop: 10 } } }, { modify: { Uint8: { prop: { oldValue: 10, value: 0 } } } });
|
|
297
|
+
});
|
|
298
|
+
it("should work for modifying Int16", function () {
|
|
299
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
300
|
+
var prop = PropertyFactory.create("Int16");
|
|
301
|
+
node.insert("prop", prop);
|
|
302
|
+
testRevAndInvCS(node, function () {
|
|
303
|
+
prop.setValue(10);
|
|
304
|
+
}, { modify: { Int16: { prop: { oldValue: 0, value: 10 } } } }, { insert: { Int16: { prop: 10 } } }, { modify: { Int16: { prop: { oldValue: 10, value: 0 } } } });
|
|
305
|
+
});
|
|
306
|
+
it("should work for modifying Uint16", function () {
|
|
307
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
308
|
+
var prop = PropertyFactory.create("Uint16");
|
|
309
|
+
node.insert("prop", prop);
|
|
310
|
+
testRevAndInvCS(node, function () {
|
|
311
|
+
prop.setValue(10);
|
|
312
|
+
}, { modify: { Uint16: { prop: { oldValue: 0, value: 10 } } } }, { insert: { Uint16: { prop: 10 } } }, { modify: { Uint16: { prop: { oldValue: 10, value: 0 } } } });
|
|
313
|
+
});
|
|
314
|
+
it("should work for modifying Int32", function () {
|
|
315
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
316
|
+
var prop = PropertyFactory.create("Int32");
|
|
317
|
+
node.insert("prop", prop);
|
|
318
|
+
testRevAndInvCS(node, function () {
|
|
319
|
+
prop.setValue(10);
|
|
320
|
+
}, { modify: { Int32: { prop: { oldValue: 0, value: 10 } } } }, { insert: { Int32: { prop: 10 } } }, { modify: { Int32: { prop: { oldValue: 10, value: 0 } } } });
|
|
321
|
+
});
|
|
322
|
+
it("should work for modifying Uint32", function () {
|
|
323
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
324
|
+
var prop = PropertyFactory.create("Uint32");
|
|
325
|
+
node.insert("prop", prop);
|
|
326
|
+
testRevAndInvCS(node, function () {
|
|
327
|
+
prop.setValue(10);
|
|
328
|
+
}, { modify: { Uint32: { prop: { oldValue: 0, value: 10 } } } }, { insert: { Uint32: { prop: 10 } } }, { modify: { Uint32: { prop: { oldValue: 10, value: 0 } } } });
|
|
329
|
+
});
|
|
330
|
+
it("should work for modifying Int64", function () {
|
|
331
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
332
|
+
var prop = PropertyFactory.create("Int64");
|
|
333
|
+
node.insert("prop", prop);
|
|
334
|
+
testRevAndInvCS(node, function () {
|
|
335
|
+
prop.setValue(new Int64(10, 10));
|
|
336
|
+
}, { modify: { Int64: { prop: { oldValue: [0, 0], value: [10, 10] } } } }, { insert: { Int64: { prop: [10, 10] } } }, { modify: { Int64: { prop: { oldValue: [10, 10], value: [0, 0] } } } });
|
|
337
|
+
});
|
|
338
|
+
it("should work for modifying Uint64", function () {
|
|
339
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
340
|
+
var prop = PropertyFactory.create("Uint64");
|
|
341
|
+
node.insert("prop", prop);
|
|
342
|
+
testRevAndInvCS(node, function () {
|
|
343
|
+
prop.setValue(new Uint64(10, 10));
|
|
344
|
+
}, { modify: { Uint64: { prop: { oldValue: [0, 0], value: [10, 10] } } } }, { insert: { Uint64: { prop: [10, 10] } } }, { modify: { Uint64: { prop: { oldValue: [10, 10], value: [0, 0] } } } });
|
|
345
|
+
});
|
|
346
|
+
it("should work for modifying Float32", function () {
|
|
347
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
348
|
+
var prop = PropertyFactory.create("Float32");
|
|
349
|
+
node.insert("prop", prop);
|
|
350
|
+
testRevAndInvCS(node, function () {
|
|
351
|
+
prop.setValue(0.5);
|
|
352
|
+
}, { modify: { Float32: { prop: { oldValue: 0, value: 0.5 } } } }, { insert: { Float32: { prop: 0.5 } } }, { modify: { Float32: { prop: { oldValue: 0.5, value: 0 } } } });
|
|
353
|
+
});
|
|
354
|
+
it("should work for modifying Float64", function () {
|
|
355
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
356
|
+
var prop = PropertyFactory.create("Float64");
|
|
357
|
+
node.insert("prop", prop);
|
|
358
|
+
testRevAndInvCS(node, function () {
|
|
359
|
+
prop.setValue(0.5);
|
|
360
|
+
}, { modify: { Float64: { prop: { oldValue: 0, value: 0.5 } } } }, { insert: { Float64: { prop: 0.5 } } }, { modify: { Float64: { prop: { oldValue: 0.5, value: 0 } } } });
|
|
361
|
+
});
|
|
362
|
+
it("should work for modifying Bool", function () {
|
|
363
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
364
|
+
var prop = PropertyFactory.create("Bool");
|
|
365
|
+
node.insert("prop", prop);
|
|
366
|
+
testRevAndInvCS(node, function () {
|
|
367
|
+
prop.setValue(true);
|
|
368
|
+
}, { modify: { Bool: { prop: { oldValue: false, value: true } } } }, { insert: { Bool: { prop: true } } }, { modify: { Bool: { prop: { oldValue: true, value: false } } } });
|
|
369
|
+
});
|
|
370
|
+
it("should work for modifying String", function () {
|
|
371
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
372
|
+
var prop = PropertyFactory.create("String");
|
|
373
|
+
node.insert("prop", prop);
|
|
374
|
+
testRevAndInvCS(node, function () {
|
|
375
|
+
prop.setValue("test");
|
|
376
|
+
}, { modify: { String: { prop: { oldValue: "", value: "test" } } } }, { insert: { String: { prop: "test" } } }, { modify: { String: { prop: { oldValue: "test", value: "" } } } });
|
|
377
|
+
});
|
|
378
|
+
it("should work for modifying Reference", function () {
|
|
379
|
+
var node = PropertyFactory.create("NodeProperty");
|
|
380
|
+
var prop = PropertyFactory.create("Reference");
|
|
381
|
+
node.insert("prop", prop);
|
|
382
|
+
testRevAndInvCS(node, function () {
|
|
383
|
+
prop.setValue("/");
|
|
384
|
+
}, { modify: { Reference: { prop: { oldValue: "", value: "/" } } } }, { insert: { Reference: { prop: "/" } } }, { modify: { Reference: { prop: { oldValue: "/", value: "" } } } });
|
|
328
385
|
});
|
|
329
386
|
});
|
|
330
|
-
describe(
|
|
331
|
-
it(
|
|
332
|
-
var prop = PropertyFactory.create(
|
|
333
|
-
var propCopy = PropertyFactory.create(
|
|
387
|
+
describe("apply reversible ChangeSets on all properties", function () {
|
|
388
|
+
it("should work for primitive properties", function () {
|
|
389
|
+
var prop = PropertyFactory.create("autodesk.test:vector3-1.0.0");
|
|
390
|
+
var propCopy = PropertyFactory.create("autodesk.test:vector3-1.0.0");
|
|
334
391
|
prop._properties.x.value = 2;
|
|
335
392
|
var changeSet = new ChangeSet(prop._serialize(true));
|
|
336
393
|
changeSet._toReversibleChangeSet(propCopy._serialize(false));
|
|
@@ -338,24 +395,24 @@ describe('Reversible ChangeSets', function () {
|
|
|
338
395
|
expect(prop._serialize()).to.deep.equal(propCopy._serialize());
|
|
339
396
|
expect(prop._serialize(true)).to.deep.equal(propCopy._serialize(true));
|
|
340
397
|
});
|
|
341
|
-
it(
|
|
342
|
-
var prop = PropertyFactory.create(
|
|
343
|
-
var propCopy = PropertyFactory.create(
|
|
344
|
-
prop._properties.data.value =
|
|
398
|
+
it("should work for string properties", function () {
|
|
399
|
+
var prop = PropertyFactory.create("autodesk.tests:DataStringTestProperty-1.0.0");
|
|
400
|
+
var propCopy = PropertyFactory.create("autodesk.tests:DataStringTestProperty-1.0.0");
|
|
401
|
+
prop._properties.data.value = "A";
|
|
345
402
|
var changeSet = new ChangeSet(prop._serialize(true));
|
|
346
403
|
changeSet._toReversibleChangeSet(propCopy._serialize(false));
|
|
347
404
|
propCopy.applyChangeSet(changeSet.getSerializedChangeSet());
|
|
348
405
|
expect(prop._serialize()).to.deep.equal(propCopy._serialize());
|
|
349
406
|
expect(prop._serialize(true)).to.deep.equal(propCopy._serialize(true));
|
|
350
407
|
});
|
|
351
|
-
it(
|
|
352
|
-
var root = PropertyFactory.create(
|
|
353
|
-
var prop = PropertyFactory.create(
|
|
354
|
-
var propCopy = PropertyFactory.create(
|
|
355
|
-
var target = PropertyFactory.create(
|
|
356
|
-
root.insert(
|
|
357
|
-
root.insert(
|
|
358
|
-
root.insert(
|
|
408
|
+
it("should work for reference properties", function () {
|
|
409
|
+
var root = PropertyFactory.create("NodeProperty");
|
|
410
|
+
var prop = PropertyFactory.create("autodesk.tests:DataRefTestProperty-1.0.0");
|
|
411
|
+
var propCopy = PropertyFactory.create("autodesk.tests:DataRefTestProperty-1.0.0");
|
|
412
|
+
var target = PropertyFactory.create("String");
|
|
413
|
+
root.insert("target", target);
|
|
414
|
+
root.insert("reference", prop);
|
|
415
|
+
root.insert("referenceCopy", propCopy);
|
|
359
416
|
prop._properties.data.set(target);
|
|
360
417
|
var changeSet = new ChangeSet(prop._serialize(true));
|
|
361
418
|
changeSet._toReversibleChangeSet(propCopy._serialize(false));
|
|
@@ -363,291 +420,316 @@ describe('Reversible ChangeSets', function () {
|
|
|
363
420
|
expect(prop._serialize()).to.deep.equal(propCopy._serialize());
|
|
364
421
|
expect(prop._serialize(true)).to.deep.equal(propCopy._serialize(true));
|
|
365
422
|
});
|
|
366
|
-
it(
|
|
367
|
-
var prop = PropertyFactory.create(
|
|
368
|
-
var propCopy = PropertyFactory.create(
|
|
369
|
-
prop._properties.data.value =
|
|
423
|
+
it("should work for enum properties", function () {
|
|
424
|
+
var prop = PropertyFactory.create("autodesk.core:CustomWithEnumID-1.0.0");
|
|
425
|
+
var propCopy = PropertyFactory.create("autodesk.core:CustomWithEnumID-1.0.0");
|
|
426
|
+
prop._properties.data.value = "cm";
|
|
370
427
|
var changeSet = new ChangeSet(prop._serialize(true));
|
|
371
428
|
changeSet._toReversibleChangeSet(propCopy._serialize(false));
|
|
372
429
|
propCopy.applyChangeSet(changeSet.getSerializedChangeSet());
|
|
373
430
|
expect(prop._serialize()).to.deep.equal(propCopy._serialize());
|
|
374
431
|
expect(prop._serialize(true)).to.deep.equal(propCopy._serialize(true));
|
|
375
432
|
});
|
|
376
|
-
it(
|
|
377
|
-
var prop = PropertyFactory.create(
|
|
378
|
-
var propCopy = PropertyFactory.create(
|
|
379
|
-
var A = PropertyFactory.create(
|
|
380
|
-
var B = PropertyFactory.create(
|
|
381
|
-
var C = PropertyFactory.create(
|
|
382
|
-
prop._properties.map.insert(
|
|
383
|
-
prop._properties.map.insert(
|
|
384
|
-
prop._properties.map.insert(
|
|
433
|
+
it("should work for indexed collections of complex types", function () {
|
|
434
|
+
var prop = PropertyFactory.create("autodesk.tests:MapTestNamedPropertyID-1.0.0");
|
|
435
|
+
var propCopy = PropertyFactory.create("autodesk.tests:MapTestNamedPropertyID-1.0.0");
|
|
436
|
+
var A = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
437
|
+
var B = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
438
|
+
var C = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
439
|
+
prop._properties.map.insert("A", A);
|
|
440
|
+
prop._properties.map.insert("B", B);
|
|
441
|
+
prop._properties.map.insert("C", C);
|
|
385
442
|
propCopy.deserialize(prop._serialize());
|
|
386
443
|
prop.cleanDirty();
|
|
387
444
|
propCopy.cleanDirty();
|
|
388
|
-
prop._properties.map.remove(
|
|
389
|
-
prop._properties.map.get(
|
|
445
|
+
prop._properties.map.remove("B");
|
|
446
|
+
prop._properties.map.get("A")._properties.stringProperty.value = "hello";
|
|
390
447
|
var changeSet = new ChangeSet(prop._serialize(true));
|
|
391
448
|
changeSet._toReversibleChangeSet(propCopy._serialize(false));
|
|
392
449
|
propCopy.applyChangeSet(changeSet.getSerializedChangeSet());
|
|
393
450
|
expect(prop._serialize()).to.deep.equal(propCopy._serialize());
|
|
394
451
|
expect(prop._serialize(true)).to.deep.equal(propCopy._serialize(true));
|
|
395
452
|
});
|
|
396
|
-
it(
|
|
397
|
-
var prop = PropertyFactory.create(
|
|
398
|
-
var propCopy = PropertyFactory.create(
|
|
399
|
-
prop._properties.data.insert(
|
|
400
|
-
prop._properties.data.insert(
|
|
401
|
-
prop._properties.data.insert(
|
|
453
|
+
it("should work for indexed collections of primitive types", function () {
|
|
454
|
+
var prop = PropertyFactory.create("autodesk.tests:MapTestPropertyID-1.0.0");
|
|
455
|
+
var propCopy = PropertyFactory.create("autodesk.tests:MapTestPropertyID-1.0.0");
|
|
456
|
+
prop._properties.data.insert("A", 1);
|
|
457
|
+
prop._properties.data.insert("B", 2);
|
|
458
|
+
prop._properties.data.insert("C", 3);
|
|
402
459
|
propCopy.deserialize(prop._serialize());
|
|
403
460
|
prop.cleanDirty();
|
|
404
461
|
propCopy.cleanDirty();
|
|
405
|
-
prop._properties.data.remove(
|
|
406
|
-
prop._properties.data.set(
|
|
462
|
+
prop._properties.data.remove("B");
|
|
463
|
+
prop._properties.data.set("C", 99);
|
|
407
464
|
var changeSet = new ChangeSet(prop._serialize(true));
|
|
408
465
|
changeSet._toReversibleChangeSet(propCopy._serialize(false));
|
|
409
466
|
propCopy.applyChangeSet(changeSet.getSerializedChangeSet());
|
|
410
467
|
expect(prop._serialize()).to.deep.equal(propCopy._serialize());
|
|
411
468
|
expect(prop._serialize(true)).to.deep.equal(propCopy._serialize(true));
|
|
412
469
|
});
|
|
413
|
-
it(
|
|
414
|
-
var prop = PropertyFactory.create(
|
|
415
|
-
var propCopy = PropertyFactory.create(
|
|
416
|
-
var A = PropertyFactory.create(
|
|
417
|
-
var B = PropertyFactory.create(
|
|
418
|
-
var C = PropertyFactory.create(
|
|
470
|
+
it("should work for custom array properties", function () {
|
|
471
|
+
var prop = PropertyFactory.create("autodesk.tests:CustomArrayChangesetTestID-1.0.0");
|
|
472
|
+
var propCopy = PropertyFactory.create("autodesk.tests:CustomArrayChangesetTestID-1.0.0");
|
|
473
|
+
var A = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
474
|
+
var B = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
475
|
+
var C = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
419
476
|
prop._properties.data.insertRange(0, [A, B, C]);
|
|
420
477
|
propCopy.deserialize(prop.serialize());
|
|
421
478
|
prop.cleanDirty();
|
|
422
479
|
propCopy.cleanDirty();
|
|
423
|
-
prop._properties.data.get(2)._properties.stringProperty.value =
|
|
480
|
+
prop._properties.data.get(2)._properties.stringProperty.value = "hello";
|
|
424
481
|
prop._properties.data.removeRange(1, 1);
|
|
425
|
-
var changeSet = new ChangeSet(prop.serialize({
|
|
426
|
-
var baseState = propCopy.serialize({
|
|
482
|
+
var changeSet = new ChangeSet(prop.serialize({ dirtyOnly: true }));
|
|
483
|
+
var baseState = propCopy.serialize({ dirtyOnly: false });
|
|
427
484
|
changeSet._toReversibleChangeSet(baseState);
|
|
428
485
|
propCopy.applyChangeSet(changeSet.getSerializedChangeSet());
|
|
429
486
|
expect(prop.serialize()).to.deep.equal(propCopy.serialize());
|
|
430
|
-
expect(prop.serialize({
|
|
487
|
+
expect(prop.serialize({ dirtyOnly: true })).to.deep.equal(propCopy.serialize({ dirtyOnly: true }));
|
|
431
488
|
});
|
|
432
|
-
it(
|
|
433
|
-
var prop = PropertyFactory.create(
|
|
434
|
-
var propCopy = PropertyFactory.create(
|
|
489
|
+
it("should work for primitive array properties", function () {
|
|
490
|
+
var prop = PropertyFactory.create("autodesk.test:test.arrayfloat32-1.0.0");
|
|
491
|
+
var propCopy = PropertyFactory.create("autodesk.test:test.arrayfloat32-1.0.0");
|
|
435
492
|
prop._properties.data.insertRange(0, [10, 11, 12, 13, 14, 15, 16]);
|
|
436
493
|
propCopy._properties.data.insertRange(0, [10, 11, 12, 13, 14, 15, 16]);
|
|
437
494
|
prop.cleanDirty();
|
|
438
495
|
propCopy.cleanDirty();
|
|
439
496
|
prop._properties.data.setRange(4, [24, 25]);
|
|
440
497
|
prop._properties.data.removeRange(1, 2);
|
|
441
|
-
var changeSet = new ChangeSet(prop.serialize({
|
|
442
|
-
changeSet._toReversibleChangeSet(propCopy.serialize({
|
|
498
|
+
var changeSet = new ChangeSet(prop.serialize({ dirtyOnly: true }));
|
|
499
|
+
changeSet._toReversibleChangeSet(propCopy.serialize({ dirtyOnly: false }));
|
|
443
500
|
propCopy.applyChangeSet(changeSet.getSerializedChangeSet());
|
|
444
501
|
expect(prop.serialize()).to.deep.equal(propCopy.serialize());
|
|
445
|
-
expect(prop.serialize({
|
|
446
|
-
});
|
|
447
|
-
it(
|
|
448
|
-
var prop = PropertyFactory.create(
|
|
449
|
-
var propCopy = PropertyFactory.create(
|
|
450
|
-
var A = PropertyFactory.create(
|
|
451
|
-
var B = PropertyFactory.create(
|
|
452
|
-
var C = PropertyFactory.create(
|
|
453
|
-
var D = PropertyFactory.create(
|
|
454
|
-
prop.insert(
|
|
455
|
-
prop.insert(
|
|
456
|
-
prop.insert(
|
|
457
|
-
prop.insert(
|
|
458
|
-
var initialChangeset = prop.serialize({
|
|
502
|
+
expect(prop.serialize({ dirtyOnly: true })).to.deep.equal(propCopy.serialize({ dirtyOnly: true }));
|
|
503
|
+
});
|
|
504
|
+
it("should work for node properties", function () {
|
|
505
|
+
var prop = PropertyFactory.create("NodeProperty");
|
|
506
|
+
var propCopy = PropertyFactory.create("NodeProperty");
|
|
507
|
+
var A = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
508
|
+
var B = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
509
|
+
var C = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
510
|
+
var D = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
511
|
+
prop.insert("A", A);
|
|
512
|
+
prop.insert("B", B);
|
|
513
|
+
prop.insert("C", C);
|
|
514
|
+
prop.insert("D", D);
|
|
515
|
+
var initialChangeset = prop.serialize({ dirtyOnly: false });
|
|
459
516
|
propCopy.deserialize(initialChangeset);
|
|
460
517
|
prop.cleanDirty();
|
|
461
518
|
propCopy.cleanDirty();
|
|
462
|
-
prop._properties.A.stringProperty.value =
|
|
463
|
-
prop.remove(
|
|
464
|
-
prop.remove(
|
|
465
|
-
var changeSet = new ChangeSet(prop.serialize({
|
|
519
|
+
prop._properties.A.stringProperty.value = "test";
|
|
520
|
+
prop.remove("B");
|
|
521
|
+
prop.remove("C");
|
|
522
|
+
var changeSet = new ChangeSet(prop.serialize({ dirtyOnly: true }));
|
|
466
523
|
changeSet._toReversibleChangeSet(initialChangeset);
|
|
467
524
|
propCopy.applyChangeSet(changeSet.getSerializedChangeSet());
|
|
468
525
|
expect(prop.serialize()).to.deep.equal(propCopy.serialize());
|
|
469
|
-
expect(prop.serialize({
|
|
470
|
-
});
|
|
471
|
-
it(
|
|
472
|
-
var root = PropertyFactory.create(
|
|
473
|
-
var prop = PropertyFactory.create(
|
|
474
|
-
root.insert(
|
|
475
|
-
var rootCopy = PropertyFactory.create(
|
|
476
|
-
var propCopy = PropertyFactory.create(
|
|
477
|
-
rootCopy.insert(
|
|
478
|
-
var A = PropertyFactory.create(
|
|
479
|
-
var B = PropertyFactory.create(
|
|
480
|
-
var C = PropertyFactory.create(
|
|
481
|
-
var D = PropertyFactory.create(
|
|
482
|
-
prop.insert(
|
|
483
|
-
prop.insert(
|
|
484
|
-
prop.insert(
|
|
485
|
-
prop.insert(
|
|
486
|
-
var initialChangeset = root.serialize({
|
|
526
|
+
expect(prop.serialize({ dirtyOnly: true })).to.deep.equal(propCopy.serialize({ dirtyOnly: true }));
|
|
527
|
+
});
|
|
528
|
+
it("should work for inherits node properties", function () {
|
|
529
|
+
var root = PropertyFactory.create("NodeProperty");
|
|
530
|
+
var prop = PropertyFactory.create("autodesk.tests:SimpleInheritsNodeProperty-1.0.0");
|
|
531
|
+
root.insert("prop", prop);
|
|
532
|
+
var rootCopy = PropertyFactory.create("NodeProperty");
|
|
533
|
+
var propCopy = PropertyFactory.create("autodesk.tests:SimpleInheritsNodeProperty-1.0.0");
|
|
534
|
+
rootCopy.insert("prop", propCopy);
|
|
535
|
+
var A = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
536
|
+
var B = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
537
|
+
var C = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
538
|
+
var D = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
539
|
+
prop.insert("A", A);
|
|
540
|
+
prop.insert("B", B);
|
|
541
|
+
prop.insert("C", C);
|
|
542
|
+
prop.insert("D", D);
|
|
543
|
+
var initialChangeset = root.serialize({ dirtyOnly: false });
|
|
487
544
|
rootCopy.deserialize(initialChangeset);
|
|
488
545
|
root.cleanDirty();
|
|
489
546
|
rootCopy.cleanDirty();
|
|
490
|
-
prop._properties.A.stringProperty.value =
|
|
491
|
-
prop.remove(
|
|
492
|
-
prop.remove(
|
|
493
|
-
var changeSet = new ChangeSet(root.serialize({
|
|
547
|
+
prop._properties.A.stringProperty.value = "test";
|
|
548
|
+
prop.remove("B");
|
|
549
|
+
prop.remove("C");
|
|
550
|
+
var changeSet = new ChangeSet(root.serialize({ dirtyOnly: true }));
|
|
494
551
|
changeSet._toReversibleChangeSet(initialChangeset);
|
|
495
552
|
rootCopy.applyChangeSet(changeSet.getSerializedChangeSet());
|
|
496
553
|
expect(root.serialize()).to.deep.equal(rootCopy.serialize());
|
|
497
|
-
expect(root.serialize({
|
|
554
|
+
expect(root.serialize({ dirtyOnly: true })).to.deep.equal(rootCopy.serialize({ dirtyOnly: true }));
|
|
498
555
|
});
|
|
499
556
|
});
|
|
500
|
-
describe(
|
|
557
|
+
describe("Apply with reversible ChangeSets", function () {
|
|
501
558
|
var overlapApplyTest = function (in_type, in_inputArrayOperations1, in_inputArrayOperations2, in_outputArrayOperations) {
|
|
502
559
|
var convertModificationSetToArray = function (in_modificationSet) {
|
|
503
560
|
return in_modificationSet.map((x) => {
|
|
504
|
-
return x[2] === undefined
|
|
505
|
-
[x[0], x[1].split(
|
|
506
|
-
[x[0], x[1].split(
|
|
561
|
+
return x[2] === undefined
|
|
562
|
+
? [x[0], x[1].split("")]
|
|
563
|
+
: [x[0], x[1].split(""), x[2].split("")];
|
|
507
564
|
});
|
|
508
565
|
};
|
|
509
566
|
var performApplyTest = function (in_typeid, inputArrayOperations1, inputArrayOperations2, outputArrayOperations) {
|
|
510
|
-
var CS1 = new ChangeSet({
|
|
511
|
-
|
|
567
|
+
var CS1 = new ChangeSet({
|
|
568
|
+
modify: { [in_typeid]: { arr: { [in_type]: inputArrayOperations1 } } },
|
|
569
|
+
});
|
|
570
|
+
var CS2 = {
|
|
571
|
+
modify: { [in_typeid]: { arr: { [in_type]: inputArrayOperations2 } } },
|
|
572
|
+
};
|
|
512
573
|
var CS2_copy = deepCopy(CS2);
|
|
513
574
|
CS1.applyChangeSet(CS2);
|
|
514
575
|
// CS2 should be unchanged
|
|
515
576
|
expect(CS2).to.deep.equal(CS2_copy);
|
|
516
577
|
// CS2 should no longer contain the removal of A
|
|
517
578
|
expect(CS1.getSerializedChangeSet()).to.deep.equal({
|
|
518
|
-
|
|
579
|
+
modify: { [in_typeid]: { arr: { [in_type]: outputArrayOperations } } },
|
|
519
580
|
});
|
|
520
581
|
};
|
|
521
|
-
it(
|
|
522
|
-
performApplyTest(
|
|
582
|
+
it("on strings", function () {
|
|
583
|
+
performApplyTest("String", deepCopy(in_inputArrayOperations1), in_inputArrayOperations2, in_outputArrayOperations);
|
|
523
584
|
});
|
|
524
|
-
it(
|
|
525
|
-
performApplyTest(
|
|
585
|
+
it("on arrays", function () {
|
|
586
|
+
performApplyTest("array<String>", convertModificationSetToArray(in_inputArrayOperations1), convertModificationSetToArray(in_inputArrayOperations2), convertModificationSetToArray(in_outputArrayOperations));
|
|
526
587
|
});
|
|
527
588
|
};
|
|
528
|
-
describe(
|
|
529
|
-
overlapApplyTest(
|
|
589
|
+
describe("for overlapping modifies 1", function () {
|
|
590
|
+
overlapApplyTest("modify", [[3, "abc", "123"]], [[3, "def", "abc"]], [[3, "def", "123"]]);
|
|
530
591
|
});
|
|
531
|
-
describe(
|
|
532
|
-
overlapApplyTest(
|
|
592
|
+
describe("for overlapping modifies 2", function () {
|
|
593
|
+
overlapApplyTest("modify", [[0, "abc", "123"]], [[2, "def", "c45"]], [[0, "abdef", "12345"]]);
|
|
533
594
|
});
|
|
534
595
|
});
|
|
535
|
-
describe(
|
|
596
|
+
describe("Rebase with reversible ChangeSets", function () {
|
|
536
597
|
var overlapRebaseTest = function (in_type, in_inputArrayOperations1, in_inputArrayOperations2, in_outputArrayOperations, in_expectedConflicts) {
|
|
537
598
|
var convertModificationSetToArray = function (in_modificationSet) {
|
|
538
599
|
return in_modificationSet.map((x) => {
|
|
539
|
-
return x[2] === undefined
|
|
540
|
-
[x[0], x[1].split(
|
|
541
|
-
[x[0], x[1].split(
|
|
600
|
+
return x[2] === undefined
|
|
601
|
+
? [x[0], x[1].split("")]
|
|
602
|
+
: [x[0], x[1].split(""), x[2].split("")];
|
|
542
603
|
});
|
|
543
604
|
};
|
|
544
605
|
var performRebaseTest = function (in_typeid, inputArrayOperations1, inputArrayOperations2, outputArrayOperations) {
|
|
545
606
|
var conflicts = [];
|
|
546
|
-
var CS1_initial = {
|
|
607
|
+
var CS1_initial = {
|
|
608
|
+
modify: { [in_typeid]: { arr: { [in_type]: inputArrayOperations1 } } },
|
|
609
|
+
};
|
|
547
610
|
var CS1 = new ChangeSet(deepCopy(CS1_initial));
|
|
548
|
-
var CS2 = {
|
|
611
|
+
var CS2 = {
|
|
612
|
+
modify: { [in_typeid]: { arr: { [in_type]: inputArrayOperations2 } } },
|
|
613
|
+
};
|
|
549
614
|
CS1._rebaseChangeSet(CS2, conflicts);
|
|
550
615
|
// Duplicated remove is not a conflict
|
|
551
616
|
expect(conflicts.length).to.equal(in_expectedConflicts);
|
|
552
617
|
// CS1 should be unchanged
|
|
553
618
|
expect(CS1.getSerializedChangeSet()).to.deep.equal(CS1_initial);
|
|
554
619
|
// CS2 should no longer contain the removal of A
|
|
555
|
-
expect(CS2).to.deep.equal({
|
|
620
|
+
expect(CS2).to.deep.equal({
|
|
621
|
+
modify: { [in_typeid]: { arr: { [in_type]: outputArrayOperations } } },
|
|
622
|
+
});
|
|
556
623
|
};
|
|
557
|
-
it(
|
|
558
|
-
performRebaseTest(
|
|
624
|
+
it("on strings", function () {
|
|
625
|
+
performRebaseTest("String", in_inputArrayOperations1, in_inputArrayOperations2, in_outputArrayOperations);
|
|
559
626
|
});
|
|
560
|
-
it(
|
|
561
|
-
performRebaseTest(
|
|
627
|
+
it("on arrays", function () {
|
|
628
|
+
performRebaseTest("array<String>", convertModificationSetToArray(in_inputArrayOperations1), convertModificationSetToArray(in_inputArrayOperations2), convertModificationSetToArray(in_outputArrayOperations));
|
|
562
629
|
});
|
|
563
630
|
};
|
|
564
|
-
describe(
|
|
565
|
-
overlapRebaseTest(
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
});
|
|
570
|
-
describe(
|
|
571
|
-
overlapRebaseTest(
|
|
572
|
-
});
|
|
573
|
-
describe(
|
|
574
|
-
overlapRebaseTest(
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
});
|
|
579
|
-
describe(
|
|
580
|
-
overlapRebaseTest(
|
|
581
|
-
|
|
582
|
-
|
|
631
|
+
describe("for overlapping removes", function () {
|
|
632
|
+
overlapRebaseTest("remove", [
|
|
633
|
+
[0, "<A"],
|
|
634
|
+
[4, ">"],
|
|
635
|
+
], [[1, "ABC"]], [[0, "BC"]], 0);
|
|
636
|
+
});
|
|
637
|
+
describe("for overlapping removes 2", function () {
|
|
638
|
+
overlapRebaseTest("remove", [[2, "C>"]], [[0, "ABC"]], [[0, "AB"]], 0);
|
|
639
|
+
});
|
|
640
|
+
describe("for overlapping removes 3", function () {
|
|
641
|
+
overlapRebaseTest("remove", [[2, "CD>"]], [
|
|
642
|
+
[0, "ABC"],
|
|
643
|
+
[4, ">"],
|
|
644
|
+
], [[0, "AB"]], 0);
|
|
645
|
+
});
|
|
646
|
+
describe("for overlapping modifies", function () {
|
|
647
|
+
overlapRebaseTest("modify", [
|
|
648
|
+
[0, "<A", ".."],
|
|
649
|
+
[4, ">", "."],
|
|
650
|
+
], [[1, "123", "---"]], [[1, "123", "A--"]], 1);
|
|
651
|
+
});
|
|
652
|
+
describe("for overlapping modifies 2", function () {
|
|
653
|
+
overlapRebaseTest("modify", [[2, "C>", ".."]], [[0, "123", "---"]], [[0, "123", "--C"]], 1);
|
|
654
|
+
});
|
|
655
|
+
describe("for overlapping modifies 3", function () {
|
|
656
|
+
overlapRebaseTest("modify", [[2, "CD>", ".."]], [
|
|
657
|
+
[0, "123", "---"],
|
|
658
|
+
[4, "45", "--"],
|
|
659
|
+
], [
|
|
660
|
+
[0, "123", "--C"],
|
|
661
|
+
[4, "45", ">-"],
|
|
662
|
+
], 2);
|
|
663
|
+
});
|
|
664
|
+
it("for array modify rebases", function () {
|
|
583
665
|
var CS = new ChangeSet({
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
[1, [1, 2, 3], [0, 1, 2]],
|
|
588
|
-
],
|
|
666
|
+
"array<Float32>": {
|
|
667
|
+
elements: {
|
|
668
|
+
modify: [[1, [1, 2, 3], [0, 1, 2]]],
|
|
589
669
|
},
|
|
590
670
|
},
|
|
591
671
|
});
|
|
592
672
|
var rebasedCS = CS._rebaseChangeSet({
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
[
|
|
597
|
-
0,
|
|
598
|
-
[0, 1, 2, 3],
|
|
599
|
-
[1, 2, 3, 4],
|
|
600
|
-
],
|
|
601
|
-
],
|
|
673
|
+
"array<Float32>": {
|
|
674
|
+
elements: {
|
|
675
|
+
modify: [[0, [0, 1, 2, 3], [1, 2, 3, 4]]],
|
|
602
676
|
},
|
|
603
677
|
},
|
|
604
678
|
}, []);
|
|
605
|
-
expect(rebasedCS[
|
|
679
|
+
expect(rebasedCS["array<Float32>"].elements.modify[0].length).to.equal(3);
|
|
606
680
|
});
|
|
607
681
|
});
|
|
608
|
-
describe(
|
|
609
|
-
it(
|
|
610
|
-
var CS = new ChangeSet({
|
|
611
|
-
CS.applyChangeSet({
|
|
612
|
-
expect(CS.getSerializedChangeSet()).to.deep.equal({
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
682
|
+
describe("applying reversible CS to primitive string types", function () {
|
|
683
|
+
it("should work for strings", function () {
|
|
684
|
+
var CS = new ChangeSet({ String: { test: { value: "10", oldValue: "9" } } });
|
|
685
|
+
CS.applyChangeSet({ String: { test: { value: "8", oldValue: "10" } } });
|
|
686
|
+
expect(CS.getSerializedChangeSet()).to.deep.equal({
|
|
687
|
+
String: { test: { value: "8", oldValue: "9" } },
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
it("should work for strings", function () {
|
|
691
|
+
var CS = new ChangeSet({ Float64: { test: { value: 10, oldValue: 9 } } });
|
|
692
|
+
CS.applyChangeSet({ Float64: { test: { value: 8, oldValue: 10 } } });
|
|
693
|
+
expect(CS.getSerializedChangeSet()).to.deep.equal({
|
|
694
|
+
Float64: { test: { value: 8, oldValue: 9 } },
|
|
695
|
+
});
|
|
696
|
+
});
|
|
697
|
+
it("should work for bool", function () {
|
|
620
698
|
// TODO: This should become a NOP
|
|
621
|
-
var CS = new ChangeSet({
|
|
622
|
-
CS.applyChangeSet({
|
|
623
|
-
expect(CS.getSerializedChangeSet()).to.deep.equal({
|
|
699
|
+
var CS = new ChangeSet({ Bool: { test: { value: false, oldValue: true } } });
|
|
700
|
+
CS.applyChangeSet({ Bool: { test: { value: true, oldValue: false } } });
|
|
701
|
+
expect(CS.getSerializedChangeSet()).to.deep.equal({
|
|
702
|
+
Bool: { test: { value: true, oldValue: true } },
|
|
703
|
+
});
|
|
624
704
|
});
|
|
625
|
-
it(
|
|
705
|
+
it("should work for bool", function () {
|
|
626
706
|
// TODO: This should become a NOP
|
|
627
707
|
var CS = new ChangeSet({});
|
|
628
|
-
CS.applyChangeSet({
|
|
629
|
-
expect(CS.getSerializedChangeSet()).to.deep.equal({
|
|
708
|
+
CS.applyChangeSet({ Bool: { test: { value: true, oldValue: false } } });
|
|
709
|
+
expect(CS.getSerializedChangeSet()).to.deep.equal({
|
|
710
|
+
Bool: { test: { value: true, oldValue: false } },
|
|
711
|
+
});
|
|
630
712
|
});
|
|
631
713
|
});
|
|
632
|
-
describe(
|
|
633
|
-
it(
|
|
714
|
+
describe("_stripReversibleChangeSet should", function () {
|
|
715
|
+
it("correctly handle removes at the root", function () {
|
|
634
716
|
var CS = new ChangeSet({
|
|
635
717
|
remove: {
|
|
636
718
|
String: {
|
|
637
|
-
testString:
|
|
719
|
+
testString: "abcde",
|
|
638
720
|
},
|
|
639
721
|
},
|
|
640
722
|
});
|
|
641
723
|
CS._stripReversibleChangeSet();
|
|
642
724
|
expect(CS.getSerializedChangeSet()).to.deep.equal({
|
|
643
|
-
remove: [
|
|
725
|
+
remove: ["testString"],
|
|
644
726
|
});
|
|
645
727
|
});
|
|
646
|
-
it(
|
|
728
|
+
it("ignore the root when passing it a flag", function () {
|
|
647
729
|
var SCS = {
|
|
648
730
|
remove: {
|
|
649
731
|
String: {
|
|
650
|
-
testString:
|
|
732
|
+
testString: "abcde",
|
|
651
733
|
},
|
|
652
734
|
},
|
|
653
735
|
};
|
|
@@ -656,118 +738,132 @@ describe('Reversible ChangeSets', function () {
|
|
|
656
738
|
expect(CS.getSerializedChangeSet()).to.deep.equal(SCS);
|
|
657
739
|
});
|
|
658
740
|
});
|
|
659
|
-
describe(
|
|
660
|
-
it(
|
|
741
|
+
describe("should return a minimal CS when squashing", function () {
|
|
742
|
+
it("matching primitive type remove/insert combinations in a polymorphic indexed collection", function () {
|
|
661
743
|
// These two operations should cancel out
|
|
662
|
-
var CS1 = new ChangeSet({ remove: { String: { A:
|
|
663
|
-
var CS2 = new ChangeSet({ insert: { String: { A:
|
|
744
|
+
var CS1 = new ChangeSet({ remove: { String: { A: "A" } } });
|
|
745
|
+
var CS2 = new ChangeSet({ insert: { String: { A: "A" } } });
|
|
664
746
|
CS1.applyChangeSet(CS2);
|
|
665
747
|
expect(CS1.getSerializedChangeSet()).to.deep.equal({});
|
|
666
748
|
});
|
|
667
|
-
it(
|
|
749
|
+
it("non matching primitive type remove/insert combinations in a polymorphic indexed collection", function () {
|
|
668
750
|
// These two operations should result in a modify
|
|
669
|
-
var CS1 = new ChangeSet({ remove: { String: { A:
|
|
670
|
-
var CS2 = new ChangeSet({ insert: { String: { A:
|
|
751
|
+
var CS1 = new ChangeSet({ remove: { String: { A: "A" } } });
|
|
752
|
+
var CS2 = new ChangeSet({ insert: { String: { A: "B" } } });
|
|
671
753
|
CS1.applyChangeSet(CS2);
|
|
672
|
-
expect(CS1.getSerializedChangeSet()).to.deep.equal({ modify: { String: { A:
|
|
754
|
+
expect(CS1.getSerializedChangeSet()).to.deep.equal({ modify: { String: { A: "B" } } });
|
|
673
755
|
});
|
|
674
|
-
it(
|
|
756
|
+
it("matching remove/insert combinations in a primitive type indexed collection", function () {
|
|
675
757
|
// These two operations should cancel out
|
|
676
|
-
var CS1 = new ChangeSet({
|
|
677
|
-
|
|
758
|
+
var CS1 = new ChangeSet({
|
|
759
|
+
modify: { "map<String>": { test: { remove: { A: "A" } } } },
|
|
760
|
+
});
|
|
761
|
+
var CS2 = new ChangeSet({
|
|
762
|
+
modify: { "map<String>": { test: { insert: { A: "A" } } } },
|
|
763
|
+
});
|
|
678
764
|
CS1.applyChangeSet(CS2);
|
|
679
765
|
expect(CS1.getSerializedChangeSet()).to.deep.equal({});
|
|
680
766
|
});
|
|
681
|
-
it(
|
|
767
|
+
it("non matching primitive type remove/insert combinations in a polymorphic indexed collection", function () {
|
|
682
768
|
// These two operations should result in a modify
|
|
683
|
-
var CS1 = new ChangeSet({
|
|
684
|
-
|
|
769
|
+
var CS1 = new ChangeSet({
|
|
770
|
+
modify: { "map<String>": { test: { remove: { A: "A" } } } },
|
|
771
|
+
});
|
|
772
|
+
var CS2 = new ChangeSet({
|
|
773
|
+
modify: { "map<String>": { test: { insert: { A: "B" } } } },
|
|
774
|
+
});
|
|
685
775
|
CS1.applyChangeSet(CS2);
|
|
686
|
-
expect(CS1.getSerializedChangeSet()).to.deep.equal({
|
|
776
|
+
expect(CS1.getSerializedChangeSet()).to.deep.equal({
|
|
777
|
+
modify: { "map<String>": { test: { modify: { A: "B" } } } },
|
|
778
|
+
});
|
|
687
779
|
});
|
|
688
|
-
it(
|
|
780
|
+
it("matching complex type remove/insert combinations in a polymorphic indexed collection", function () {
|
|
689
781
|
// These two operations should cancel out
|
|
690
|
-
var CS1 = new ChangeSet({ remove: {
|
|
691
|
-
var CS2 = new ChangeSet({ insert: {
|
|
782
|
+
var CS1 = new ChangeSet({ remove: { "RepositoryTest:Nametag-1.0.0": { name: "A" } } });
|
|
783
|
+
var CS2 = new ChangeSet({ insert: { "RepositoryTest:Nametag-1.0.0": { name: "A" } } });
|
|
692
784
|
CS1.applyChangeSet(CS2);
|
|
693
785
|
expect(CS1.getSerializedChangeSet()).to.deep.equal({});
|
|
694
786
|
});
|
|
695
|
-
it(
|
|
787
|
+
it("non matching complex type remove/insert combinations in a polymorphic indexed collection", function () {
|
|
696
788
|
// TODO: How should we treat these operations? Should they be rewritten to a modify?
|
|
697
|
-
var CS1 = new ChangeSet({ remove: {
|
|
698
|
-
var CS2 = new ChangeSet({ insert: {
|
|
789
|
+
var CS1 = new ChangeSet({ remove: { "RepositoryTest:Nametag-1.0.0": { name: "A" } } });
|
|
790
|
+
var CS2 = new ChangeSet({ insert: { "RepositoryTest:Nametag-1.0.0": { name: "B" } } });
|
|
699
791
|
CS1.applyChangeSet(CS2);
|
|
700
792
|
expect(CS1.getSerializedChangeSet()).to.deep.equal({
|
|
701
|
-
remove: {
|
|
702
|
-
insert: {
|
|
793
|
+
remove: { "RepositoryTest:Nametag-1.0.0": { name: "A" } },
|
|
794
|
+
insert: { "RepositoryTest:Nametag-1.0.0": { name: "B" } },
|
|
703
795
|
});
|
|
704
796
|
});
|
|
705
|
-
it(
|
|
797
|
+
it("matching primitive type remove/insert operations in primitive type arrays", function () {
|
|
706
798
|
// These two operations should cancel out
|
|
707
|
-
var CS1 = new ChangeSet({
|
|
708
|
-
|
|
799
|
+
var CS1 = new ChangeSet({
|
|
800
|
+
modify: { "array<String>": { test: { remove: [[0, ["A", "B", "C"]]] } } },
|
|
801
|
+
});
|
|
802
|
+
var CS2 = new ChangeSet({
|
|
803
|
+
modify: { "array<String>": { test: { insert: [[0, ["A", "B", "C"]]] } } },
|
|
804
|
+
});
|
|
709
805
|
CS1.applyChangeSet(CS2);
|
|
710
806
|
expect(CS1.getSerializedChangeSet()).to.deep.equal({});
|
|
711
807
|
});
|
|
712
808
|
});
|
|
713
|
-
it(
|
|
714
|
-
var prop = PropertyFactory.create(
|
|
809
|
+
it("should work for primitive array properties", function () {
|
|
810
|
+
var prop = PropertyFactory.create("autodesk.test:test.arrayfloat32-1.0.0");
|
|
715
811
|
prop._properties.data.insertRange(0, [10, 11, 12, 13, 14, 15, 16]);
|
|
716
812
|
testRevAndInvCS(prop, function (in_prop) {
|
|
717
813
|
in_prop._properties.data.setRange(1, [21, 22]);
|
|
718
814
|
in_prop._properties.data.removeRange(4, 3);
|
|
719
815
|
in_prop._properties.data.insert(0, 9);
|
|
720
816
|
}, {
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
817
|
+
"array<Float32>": {
|
|
818
|
+
data: {
|
|
819
|
+
modify: [[1, [21, 22], [11, 12]]],
|
|
820
|
+
remove: [[4, [14, 15, 16]]],
|
|
821
|
+
insert: [[0, [9]]],
|
|
726
822
|
},
|
|
727
823
|
},
|
|
728
824
|
}, {
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
825
|
+
"array<Float32>": {
|
|
826
|
+
data: {
|
|
827
|
+
insert: [[0, [9, 10, 21, 22, 13]]],
|
|
732
828
|
},
|
|
733
829
|
},
|
|
734
830
|
}, {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
831
|
+
"array<Float32>": {
|
|
832
|
+
data: {
|
|
833
|
+
modify: [[2, [11, 12], [21, 22]]],
|
|
834
|
+
insert: [[5, [14, 15, 16]]],
|
|
835
|
+
remove: [[0, [9]]],
|
|
740
836
|
},
|
|
741
837
|
},
|
|
742
838
|
});
|
|
743
839
|
});
|
|
744
|
-
it(
|
|
745
|
-
var prop = PropertyFactory.create(
|
|
840
|
+
it("should work for insertions into empty primitive array properties", function () {
|
|
841
|
+
var prop = PropertyFactory.create("autodesk.test:test.arrayfloat32-1.0.0");
|
|
746
842
|
testRevAndInvCS(prop, function (in_prop) {
|
|
747
843
|
in_prop._properties.data.insertRange(0, [1, 2, 3]);
|
|
748
844
|
}, {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
845
|
+
"array<Float32>": {
|
|
846
|
+
data: {
|
|
847
|
+
insert: [[0, [1, 2, 3]]],
|
|
752
848
|
},
|
|
753
849
|
},
|
|
754
850
|
}, {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
851
|
+
"array<Float32>": {
|
|
852
|
+
data: {
|
|
853
|
+
insert: [[0, [1, 2, 3]]],
|
|
758
854
|
},
|
|
759
855
|
},
|
|
760
856
|
}, {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
857
|
+
"array<Float32>": {
|
|
858
|
+
data: {
|
|
859
|
+
remove: [[0, [1, 2, 3]]],
|
|
764
860
|
},
|
|
765
861
|
},
|
|
766
862
|
});
|
|
767
863
|
});
|
|
768
|
-
it(
|
|
864
|
+
it("should not crash with an empty input if it is not needed in the actual CS", function () {
|
|
769
865
|
var initialCS = {
|
|
770
|
-
|
|
866
|
+
NodeProperty: {
|
|
771
867
|
insert: {
|
|
772
868
|
NodeProperty: {
|
|
773
869
|
test2: {},
|
|
@@ -779,14 +875,14 @@ describe('Reversible ChangeSets', function () {
|
|
|
779
875
|
CS._toReversibleChangeSet({});
|
|
780
876
|
expect(CS.getSerializedChangeSet()).to.deep.equal(initialCS);
|
|
781
877
|
});
|
|
782
|
-
it(
|
|
878
|
+
it("should work for inserts, even if the corresponding property is missing in the initial state", function () {
|
|
783
879
|
// This test checks, whether changesets with insert work, even if the corresponding property is not present in the
|
|
784
880
|
// initial changeset. Since the initial changeset is not needed for the insert, we don't need to throw an
|
|
785
881
|
// error in that case. This type of situation can occur in the materialized history, if an insert happens right
|
|
786
882
|
// at a chunk boundary.
|
|
787
883
|
var initialCS = {
|
|
788
|
-
|
|
789
|
-
|
|
884
|
+
NodeProperty: {
|
|
885
|
+
test: {
|
|
790
886
|
insert: {
|
|
791
887
|
NodeProperty: {
|
|
792
888
|
test2: {},
|
|
@@ -799,18 +895,18 @@ describe('Reversible ChangeSets', function () {
|
|
|
799
895
|
CS._toReversibleChangeSet({});
|
|
800
896
|
expect(CS.getSerializedChangeSet()).to.deep.equal(initialCS);
|
|
801
897
|
});
|
|
802
|
-
it(
|
|
898
|
+
it("should work for simple primitive properties", function () {
|
|
803
899
|
var cs = new ChangeSet({
|
|
804
900
|
insert: {
|
|
805
|
-
|
|
806
|
-
|
|
901
|
+
Float32: {
|
|
902
|
+
myFloat: 23,
|
|
807
903
|
},
|
|
808
904
|
},
|
|
809
905
|
});
|
|
810
906
|
var cs2 = new ChangeSet({
|
|
811
907
|
modify: {
|
|
812
|
-
|
|
813
|
-
|
|
908
|
+
Float32: {
|
|
909
|
+
myFloat: 42,
|
|
814
910
|
},
|
|
815
911
|
},
|
|
816
912
|
});
|
|
@@ -821,207 +917,247 @@ describe('Reversible ChangeSets', function () {
|
|
|
821
917
|
var cs2Strip = cs2Rev.clone();
|
|
822
918
|
cs2Strip._stripReversibleChangeSet();
|
|
823
919
|
expect(cs2.getSerializedChangeSet()).to.deep.equal(cs2Strip.getSerializedChangeSet());
|
|
824
|
-
expect(cs2Rev.getSerializedChangeSet()).to.deep.equal({
|
|
920
|
+
expect(cs2Rev.getSerializedChangeSet()).to.deep.equal({
|
|
921
|
+
modify: { Float32: { myFloat: { value: 42, oldValue: 23 } } },
|
|
922
|
+
});
|
|
825
923
|
// forward and reverse:
|
|
826
924
|
cs.applyChangeSet(cs2Rev);
|
|
827
925
|
// cs now should be 42
|
|
828
|
-
expect(cs.getSerializedChangeSet()).to.deep.equal({
|
|
926
|
+
expect(cs.getSerializedChangeSet()).to.deep.equal({ insert: { Float32: { myFloat: 42 } } });
|
|
829
927
|
var invCS = cs2Rev.clone();
|
|
830
928
|
invCS.toInverseChangeSet();
|
|
831
|
-
expect(invCS.getSerializedChangeSet()).to.deep.equal({
|
|
929
|
+
expect(invCS.getSerializedChangeSet()).to.deep.equal({
|
|
930
|
+
modify: { Float32: { myFloat: { value: 23, oldValue: 42 } } },
|
|
931
|
+
});
|
|
832
932
|
cs.applyChangeSet(invCS);
|
|
833
933
|
// cs now should be 23
|
|
834
|
-
expect(cs.getSerializedChangeSet()).to.deep.equal({
|
|
934
|
+
expect(cs.getSerializedChangeSet()).to.deep.equal({ insert: { Float32: { myFloat: 23 } } });
|
|
835
935
|
});
|
|
836
|
-
it(
|
|
837
|
-
var prop = PropertyFactory.create(
|
|
936
|
+
it("should work for templated properties", function () {
|
|
937
|
+
var prop = PropertyFactory.create("autodesk.test:point2d-1.0.0");
|
|
838
938
|
testRevAndInvCS(prop, function (in_prop) {
|
|
839
939
|
in_prop._properties.position.x.value = 2;
|
|
840
940
|
in_prop._properties.normal.y.value = 4;
|
|
841
941
|
in_prop._properties.temperature.value = 21;
|
|
842
942
|
}, {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
943
|
+
"Float32": {
|
|
944
|
+
"position.x": { value: 2, oldValue: 0 },
|
|
945
|
+
"temperature": { value: 21, oldValue: 0 },
|
|
846
946
|
},
|
|
847
|
-
|
|
848
|
-
|
|
947
|
+
"autodesk.test:vector3-1.0.0": {
|
|
948
|
+
normal: { Float32: { y: { value: 4, oldValue: 0 } } },
|
|
849
949
|
},
|
|
850
950
|
}, {
|
|
851
|
-
|
|
852
|
-
|
|
951
|
+
"Float32": {
|
|
952
|
+
"position.x": 2,
|
|
953
|
+
"position.y": 0,
|
|
954
|
+
"temperature": 21,
|
|
853
955
|
},
|
|
854
|
-
|
|
855
|
-
|
|
956
|
+
"autodesk.test:vector3-1.0.0": {
|
|
957
|
+
normal: { Float32: { x: 0, y: 4, z: 0 } },
|
|
856
958
|
},
|
|
857
|
-
|
|
959
|
+
"map<autodesk.test:vector3-1.0.0>": { neighbours: {} },
|
|
858
960
|
}, {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
961
|
+
"Float32": {
|
|
962
|
+
"position.x": { value: 0, oldValue: 2 },
|
|
963
|
+
"temperature": { value: 0, oldValue: 21 },
|
|
862
964
|
},
|
|
863
|
-
|
|
864
|
-
|
|
965
|
+
"autodesk.test:vector3-1.0.0": {
|
|
966
|
+
normal: { Float32: { y: { value: 0, oldValue: 4 } } },
|
|
865
967
|
},
|
|
866
968
|
});
|
|
867
969
|
});
|
|
868
|
-
it(
|
|
869
|
-
var prop = PropertyFactory.create(
|
|
870
|
-
prop._properties.data.value =
|
|
970
|
+
it("should work for string properties initialized by set", function () {
|
|
971
|
+
var prop = PropertyFactory.create("autodesk.tests:DataStringTestProperty-1.0.0");
|
|
972
|
+
prop._properties.data.value = "Hello world";
|
|
871
973
|
testRevAndInvCS(prop, function (in_prop) {
|
|
872
|
-
in_prop._properties.data.setRange(1,
|
|
974
|
+
in_prop._properties.data.setRange(1, "aih");
|
|
873
975
|
in_prop._properties.data.removeRange(6, 5);
|
|
874
|
-
in_prop._properties.data.insertRange(0,
|
|
875
|
-
}, {
|
|
976
|
+
in_prop._properties.data.insertRange(0, "Hi, ");
|
|
977
|
+
}, {
|
|
978
|
+
String: {
|
|
979
|
+
data: {
|
|
980
|
+
modify: [[1, "aih", "ell"]],
|
|
981
|
+
remove: [[6, "world"]],
|
|
982
|
+
insert: [[0, "Hi, "]],
|
|
983
|
+
},
|
|
984
|
+
},
|
|
985
|
+
}, { String: { data: "Hi, Haiho " } }, {
|
|
986
|
+
String: {
|
|
987
|
+
data: {
|
|
988
|
+
modify: [[5, "ell", "aih"]],
|
|
989
|
+
remove: [[0, "Hi, "]],
|
|
990
|
+
insert: [[10, "world"]],
|
|
991
|
+
},
|
|
992
|
+
},
|
|
993
|
+
});
|
|
876
994
|
});
|
|
877
|
-
it(
|
|
878
|
-
var prop = PropertyFactory.create(
|
|
879
|
-
prop._properties.data.insert(0,
|
|
995
|
+
it("should work for string properties initialized by insert", function () {
|
|
996
|
+
var prop = PropertyFactory.create("autodesk.tests:DataStringTestProperty-1.0.0");
|
|
997
|
+
prop._properties.data.insert(0, "Hello world");
|
|
880
998
|
testRevAndInvCS(prop, function (in_prop) {
|
|
881
|
-
in_prop._properties.data.setRange(1,
|
|
999
|
+
in_prop._properties.data.setRange(1, "aih");
|
|
882
1000
|
in_prop._properties.data.removeRange(6, 5);
|
|
883
|
-
in_prop._properties.data.insertRange(0,
|
|
884
|
-
}, {
|
|
1001
|
+
in_prop._properties.data.insertRange(0, "Hi, ");
|
|
1002
|
+
}, {
|
|
1003
|
+
String: {
|
|
1004
|
+
data: {
|
|
1005
|
+
modify: [[1, "aih", "ell"]],
|
|
1006
|
+
remove: [[6, "world"]],
|
|
1007
|
+
insert: [[0, "Hi, "]],
|
|
1008
|
+
},
|
|
1009
|
+
},
|
|
1010
|
+
}, { String: { data: "Hi, Haiho " } }, {
|
|
1011
|
+
String: {
|
|
1012
|
+
data: {
|
|
1013
|
+
modify: [[5, "ell", "aih"]],
|
|
1014
|
+
remove: [[0, "Hi, "]],
|
|
1015
|
+
insert: [[10, "world"]],
|
|
1016
|
+
},
|
|
1017
|
+
},
|
|
1018
|
+
});
|
|
885
1019
|
});
|
|
886
|
-
it(
|
|
887
|
-
var property = PropertyFactory.create(
|
|
1020
|
+
it("should work for primitive map properties", function () {
|
|
1021
|
+
var property = PropertyFactory.create("autodesk.tests:MapTestPropertyID-1.0.0");
|
|
888
1022
|
var prop = property._properties.data;
|
|
889
|
-
prop.insert(
|
|
890
|
-
prop.insert(
|
|
891
|
-
prop.insert(
|
|
892
|
-
prop.insert(
|
|
1023
|
+
prop.insert("A", 3);
|
|
1024
|
+
prop.insert("B", 4);
|
|
1025
|
+
prop.insert("C", 5);
|
|
1026
|
+
prop.insert("D", 6);
|
|
893
1027
|
testRevAndInvCS(property, function (myProp) {
|
|
894
|
-
myProp._properties.data.set(
|
|
895
|
-
myProp._properties.data.remove(
|
|
896
|
-
myProp._properties.data.remove(
|
|
897
|
-
myProp._properties.data.set(
|
|
898
|
-
myProp._properties.data.insert(
|
|
1028
|
+
myProp._properties.data.set("A", 7);
|
|
1029
|
+
myProp._properties.data.remove("B");
|
|
1030
|
+
myProp._properties.data.remove("C");
|
|
1031
|
+
myProp._properties.data.set("D", 8);
|
|
1032
|
+
myProp._properties.data.insert("F", 9);
|
|
899
1033
|
}, {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
1034
|
+
"map<Float32>": {
|
|
1035
|
+
data: {
|
|
1036
|
+
remove: { B: 4, C: 5 },
|
|
1037
|
+
modify: { A: { value: 7, oldValue: 3 }, D: { value: 8, oldValue: 6 } },
|
|
1038
|
+
insert: { F: 9 },
|
|
905
1039
|
},
|
|
906
1040
|
},
|
|
907
1041
|
}, {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1042
|
+
"map<Float32>": {
|
|
1043
|
+
data: {
|
|
1044
|
+
insert: { A: 7, D: 8, F: 9 },
|
|
911
1045
|
},
|
|
912
1046
|
},
|
|
913
1047
|
}, {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1048
|
+
"map<Float32>": {
|
|
1049
|
+
data: {
|
|
1050
|
+
modify: { A: { value: 3, oldValue: 7 }, D: { value: 6, oldValue: 8 } },
|
|
1051
|
+
insert: { B: 4, C: 5 },
|
|
1052
|
+
remove: { F: 9 },
|
|
919
1053
|
},
|
|
920
1054
|
},
|
|
921
1055
|
});
|
|
922
1056
|
});
|
|
923
|
-
it(
|
|
924
|
-
var rootNode = PropertyFactory.create(
|
|
925
|
-
var A = PropertyFactory.create(
|
|
926
|
-
var B = PropertyFactory.create(
|
|
927
|
-
var C = PropertyFactory.create(
|
|
928
|
-
var D = PropertyFactory.create(
|
|
929
|
-
rootNode._properties.map.insert(
|
|
930
|
-
rootNode._properties.map.insert(
|
|
931
|
-
rootNode._properties.map.insert(
|
|
932
|
-
rootNode._properties.map.insert(
|
|
1057
|
+
it("should work for custom map properties", function () {
|
|
1058
|
+
var rootNode = PropertyFactory.create("autodesk.tests:MapTestNamedPropertyID-1.0.0");
|
|
1059
|
+
var A = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
1060
|
+
var B = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
1061
|
+
var C = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
1062
|
+
var D = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
1063
|
+
rootNode._properties.map.insert("A", A);
|
|
1064
|
+
rootNode._properties.map.insert("B", B);
|
|
1065
|
+
rootNode._properties.map.insert("C", C);
|
|
1066
|
+
rootNode._properties.map.insert("D", D);
|
|
933
1067
|
testRevAndInvCS(rootNode, function (myProp) {
|
|
934
|
-
var F = PropertyFactory.create(
|
|
935
|
-
myProp._properties.map.remove(
|
|
936
|
-
myProp._properties.map.remove(
|
|
937
|
-
myProp._properties.map.insert(
|
|
938
|
-
myProp._properties.map.get(
|
|
1068
|
+
var F = PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0");
|
|
1069
|
+
myProp._properties.map.remove("B");
|
|
1070
|
+
myProp._properties.map.remove("C");
|
|
1071
|
+
myProp._properties.map.insert("F", F);
|
|
1072
|
+
myProp._properties.map.get("A")._properties.stringProperty.value = "hello";
|
|
939
1073
|
}, {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1074
|
+
"map<NamedProperty>": {
|
|
1075
|
+
map: {
|
|
1076
|
+
insert: {
|
|
1077
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1078
|
+
F: { String: { stringProperty: "" } },
|
|
945
1079
|
},
|
|
946
1080
|
},
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1081
|
+
remove: {
|
|
1082
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1083
|
+
B: { String: { stringProperty: "" } },
|
|
1084
|
+
C: { String: { stringProperty: "" } },
|
|
950
1085
|
},
|
|
951
1086
|
},
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1087
|
+
modify: {
|
|
1088
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1089
|
+
A: { String: { stringProperty: { value: "hello", oldValue: "" } } },
|
|
955
1090
|
},
|
|
956
1091
|
},
|
|
957
1092
|
},
|
|
958
1093
|
},
|
|
959
1094
|
}, undefined, {
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
1095
|
+
"map<NamedProperty>": {
|
|
1096
|
+
map: {
|
|
1097
|
+
insert: {
|
|
1098
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1099
|
+
B: { String: { stringProperty: "" } },
|
|
1100
|
+
C: { String: { stringProperty: "" } },
|
|
966
1101
|
},
|
|
967
1102
|
},
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1103
|
+
modify: {
|
|
1104
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1105
|
+
A: { String: { stringProperty: { value: "", oldValue: "hello" } } },
|
|
971
1106
|
},
|
|
972
1107
|
},
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1108
|
+
remove: {
|
|
1109
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1110
|
+
F: { String: { stringProperty: "" } },
|
|
976
1111
|
},
|
|
977
1112
|
},
|
|
978
1113
|
},
|
|
979
1114
|
},
|
|
980
1115
|
});
|
|
981
1116
|
});
|
|
982
|
-
it(
|
|
1117
|
+
it("should test reversible changeset for a NodeProperty", function () {
|
|
983
1118
|
var originalChangeSet = {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1119
|
+
insert: {
|
|
1120
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1121
|
+
F: { String: { stringProperty: "" } },
|
|
987
1122
|
},
|
|
988
1123
|
},
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1124
|
+
remove: ["B", "C"],
|
|
1125
|
+
modify: {
|
|
1126
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1127
|
+
A: { String: { stringProperty: "hello" } },
|
|
993
1128
|
},
|
|
994
1129
|
},
|
|
995
1130
|
};
|
|
996
1131
|
var parentChangeSet = {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1132
|
+
insert: {
|
|
1133
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1134
|
+
A: { String: { stringProperty: "" } },
|
|
1135
|
+
B: { String: { stringProperty: "" } },
|
|
1136
|
+
C: { String: { stringProperty: "" } },
|
|
1002
1137
|
},
|
|
1003
1138
|
},
|
|
1004
1139
|
};
|
|
1005
1140
|
var changeSet = new ChangeSet(originalChangeSet);
|
|
1006
1141
|
changeSet._toReversibleChangeSet(parentChangeSet);
|
|
1007
1142
|
expect(changeSet.getSerializedChangeSet()).to.eql({
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1143
|
+
insert: {
|
|
1144
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1145
|
+
F: { String: { stringProperty: "" } },
|
|
1011
1146
|
},
|
|
1012
1147
|
},
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1148
|
+
remove: {
|
|
1149
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1150
|
+
B: { String: { stringProperty: "" } },
|
|
1151
|
+
C: { String: { stringProperty: "" } },
|
|
1017
1152
|
},
|
|
1018
|
-
},
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1153
|
+
},
|
|
1154
|
+
modify: {
|
|
1155
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1156
|
+
A: {
|
|
1157
|
+
String: {
|
|
1158
|
+
stringProperty: {
|
|
1159
|
+
value: "hello",
|
|
1160
|
+
oldValue: "",
|
|
1025
1161
|
},
|
|
1026
1162
|
},
|
|
1027
1163
|
},
|
|
@@ -1030,23 +1166,24 @@ describe('Reversible ChangeSets', function () {
|
|
|
1030
1166
|
});
|
|
1031
1167
|
changeSet.toInverseChangeSet();
|
|
1032
1168
|
expect(changeSet.getSerializedChangeSet()).to.eql({
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1169
|
+
insert: {
|
|
1170
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1171
|
+
B: { String: { stringProperty: "" } },
|
|
1172
|
+
C: { String: { stringProperty: "" } },
|
|
1037
1173
|
},
|
|
1038
1174
|
},
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1175
|
+
remove: {
|
|
1176
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1177
|
+
F: { String: { stringProperty: "" } },
|
|
1042
1178
|
},
|
|
1043
|
-
},
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1179
|
+
},
|
|
1180
|
+
modify: {
|
|
1181
|
+
"autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
|
|
1182
|
+
A: {
|
|
1183
|
+
String: {
|
|
1184
|
+
stringProperty: {
|
|
1185
|
+
value: "",
|
|
1186
|
+
oldValue: "hello",
|
|
1050
1187
|
},
|
|
1051
1188
|
},
|
|
1052
1189
|
},
|
|
@@ -1054,15 +1191,15 @@ describe('Reversible ChangeSets', function () {
|
|
|
1054
1191
|
},
|
|
1055
1192
|
});
|
|
1056
1193
|
var originalChangeSet2 = {
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1194
|
+
insert: {
|
|
1195
|
+
"mysample:point2d-1.0.0": {
|
|
1196
|
+
"7485af0e-c992-af6a-ef36-6a024eb4b4e5---2": {
|
|
1197
|
+
String: {
|
|
1198
|
+
guid: "fb5f062f-9f56-55c3-f868-06caa5d8ce26",
|
|
1062
1199
|
},
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1200
|
+
Float64: {
|
|
1201
|
+
x: 0,
|
|
1202
|
+
y: 0,
|
|
1066
1203
|
},
|
|
1067
1204
|
},
|
|
1068
1205
|
},
|
|
@@ -1074,35 +1211,35 @@ describe('Reversible ChangeSets', function () {
|
|
|
1074
1211
|
expect(changeSet2.getSerializedChangeSet()).to.eql(changeSet2.getSerializedChangeSet());
|
|
1075
1212
|
changeSet2.toInverseChangeSet();
|
|
1076
1213
|
expect(changeSet2.getSerializedChangeSet()).to.eql({
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1214
|
+
remove: {
|
|
1215
|
+
"mysample:point2d-1.0.0": {
|
|
1216
|
+
"7485af0e-c992-af6a-ef36-6a024eb4b4e5---2": {
|
|
1217
|
+
String: {
|
|
1218
|
+
guid: "fb5f062f-9f56-55c3-f868-06caa5d8ce26",
|
|
1082
1219
|
},
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1220
|
+
Float64: {
|
|
1221
|
+
x: 0,
|
|
1222
|
+
y: 0,
|
|
1086
1223
|
},
|
|
1087
1224
|
},
|
|
1088
1225
|
},
|
|
1089
1226
|
},
|
|
1090
1227
|
});
|
|
1091
1228
|
});
|
|
1092
|
-
it(
|
|
1229
|
+
it("should test reversible changeset for an array of non primitive types", function () {
|
|
1093
1230
|
var originalChangeSet = {
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1231
|
+
modify: {
|
|
1232
|
+
"array<mysample:point2d-1.0.0>": {
|
|
1233
|
+
test2: {
|
|
1234
|
+
modify: [
|
|
1098
1235
|
[
|
|
1099
1236
|
0,
|
|
1100
1237
|
[
|
|
1101
1238
|
{
|
|
1102
|
-
|
|
1103
|
-
|
|
1239
|
+
Float64: {
|
|
1240
|
+
x: 15.104284463262685,
|
|
1104
1241
|
},
|
|
1105
|
-
|
|
1242
|
+
typeid: "mysample:point2d-1.0.0",
|
|
1106
1243
|
},
|
|
1107
1244
|
],
|
|
1108
1245
|
],
|
|
@@ -1112,63 +1249,63 @@ describe('Reversible ChangeSets', function () {
|
|
|
1112
1249
|
},
|
|
1113
1250
|
};
|
|
1114
1251
|
var parentChangeSet = {
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1252
|
+
insert: {
|
|
1253
|
+
"mysample:point2d-1.0.0": {
|
|
1254
|
+
test: {
|
|
1255
|
+
String: {
|
|
1256
|
+
guid: "cd36cd32-0bd3-5c55-f94c-b95933fdc58b",
|
|
1120
1257
|
},
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1258
|
+
Float64: {
|
|
1259
|
+
x: 65.18242364168808,
|
|
1260
|
+
y: 0,
|
|
1124
1261
|
},
|
|
1125
1262
|
},
|
|
1126
1263
|
},
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1264
|
+
"array<mysample:point2d-1.0.0>": {
|
|
1265
|
+
test2: {
|
|
1266
|
+
insert: [
|
|
1130
1267
|
[
|
|
1131
1268
|
0,
|
|
1132
1269
|
[
|
|
1133
1270
|
{
|
|
1134
|
-
|
|
1135
|
-
|
|
1271
|
+
String: {
|
|
1272
|
+
guid: "e66540ff-9e5e-d599-033e-d3dd55efc2a3",
|
|
1136
1273
|
},
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1274
|
+
Float64: {
|
|
1275
|
+
x: 0,
|
|
1276
|
+
y: 0,
|
|
1140
1277
|
},
|
|
1141
|
-
|
|
1278
|
+
typeid: "mysample:point2d-1.0.0",
|
|
1142
1279
|
},
|
|
1143
1280
|
{
|
|
1144
|
-
|
|
1145
|
-
|
|
1281
|
+
String: {
|
|
1282
|
+
guid: "daeb5439-baef-7986-f90a-6a3a2f082250",
|
|
1146
1283
|
},
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1284
|
+
Float64: {
|
|
1285
|
+
x: 0,
|
|
1286
|
+
y: 0,
|
|
1150
1287
|
},
|
|
1151
|
-
|
|
1288
|
+
typeid: "mysample:point2d-1.0.0",
|
|
1152
1289
|
},
|
|
1153
1290
|
],
|
|
1154
1291
|
],
|
|
1155
1292
|
],
|
|
1156
1293
|
},
|
|
1157
|
-
|
|
1294
|
+
test3: {},
|
|
1158
1295
|
},
|
|
1159
1296
|
},
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1297
|
+
insertTemplates: {
|
|
1298
|
+
"mysample:point2d-1.0.0": {
|
|
1299
|
+
typeid: "mysample:point2d-1.0.0",
|
|
1300
|
+
inherits: "NamedProperty",
|
|
1301
|
+
properties: [
|
|
1165
1302
|
{
|
|
1166
|
-
|
|
1167
|
-
|
|
1303
|
+
id: "x",
|
|
1304
|
+
typeid: "Float64",
|
|
1168
1305
|
},
|
|
1169
1306
|
{
|
|
1170
|
-
|
|
1171
|
-
|
|
1307
|
+
id: "y",
|
|
1308
|
+
typeid: "Float64",
|
|
1172
1309
|
},
|
|
1173
1310
|
],
|
|
1174
1311
|
},
|
|
@@ -1177,21 +1314,21 @@ describe('Reversible ChangeSets', function () {
|
|
|
1177
1314
|
var changeSet = new ChangeSet(originalChangeSet);
|
|
1178
1315
|
changeSet._toReversibleChangeSet(parentChangeSet);
|
|
1179
1316
|
expect(changeSet.getSerializedChangeSet()).to.eql({
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1317
|
+
modify: {
|
|
1318
|
+
"array<mysample:point2d-1.0.0>": {
|
|
1319
|
+
test2: {
|
|
1320
|
+
modify: [
|
|
1184
1321
|
[
|
|
1185
1322
|
0,
|
|
1186
1323
|
[
|
|
1187
1324
|
{
|
|
1188
|
-
|
|
1189
|
-
|
|
1325
|
+
Float64: {
|
|
1326
|
+
x: {
|
|
1190
1327
|
value: 15.104284463262685,
|
|
1191
1328
|
oldValue: 0,
|
|
1192
1329
|
},
|
|
1193
1330
|
},
|
|
1194
|
-
|
|
1331
|
+
typeid: "mysample:point2d-1.0.0",
|
|
1195
1332
|
},
|
|
1196
1333
|
],
|
|
1197
1334
|
],
|
|
@@ -1202,21 +1339,21 @@ describe('Reversible ChangeSets', function () {
|
|
|
1202
1339
|
});
|
|
1203
1340
|
changeSet.toInverseChangeSet();
|
|
1204
1341
|
expect(changeSet.getSerializedChangeSet()).to.eql({
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1342
|
+
modify: {
|
|
1343
|
+
"array<mysample:point2d-1.0.0>": {
|
|
1344
|
+
test2: {
|
|
1345
|
+
modify: [
|
|
1209
1346
|
[
|
|
1210
1347
|
0,
|
|
1211
1348
|
[
|
|
1212
1349
|
{
|
|
1213
|
-
|
|
1214
|
-
|
|
1350
|
+
Float64: {
|
|
1351
|
+
x: {
|
|
1215
1352
|
value: 0,
|
|
1216
1353
|
oldValue: 15.104284463262685,
|
|
1217
1354
|
},
|
|
1218
1355
|
},
|
|
1219
|
-
|
|
1356
|
+
typeid: "mysample:point2d-1.0.0",
|
|
1220
1357
|
},
|
|
1221
1358
|
],
|
|
1222
1359
|
],
|
|
@@ -1226,31 +1363,31 @@ describe('Reversible ChangeSets', function () {
|
|
|
1226
1363
|
},
|
|
1227
1364
|
});
|
|
1228
1365
|
});
|
|
1229
|
-
it(
|
|
1366
|
+
it("should correctly reverse inserts of strings", function () {
|
|
1230
1367
|
let CS = new ChangeSet({
|
|
1231
1368
|
insert: {
|
|
1232
|
-
|
|
1233
|
-
|
|
1369
|
+
String: {
|
|
1370
|
+
test: "xxx",
|
|
1234
1371
|
},
|
|
1235
1372
|
},
|
|
1236
1373
|
});
|
|
1237
1374
|
CS.toInverseChangeSet();
|
|
1238
1375
|
expect(CS.getSerializedChangeSet()).to.deep.equal({
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1376
|
+
remove: {
|
|
1377
|
+
String: {
|
|
1378
|
+
test: "xxx",
|
|
1242
1379
|
},
|
|
1243
1380
|
},
|
|
1244
1381
|
});
|
|
1245
1382
|
});
|
|
1246
|
-
it(
|
|
1383
|
+
it("should correctly reverse inserts of literal strings within NodeProperties", function () {
|
|
1247
1384
|
let CS = new ChangeSet({
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1385
|
+
modify: {
|
|
1386
|
+
NodeProperty: {
|
|
1387
|
+
test: {
|
|
1251
1388
|
insert: {
|
|
1252
|
-
|
|
1253
|
-
|
|
1389
|
+
String: {
|
|
1390
|
+
test: "xxx",
|
|
1254
1391
|
},
|
|
1255
1392
|
},
|
|
1256
1393
|
},
|
|
@@ -1259,12 +1396,12 @@ describe('Reversible ChangeSets', function () {
|
|
|
1259
1396
|
});
|
|
1260
1397
|
CS.toInverseChangeSet();
|
|
1261
1398
|
expect(CS.getSerializedChangeSet()).to.deep.equal({
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1399
|
+
modify: {
|
|
1400
|
+
NodeProperty: {
|
|
1401
|
+
test: {
|
|
1402
|
+
remove: {
|
|
1403
|
+
String: {
|
|
1404
|
+
test: "xxx",
|
|
1268
1405
|
},
|
|
1269
1406
|
},
|
|
1270
1407
|
},
|
|
@@ -1272,39 +1409,45 @@ describe('Reversible ChangeSets', function () {
|
|
|
1272
1409
|
},
|
|
1273
1410
|
});
|
|
1274
1411
|
});
|
|
1275
|
-
it(
|
|
1276
|
-
var parentChangeSet = require(
|
|
1277
|
-
var originalChangeSet = require(
|
|
1412
|
+
it("@regression should not fail when building reversible change sets", function () {
|
|
1413
|
+
var parentChangeSet = require("./validation/reversibleChangeSetTestData.js").parentChangeSet;
|
|
1414
|
+
var originalChangeSet = require("./validation/reversibleChangeSetTestData.js").originalChangeSet;
|
|
1278
1415
|
var changeSet = new ChangeSet(originalChangeSet);
|
|
1279
1416
|
changeSet._toReversibleChangeSet(parentChangeSet);
|
|
1280
1417
|
});
|
|
1281
|
-
it(
|
|
1418
|
+
it("@regression should not fail when creating a reversible change set", function () {
|
|
1282
1419
|
var cs = {
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1420
|
+
modify: {
|
|
1421
|
+
"autodesk.compute:graph-1.0.0": {
|
|
1422
|
+
"5eb6ebe1-92c8-52fa-984b-b0b65c46d2a7": {
|
|
1423
|
+
"map<autodesk.compute:node-2.0.0>": {
|
|
1424
|
+
computeNodes: {
|
|
1425
|
+
modify: {
|
|
1426
|
+
"autodesk.compute:fanOut-1.0.0": {
|
|
1427
|
+
"a7e7d213-1202-9ee4-a3c1-8a33d6f36122": {
|
|
1428
|
+
"autodesk.compute:context-1.0.0": {
|
|
1429
|
+
computeContext: {
|
|
1430
|
+
"Reference<autodesk.compute:resource-2.0.0>": {
|
|
1431
|
+
resource: "/8ce10fdd-b2b6-7152-21dc-c0e199b579e3",
|
|
1432
|
+
},
|
|
1433
|
+
},
|
|
1293
1434
|
},
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1435
|
+
"map<autodesk.compute:node-2.0.0>": {
|
|
1436
|
+
computeNodes: {
|
|
1437
|
+
modify: {
|
|
1438
|
+
"autodesk.test:testCN-1.0.0": {
|
|
1439
|
+
"1e924300-92ef-eaad-391f-53b77fe01099": {
|
|
1440
|
+
"enum<Enum>": { status: 1 },
|
|
1441
|
+
"autodesk.compute:context-1.0.0": {
|
|
1442
|
+
computeContext: {
|
|
1443
|
+
"Reference<autodesk.compute:resource-2.0.0>": {
|
|
1444
|
+
resource: "/c1a811ea-608e-5fcc-1487-c74ab6939dee",
|
|
1303
1445
|
},
|
|
1304
1446
|
},
|
|
1305
|
-
},
|
|
1306
|
-
|
|
1307
|
-
|
|
1447
|
+
},
|
|
1448
|
+
"Reference<autodesk.core:user-1.0.0>": {
|
|
1449
|
+
"inputs.input": "/5eb6ebe1-92c8-52fa-984b-b0b65c46d2a7.computeNodes[a7e7d213-1202-9ee4-a3c1-8a33d6f36122]" +
|
|
1450
|
+
".intermediateProperties[2c06da5c-8614-e9c2-3bd6-75ae739eba4f]",
|
|
1308
1451
|
},
|
|
1309
1452
|
},
|
|
1310
1453
|
},
|
|
@@ -1321,24 +1464,35 @@ describe('Reversible ChangeSets', function () {
|
|
|
1321
1464
|
},
|
|
1322
1465
|
};
|
|
1323
1466
|
var parent = {
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1467
|
+
insert: {
|
|
1468
|
+
"autodesk.compute:graph-1.0.0": {
|
|
1469
|
+
"5eb6ebe1-92c8-52fa-984b-b0b65c46d2a7": {
|
|
1470
|
+
"map<autodesk.compute:node-2.0.0>": {
|
|
1471
|
+
computeNodes: {
|
|
1472
|
+
insert: {
|
|
1473
|
+
"autodesk.compute:fanOut-1.0.0": {
|
|
1474
|
+
"a7e7d213-1202-9ee4-a3c1-8a33d6f36122": {
|
|
1475
|
+
"autodesk.compute:context-1.0.0": {
|
|
1476
|
+
computeContext: {
|
|
1477
|
+
"Reference<autodesk.compute:resource-2.0.0>": {
|
|
1478
|
+
resource: "",
|
|
1479
|
+
},
|
|
1480
|
+
},
|
|
1481
|
+
},
|
|
1482
|
+
"map<autodesk.compute:node-2.0.0>": {
|
|
1483
|
+
computeNodes: {
|
|
1484
|
+
insert: {
|
|
1485
|
+
"autodesk.test:testCN-1.0.0": {
|
|
1486
|
+
"1e924300-92ef-eaad-391f-53b77fe01099": {
|
|
1487
|
+
"enum<Enum>": { status: 0 },
|
|
1488
|
+
"autodesk.compute:context-1.0.0": {
|
|
1489
|
+
computeContext: {
|
|
1490
|
+
"Reference<autodesk.compute:resource-2.0.0>": {
|
|
1491
|
+
resource: "",
|
|
1492
|
+
},
|
|
1493
|
+
},
|
|
1494
|
+
},
|
|
1495
|
+
"Reference<autodesk.core:user-1.0.0>": { "inputs.input": "" },
|
|
1342
1496
|
},
|
|
1343
1497
|
},
|
|
1344
1498
|
},
|