Skip to content

Commit 824ceb1

Browse files
author
Shehata
committed
Update imagery specs to for imagebitmap
1 parent dca9ed1 commit 824ceb1

14 files changed

+291
-159
lines changed

Specs/Scene/ArcGisMapServerImageryProviderSpec.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ defineSuite([
66
'Core/Cartographic',
77
'Core/DefaultProxy',
88
'Core/defined',
9+
'Core/FeatureDetection',
910
'Core/GeographicTilingScheme',
1011
'Core/getAbsoluteUri',
1112
'Core/objectToQuery',
@@ -22,6 +23,7 @@ defineSuite([
2223
'Scene/ImageryProvider',
2324
'Scene/ImageryState',
2425
'Specs/pollToPromise',
26+
'Specs/isImageOrImageBitmap',
2527
'ThirdParty/Uri'
2628
], function(
2729
ArcGisMapServerImageryProvider,
@@ -31,6 +33,7 @@ defineSuite([
3133
Cartographic,
3234
DefaultProxy,
3335
defined,
36+
FeatureDetection,
3437
GeographicTilingScheme,
3538
getAbsoluteUri,
3639
objectToQuery,
@@ -47,9 +50,14 @@ defineSuite([
4750
ImageryProvider,
4851
ImageryState,
4952
pollToPromise,
53+
isImageOrImageBitmap,
5054
Uri) {
5155
'use strict';
5256

57+
beforeAll(function() {
58+
return FeatureDetection.supportsImageBitmapOptions();
59+
});
60+
5361
beforeEach(function() {
5462
RequestScheduler.clearForSpecs();
5563
});
@@ -225,7 +233,7 @@ defineSuite([
225233
};
226234

227235
return provider.requestImage(0, 0, 0).then(function(image) {
228-
expect(image).toBeInstanceOf(Image);
236+
expect(isImageOrImageBitmap(image)).toBe(true);
229237
});
230238
});
231239
});
@@ -302,7 +310,7 @@ defineSuite([
302310
};
303311

304312
return provider.requestImage(0, 0, 0).then(function(image) {
305-
expect(image).toBeInstanceOf(Image);
313+
expect(isImageOrImageBitmap(image)).toBe(true);
306314
});
307315
});
308316
});
@@ -355,7 +363,7 @@ defineSuite([
355363
};
356364

357365
return provider.requestImage(0, 0, 0).then(function(image) {
358-
expect(image).toBeInstanceOf(Image);
366+
expect(isImageOrImageBitmap(image)).toBe(true);
359367
});
360368
});
361369
});
@@ -419,7 +427,7 @@ defineSuite([
419427
};
420428

421429
return provider.requestImage(0, 0, 0).then(function(image) {
422-
expect(image).toBeInstanceOf(Image);
430+
expect(isImageOrImageBitmap(image)).toBe(true);
423431
});
424432
});
425433
});
@@ -475,7 +483,7 @@ defineSuite([
475483
};
476484

477485
return provider.requestImage(0, 0, 0).then(function(image) {
478-
expect(image).toBeInstanceOf(Image);
486+
expect(isImageOrImageBitmap(image)).toBe(true);
479487
});
480488
});
481489
});
@@ -609,7 +617,7 @@ defineSuite([
609617
return pollToPromise(function() {
610618
return imagery.state === ImageryState.RECEIVED;
611619
}).then(function() {
612-
expect(imagery.image).toBeInstanceOf(Image);
620+
expect(isImageOrImageBitmap(imagery.image)).toBe(true);
613621
expect(tries).toEqual(2);
614622
imagery.releaseReference();
615623
});

Specs/Scene/BillboardCollectionSpec.js

+28-18
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ defineSuite([
66
'Core/Cartesian3',
77
'Core/CesiumTerrainProvider',
88
'Core/Color',
9+
'Core/createGuid',
910
'Core/DistanceDisplayCondition',
11+
'Core/FeatureDetection',
1012
'Core/Math',
1113
'Core/NearFarScalar',
1214
'Core/OrthographicOffCenterFrustum',
@@ -31,7 +33,9 @@ defineSuite([
3133
Cartesian3,
3234
CesiumTerrainProvider,
3335
Color,
36+
createGuid,
3437
DistanceDisplayCondition,
38+
FeatureDetection,
3539
CesiumMath,
3640
NearFarScalar,
3741
OrthographicOffCenterFrustum,
@@ -65,19 +69,23 @@ defineSuite([
6569
context = scene.context;
6670
camera = scene.camera;
6771

68-
return when.join(
69-
Resource.fetchImage('./Data/Images/Green2x2.png').then(function(result) {
70-
greenImage = result;
71-
}),
72-
Resource.fetchImage('./Data/Images/Blue2x2.png').then(function(result) {
73-
blueImage = result;
74-
}),
75-
Resource.fetchImage('./Data/Images/White2x2.png').then(function(result) {
76-
whiteImage = result;
77-
}),
78-
Resource.fetchImage('./Data/Images/Blue10x10.png').then(function(result) {
79-
largeBlueImage = result;
80-
}));
72+
return FeatureDetection.supportsImageBitmapOptions()
73+
.then(function() {
74+
return when.join(
75+
Resource.fetchImage('./Data/Images/Green2x2.png').then(function(result) {
76+
greenImage = result;
77+
}),
78+
Resource.fetchImage('./Data/Images/Blue2x2.png').then(function(result) {
79+
blueImage = result;
80+
}),
81+
Resource.fetchImage('./Data/Images/White2x2.png').then(function(result) {
82+
whiteImage = result;
83+
}),
84+
Resource.fetchImage('./Data/Images/Blue10x10.png').then(function(result) {
85+
largeBlueImage = result;
86+
})
87+
);
88+
});
8189
});
8290

8391
afterAll(function() {
@@ -174,7 +182,7 @@ defineSuite([
174182
expect(b.horizontalOrigin).toEqual(HorizontalOrigin.LEFT);
175183
expect(b.verticalOrigin).toEqual(VerticalOrigin.BOTTOM);
176184
expect(b.scale).toEqual(2.0);
177-
expect(b.image).toEqual(greenImage.src);
185+
expect(b.image).toEqual(b._imageId);
178186
expect(b.color.red).toEqual(1.0);
179187
expect(b.color.green).toEqual(2.0);
180188
expect(b.color.blue).toEqual(3.0);
@@ -221,7 +229,7 @@ defineSuite([
221229
expect(b.horizontalOrigin).toEqual(HorizontalOrigin.LEFT);
222230
expect(b.verticalOrigin).toEqual(VerticalOrigin.BOTTOM);
223231
expect(b.scale).toEqual(2.0);
224-
expect(b.image).toEqual(greenImage.src);
232+
expect(b.image).toEqual(b._imageId);
225233
expect(b.color.red).toEqual(1.0);
226234
expect(b.color.green).toEqual(2.0);
227235
expect(b.color.blue).toEqual(3.0);
@@ -822,7 +830,7 @@ defineSuite([
822830

823831
expect(scene).toRender([0, 255, 0, 255]);
824832

825-
b.setImage(largeBlueImage.src, largeBlueImage);
833+
b.setImage(createGuid(), largeBlueImage);
826834
expect(scene).toRender([0, 0, 255, 255]);
827835
});
828836

@@ -834,8 +842,10 @@ defineSuite([
834842

835843
expect(scene).toRender([0, 255, 0, 255]);
836844

837-
billboards.textureAtlas.addImage(largeBlueImage.src, largeBlueImage);
838-
b.setImageSubRegion(largeBlueImage.src, new BoundingRectangle(5.0, 5.0, 1.0, 1.0));
845+
var guid = createGuid();
846+
847+
billboards.textureAtlas.addImage(guid, largeBlueImage);
848+
b.setImageSubRegion(guid, new BoundingRectangle(5.0, 5.0, 1.0, 1.0));
839849
expect(scene).toRender([0, 0, 255, 255]);
840850
});
841851

Specs/Scene/BingMapsImageryProviderSpec.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ defineSuite([
33
'Core/appendForwardSlash',
44
'Core/DefaultProxy',
55
'Core/defined',
6+
'Core/FeatureDetection',
67
'Core/queryToObject',
78
'Core/RequestScheduler',
89
'Core/Resource',
@@ -14,12 +15,14 @@ defineSuite([
1415
'Scene/ImageryProvider',
1516
'Scene/ImageryState',
1617
'Specs/pollToPromise',
18+
'Specs/isImageOrImageBitmap',
1719
'ThirdParty/Uri'
1820
], function(
1921
BingMapsImageryProvider,
2022
appendForwardSlash,
2123
DefaultProxy,
2224
defined,
25+
FeatureDetection,
2326
queryToObject,
2427
RequestScheduler,
2528
Resource,
@@ -31,9 +34,14 @@ defineSuite([
3134
ImageryProvider,
3235
ImageryState,
3336
pollToPromise,
37+
isImageOrImageBitmap,
3438
Uri) {
3539
'use strict';
3640

41+
beforeAll(function() {
42+
return FeatureDetection.supportsImageBitmapOptions();
43+
});
44+
3745
beforeEach(function() {
3846
RequestScheduler.clearForSpecs();
3947
});
@@ -362,7 +370,7 @@ defineSuite([
362370
});
363371

364372
return provider.requestImage(0, 0, 0).then(function(image) {
365-
expect(image).toBeInstanceOf(Image);
373+
expect(isImageOrImageBitmap(image)).toBe(true);
366374
});
367375
});
368376
});
@@ -393,7 +401,7 @@ defineSuite([
393401
});
394402

395403
return provider.requestImage(0, 0, 0).then(function(image) {
396-
expect(image).toBeInstanceOf(Image);
404+
expect(isImageOrImageBitmap(image)).toBe(true);
397405
});
398406
});
399407
});
@@ -482,7 +490,7 @@ defineSuite([
482490
return pollToPromise(function() {
483491
return imagery.state === ImageryState.RECEIVED;
484492
}).then(function() {
485-
expect(imagery.image).toBeInstanceOf(Image);
493+
expect(isImageOrImageBitmap(imagery.image)).toBe(true);
486494
expect(tries).toEqual(2);
487495
imagery.releaseReference();
488496
});

Specs/Scene/GoogleEarthEnterpriseImageryProviderSpec.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ defineSuite([
44
'Core/DefaultProxy',
55
'Core/defaultValue',
66
'Core/defined',
7+
'Core/FeatureDetection',
78
'Core/GeographicTilingScheme',
89
'Core/GoogleEarthEnterpriseMetadata',
910
'Core/GoogleEarthEnterpriseTileInformation',
@@ -16,6 +17,7 @@ defineSuite([
1617
'Scene/ImageryProvider',
1718
'Scene/ImageryState',
1819
'Specs/pollToPromise',
20+
'Specs/isImageOrImageBitmap',
1921
'ThirdParty/Uri',
2022
'ThirdParty/when'
2123
], function(
@@ -24,6 +26,7 @@ defineSuite([
2426
DefaultProxy,
2527
defaultValue,
2628
defined,
29+
FeatureDetection,
2730
GeographicTilingScheme,
2831
GoogleEarthEnterpriseMetadata,
2932
GoogleEarthEnterpriseTileInformation,
@@ -36,6 +39,7 @@ defineSuite([
3639
ImageryProvider,
3740
ImageryState,
3841
pollToPromise,
42+
isImageOrImageBitmap,
3943
Uri,
4044
when) {
4145
'use strict';
@@ -46,6 +50,7 @@ defineSuite([
4650

4751
beforeAll(function() {
4852
decodeGoogleEarthEnterpriseData.passThroughDataForTesting = true;
53+
return FeatureDetection.supportsImageBitmapOptions();
4954
});
5055

5156
afterAll(function() {
@@ -224,7 +229,7 @@ defineSuite([
224229
installFakeImageRequest('http://fake.fake.invalid/flatfile?f1-03-i.1');
225230

226231
return imageryProvider.requestImage(0, 0, 0).then(function(image) {
227-
expect(image).toBeInstanceOf(Image);
232+
expect(isImageOrImageBitmap(image)).toBe(true);
228233
});
229234
});
230235
});
@@ -294,7 +299,7 @@ defineSuite([
294299
return pollToPromise(function() {
295300
return imagery.state === ImageryState.RECEIVED;
296301
}).then(function() {
297-
expect(imagery.image).toBeInstanceOf(Image);
302+
expect(isImageOrImageBitmap(imagery.image)).toBe(true);
298303
expect(tries).toEqual(2);
299304
imagery.releaseReference();
300305
});

Specs/Scene/GoogleEarthEnterpriseMapsProviderSpec.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
defineSuite([
22
'Scene/GoogleEarthEnterpriseMapsProvider',
33
'Core/DefaultProxy',
4+
'Core/FeatureDetection',
45
'Core/GeographicTilingScheme',
56
'Core/Rectangle',
67
'Core/RequestScheduler',
@@ -10,10 +11,12 @@ defineSuite([
1011
'Scene/ImageryLayer',
1112
'Scene/ImageryProvider',
1213
'Scene/ImageryState',
13-
'Specs/pollToPromise'
14+
'Specs/pollToPromise',
15+
'Specs/isImageOrImageBitmap'
1416
], function(
1517
GoogleEarthEnterpriseMapsProvider,
1618
DefaultProxy,
19+
FeatureDetection,
1720
GeographicTilingScheme,
1821
Rectangle,
1922
RequestScheduler,
@@ -23,9 +26,14 @@ defineSuite([
2326
ImageryLayer,
2427
ImageryProvider,
2528
ImageryState,
26-
pollToPromise) {
29+
pollToPromise,
30+
isImageOrImageBitmap) {
2731
'use strict';
2832

33+
beforeAll(function() {
34+
return FeatureDetection.supportsImageBitmapOptions();
35+
});
36+
2937
afterEach(function() {
3038
Resource._Implementations.createImage = Resource._DefaultImplementations.createImage;
3139
Resource._Implementations.loadWithXhr = Resource._DefaultImplementations.loadWithXhr;
@@ -191,7 +199,7 @@ defineSuite([
191199
};
192200

193201
return provider.requestImage(0, 0, 0).then(function(image) {
194-
expect(image).toBeInstanceOf(Image);
202+
expect(isImageOrImageBitmap(image)).toBe(true);
195203
});
196204
});
197205
});
@@ -327,7 +335,7 @@ defineSuite([
327335
return pollToPromise(function() {
328336
return imagery.state === ImageryState.RECEIVED;
329337
}).then(function() {
330-
expect(imagery.image).toBeInstanceOf(Image);
338+
expect(isImageOrImageBitmap(imagery.image)).toBe(true);
331339
expect(tries).toEqual(2);
332340
imagery.releaseReference();
333341
});

0 commit comments

Comments
 (0)