Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for some test failures on IE and Firefox #6766

Merged
merged 3 commits into from
Jul 2, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Source/Core/GroundPolylineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,11 +648,11 @@ define([
var absStartLon = Math.abs(start.longitude);
var absEndLon = Math.abs(end.longitude);
if (CesiumMath.equalsEpsilon(absStartLon, CesiumMath.PI, CesiumMath.EPSILON11)) {
var endSign = Math.sign(end.longitude);
var endSign = CesiumMath.sign(end.longitude);
start.longitude = endSign * (absStartLon - CesiumMath.EPSILON11);
return 1;
} else if (CesiumMath.equalsEpsilon(absEndLon, CesiumMath.PI, CesiumMath.EPSILON11)) {
var startSign = Math.sign(start.longitude);
var startSign = CesiumMath.sign(start.longitude);
end.longitude = startSign * (absEndLon - CesiumMath.EPSILON11);
return 2;
}
Expand Down Expand Up @@ -861,15 +861,15 @@ define([
startGeometryNormal2D.x = 0.0;
// If start longitude is negative and end longitude is less negative, relative right is unit -Y
// If start longitude is positive and end longitude is less positive, relative right is unit +Y
startGeometryNormal2D.y = Math.sign(startCartographic.longitude - Math.abs(endCartographic.longitude));
startGeometryNormal2D.y = CesiumMath.sign(startCartographic.longitude - Math.abs(endCartographic.longitude));
startGeometryNormal2D.z = 0.0;
} else {
// End is close to IDL - snap end normal to align with IDL
startGeometryNormal2D = projectNormal(projection, startCartographic, startGeometryNormal, start2D, segmentStartNormal2DScratch);
endGeometryNormal2D.x = 0.0;
// If end longitude is negative and start longitude is less negative, relative right is unit Y
// If end longitude is positive and start longitude is less positive, relative right is unit -Y
endGeometryNormal2D.y = Math.sign(startCartographic.longitude - endCartographic.longitude);
endGeometryNormal2D.y = CesiumMath.sign(startCartographic.longitude - endCartographic.longitude);
endGeometryNormal2D.z = 0.0;
}
}
Expand Down
8 changes: 4 additions & 4 deletions Specs/Core/CircleGeometrySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ defineSuite([
});

var r = ellipse.rectangle;
expect(r.north).toEqual(0.698966597893341);
expect(r.south).toEqual(0.698652226072367);
expect(r.east).toEqual(-1.3192254919753026);
expect(r.west).toEqual(-1.3196344953554853);
expect(r.north).toEqualEpsilon(0.698966597893341, CesiumMath.EPSILON7);
expect(r.south).toEqualEpsilon(0.698652226072367, CesiumMath.EPSILON7);
expect(r.east).toEqualEpsilon(-1.3192254919753026, CesiumMath.EPSILON7);
expect(r.west).toEqualEpsilon(-1.3196344953554853, CesiumMath.EPSILON7);
});

it('computing textureCoordinateRotationPoints property', function() {
Expand Down
32 changes: 17 additions & 15 deletions Specs/Core/GeometryPipelineSpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defineSuite([
'Core/GeometryPipeline',
'Core/arraySlice',
'Core/AttributeCompression',
'Core/BoundingSphere',
'Core/BoxGeometry',
Expand All @@ -22,6 +23,7 @@ defineSuite([
'Core/VertexFormat'
], function(
GeometryPipeline,
arraySlice,
AttributeCompression,
BoundingSphere,
BoxGeometry,
Expand Down Expand Up @@ -1739,7 +1741,7 @@ defineSuite([
minimum : new Cartesian3(-250000.0, -250000.0, -250000.0)
}));
expect(geometry.attributes.normal).toBeDefined();
var originalNormals = Array.prototype.slice.call(geometry.attributes.normal.values);
var originalNormals = arraySlice(geometry.attributes.normal.values);

geometry = GeometryPipeline.compressVertices(geometry);

Expand All @@ -1763,7 +1765,7 @@ defineSuite([
minimum : new Cartesian3(-250000.0, -250000.0, -250000.0)
}));
expect(geometry.attributes.st).toBeDefined();
var originalST = Array.prototype.slice.call(geometry.attributes.st.values);
var originalST = arraySlice(geometry.attributes.st.values);

geometry = GeometryPipeline.compressVertices(geometry);

Expand Down Expand Up @@ -1794,8 +1796,8 @@ defineSuite([
}));
expect(geometry.attributes.normal).toBeDefined();
expect(geometry.attributes.st).toBeDefined();
var originalNormals = Array.prototype.slice.call(geometry.attributes.normal.values);
var originalST = Array.prototype.slice.call(geometry.attributes.st.values);
var originalNormals = arraySlice(geometry.attributes.normal.values);
var originalST = arraySlice(geometry.attributes.st.values);

geometry = GeometryPipeline.compressVertices(geometry);

Expand Down Expand Up @@ -1826,9 +1828,9 @@ defineSuite([
expect(geometry.attributes.normal).toBeDefined();
expect(geometry.attributes.tangent).toBeDefined();
expect(geometry.attributes.bitangent).toBeDefined();
var originalNormals = Array.prototype.slice.call(geometry.attributes.normal.values);
var originalTangents = Array.prototype.slice.call(geometry.attributes.tangent.values);
var originalBitangents = Array.prototype.slice.call(geometry.attributes.bitangent.values);
var originalNormals = arraySlice(geometry.attributes.normal.values);
var originalTangents = arraySlice(geometry.attributes.tangent.values);
var originalBitangents = arraySlice(geometry.attributes.bitangent.values);

geometry = GeometryPipeline.compressVertices(geometry);

Expand Down Expand Up @@ -1949,10 +1951,10 @@ defineSuite([
var index;

// Expect eastern hemisphere vertices to all be 255 or 127 at the end of the value
expect(newScalars.indexOf(127)).not.toBe(-1);
expect(newVec4s.indexOf(127)).not.toBe(-1);
expect(newVec3s.indexOf(127)).not.toBe(-1);
expect(newVec2s.indexOf(127)).not.toBe(-1);
expect(Array.prototype.indexOf.call(newScalars, 127)).not.toBe(-1);
expect(Array.prototype.indexOf.call(newVec4s, 127)).not.toBe(-1);
expect(Array.prototype.indexOf.call(newVec3s, 127)).not.toBe(-1);
expect(Array.prototype.indexOf.call(newVec2s, 127)).not.toBe(-1);
for (i = 0; i < 3; i++) {
expect(newScalars[i] === 255 || newScalars[i] === 127).toBe(true);

Expand Down Expand Up @@ -1981,10 +1983,10 @@ defineSuite([
newScalars = westHemisphereGeometry.attributes.scalars.values;

// Expect eastern hemisphere vertices to all be 0 or 127 at the end of the value
expect(newScalars.indexOf(127)).not.toBe(-1);
expect(newVec4s.indexOf(127)).not.toBe(-1);
expect(newVec3s.indexOf(127)).not.toBe(-1);
expect(newVec2s.indexOf(127)).not.toBe(-1);
expect(Array.prototype.indexOf.call(newScalars, 127)).not.toBe(-1);
expect(Array.prototype.indexOf.call(newVec4s, 127)).not.toBe(-1);
expect(Array.prototype.indexOf.call(newVec3s, 127)).not.toBe(-1);
expect(Array.prototype.indexOf.call(newVec2s, 127)).not.toBe(-1);
for (i = 0; i < 4; i++) {
expect(newScalars[i] === 0 || newScalars[i] === 127).toBe(true);

Expand Down
14 changes: 8 additions & 6 deletions Specs/Core/GroundPolylineGeometrySpec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defineSuite([
'Core/GroundPolylineGeometry',
'Core/ApproximateTerrainHeights',
'Core/arraySlice',
'Core/Cartesian3',
'Core/Cartographic',
'Core/Math',
Expand All @@ -11,6 +12,7 @@ defineSuite([
], function(
GroundPolylineGeometry,
ApproximateTerrainHeights,
arraySlice,
Cartesian3,
Cartographic,
CesiumMath,
Expand All @@ -33,11 +35,11 @@ defineSuite([
var values = attribute.values;
var componentsPerAttribute = attribute.componentsPerAttribute;
var vertexCount = values.length / componentsPerAttribute;
var firstVertex = values.slice(0, componentsPerAttribute);
var firstVertex = arraySlice(values, 0, componentsPerAttribute);
var identical = true;
for (var i = 1; i < vertexCount; i++) {
var index = i * componentsPerAttribute;
var vertex = values.slice(index, index + componentsPerAttribute);
var vertex = arraySlice(values, index, index + componentsPerAttribute);
for (var j = 0; j < componentsPerAttribute; j++) {
if (vertex[j] !== firstVertex[j]) {
identical = false;
Expand Down Expand Up @@ -89,21 +91,21 @@ defineSuite([
var values = endNormalAndTextureCoordinateNormalizationX.values;
for (i = 0; i < 4; i++) {
index = i * 4 + 3;
expect(Math.sign(values[index])).toEqual(1.0);
expect(CesiumMath.sign(values[index])).toEqual(1.0);
}
for (i = 4; i < 8; i++) {
index = i * 4 + 3;
expect(Math.sign(values[index])).toEqual(-1.0);
expect(CesiumMath.sign(values[index])).toEqual(-1.0);
}

values = texcoordNormalization2D.values;
for (i = 0; i < 4; i++) {
index = i * 2;
expect(Math.sign(values[index])).toEqual(1.0);
expect(CesiumMath.sign(values[index])).toEqual(1.0);
}
for (i = 4; i < 8; i++) {
index = i * 2;
expect(Math.sign(values[index])).toEqual(-1.0);
expect(CesiumMath.sign(values[index])).toEqual(-1.0);
}

// Expect rightNormalAndTextureCoordinateNormalizationY and texcoordNormalization2D.y to encode if the vertex is on the bottom
Expand Down
8 changes: 4 additions & 4 deletions Specs/Core/RectangleGeometrySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,10 @@ defineSuite([
});

var r = geometry.rectangle;
expect(CesiumMath.toDegrees(r.north)).toEqual(1.414213562373095);
expect(CesiumMath.toDegrees(r.south)).toEqual(-1.414213562373095);
expect(CesiumMath.toDegrees(r.east)).toEqual(1.414213562373095);
expect(CesiumMath.toDegrees(r.west)).toEqual(-1.4142135623730951);
expect(CesiumMath.toDegrees(r.north)).toEqualEpsilon(1.414213562373095, CesiumMath.EPSILON7);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't epsilon 7 a little low here? Is that really the best we can do? Same for circle geometry.

expect(CesiumMath.toDegrees(r.south)).toEqualEpsilon(-1.414213562373095, CesiumMath.EPSILON7);
expect(CesiumMath.toDegrees(r.east)).toEqualEpsilon(1.414213562373095, CesiumMath.EPSILON7);
expect(CesiumMath.toDegrees(r.west)).toEqualEpsilon(-1.4142135623730951, CesiumMath.EPSILON7);
});

it('computing textureCoordinateRotationPoints property', function() {
Expand Down