Skip to content

Commit 62d4d06

Browse files
committed
打开ignore的测试案例,review by songym。ChangeTileVersionSpec本地可以跑过,先打开
1 parent 49f59d9 commit 62d4d06

File tree

5 files changed

+50
-83
lines changed

5 files changed

+50
-83
lines changed

test/leaflet/control/ChangeTileVersionSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('leaflet_ChangeTileVersion', () => {
9595
expect(tileVersion.tileVersions.length).toEqual(2);
9696
});
9797

98-
xit('tilesVersion', () => {
98+
it('tilesVersion', () => {
9999
tileVersion.tilesVersion("0");
100100
var version = tileVersion.getVersion();
101101
expect(version).toEqual("0");

test/mapboxgl/overlay/GraphThemeLayerSpec.js

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {Graph} from '../../../src/mapboxgl/overlay/GraphThemeLayer';
2-
import {ThemeFeature} from '../../../src/mapboxgl/overlay/theme/ThemeFeature';
1+
import { Graph } from '../../../src/mapboxgl/overlay/GraphThemeLayer';
2+
import { ThemeFeature } from '../../../src/mapboxgl/overlay/theme/ThemeFeature';
33
import '../../resources/chinaConsumptionLevel';
44
import mapboxgl from 'mapbox-gl';
55

@@ -64,13 +64,13 @@ describe('mapboxgl_GraphThemeLayer', () => {
6464
width: 240,
6565
height: 100,
6666
codomain: [0, 40000], // 允许图表展示的值域范围,此范围外的数据将不制作图表
67-
barStyle: {fillOpacity: 0.7}, // 柱状图中柱条的(表示字段值的图形)样式
68-
barHoverStyle: {fillOpacity: 1}, // 柱条 hover 样式
67+
barStyle: { fillOpacity: 0.7 }, // 柱状图中柱条的(表示字段值的图形)样式
68+
barHoverStyle: { fillOpacity: 1 }, // 柱条 hover 样式
6969
xShapeBlank: [10, 10, 10], // 水平方向上的空白间距参数
7070
axisYTick: 4, // y 轴刻度数量
7171
axisYLabels: ["4万", "3万", "2万", "1万", "0"], // y 轴标签内容
7272
axisXLabels: ["09年", "10年", "11年", "12年", "13年"], // x 轴标签内容
73-
backgroundStyle: {fillColor: "#CCE8CF"}, // 背景样式
73+
backgroundStyle: { fillColor: "#CCE8CF" }, // 背景样式
7474
backgroundRadius: [5, 5, 5, 5], // 背景框圆角参数
7575
//阴影开关 默认是打开
7676
showShadow: true,
@@ -151,13 +151,13 @@ describe('mapboxgl_GraphThemeLayer', () => {
151151
width: 240,
152152
height: 100,
153153
codomain: [0, 40000],
154-
barStyle: {fillOpacity: 0.7},
155-
barHoverStyle: {fillOpacity: 1},
154+
barStyle: { fillOpacity: 0.7 },
155+
barHoverStyle: { fillOpacity: 1 },
156156
xShapeBlank: [10, 10, 10],
157157
axisYTick: 4,
158158
axisYLabels: ["4万", "3万", "2万", "1万", "0"],
159159
axisXLabels: ["09年", "10年", "11年", "12年", "13年"],
160-
backgroundStyle: {fillColor: "#CCE8CF"},
160+
backgroundStyle: { fillColor: "#CCE8CF" },
161161
backgroundRadius: [5, 5, 5, 5],
162162
showShadow: true,
163163
barShadowStyle: {
@@ -223,12 +223,12 @@ describe('mapboxgl_GraphThemeLayer', () => {
223223
}
224224
});
225225
var quadrilateral, quadrilateral2;
226-
quadrilateral = [{"x": 1, "y": 1}, {"x": 3, "y": 1}, {"x": 6, "y": 4}, {"x": 2, "y": 10}, {"x": 1, "y": 1}];
227-
quadrilateral2 = [{"x": 1, "y": 1}, {"x": 3, "y": 1}, {"x": 6, "y": 4}, {"x": 2, "y": 10}, {"x": 1, "y": 1}];
226+
quadrilateral = [{ "x": 1, "y": 1 }, { "x": 3, "y": 1 }, { "x": 6, "y": 4 }, { "x": 2, "y": 10 }, { "x": 1, "y": 1 }];
227+
quadrilateral2 = [{ "x": 1, "y": 1 }, { "x": 3, "y": 1 }, { "x": 6, "y": 4 }, { "x": 2, "y": 10 }, { "x": 1, "y": 1 }];
228228
var isQuadrilateralOverLap = graphThemeLayer.isQuadrilateralOverLap(quadrilateral, quadrilateral2);
229229
expect(isQuadrilateralOverLap).toBeTruthy();
230-
var point = {"x": 2, "y": 5};
231-
var polygon = [{"x": 1, "y": 1}, {"x": 3, "y": 1}, {"x": 6, "y": 4}, {"x": 2, "y": 10}, {"x": 1, "y": 1}];
230+
var point = { "x": 2, "y": 5 };
231+
var polygon = [{ "x": 1, "y": 1 }, { "x": 3, "y": 1 }, { "x": 6, "y": 4 }, { "x": 2, "y": 10 }, { "x": 1, "y": 1 }];
232232
var isPointInPoly = graphThemeLayer.isPointInPoly(point, polygon);
233233
expect(isPointInPoly).toBeTruthy();
234234
graphThemeLayer.clear();
@@ -245,13 +245,13 @@ describe('mapboxgl_GraphThemeLayer', () => {
245245
width: 240,
246246
height: 100,
247247
codomain: [0, 40000],
248-
barStyle: {fillOpacity: 0.7},
249-
barHoverStyle: {fillOpacity: 1},
248+
barStyle: { fillOpacity: 0.7 },
249+
barHoverStyle: { fillOpacity: 1 },
250250
xShapeBlank: [10, 10, 10],
251251
axisYTick: 4,
252252
axisYLabels: ["4万", "3万", "2万", "1万", "0"],
253253
axisXLabels: ["09年", "10年", "11年", "12年", "13年"],
254-
backgroundStyle: {fillColor: "#CCE8CF"},
254+
backgroundStyle: { fillColor: "#CCE8CF" },
255255
backgroundRadius: [5, 5, 5, 5],
256256
showShadow: true,
257257
barShadowStyle: {
@@ -279,7 +279,7 @@ describe('mapboxgl_GraphThemeLayer', () => {
279279
codomain: [0, 40000]
280280
},
281281
charts: [1, 2, 3],
282-
cache: {'name': 'ONETWO'}
282+
cache: { 'name': 'ONETWO' }
283283
});
284284
expect(graphThemeLayer.charts.length).toEqual(3);
285285
expect(graphThemeLayer.cache).toEqual(Object({
@@ -302,13 +302,14 @@ describe('mapboxgl_GraphThemeLayer', () => {
302302
codomain: [0, 40000]
303303
},
304304
charts: [1, 2, 3],
305-
cache: {'name': 'ONETWO'}
305+
cache: { 'name': 'ONETWO' }
306306
});
307307
expect(graphThemeLayer.visibility).toBeTruthy();
308308
graphThemeLayer.setVisibility(false);
309309
expect(graphThemeLayer.visibility).toBeFalsy();
310310
});
311-
xit('moveTo', () => {
311+
312+
it('moveTo', () => {
312313
const graphThemeLayer = new Graph("GraphThemeLayer", "Bar", {
313314
map: map,
314315
isOverLay: false,
@@ -319,9 +320,10 @@ describe('mapboxgl_GraphThemeLayer', () => {
319320
codomain: [0, 40000]
320321
},
321322
charts: [1, 2, 3],
322-
cache: {'name': 'ONETWO'}
323+
cache: { 'name': 'ONETWO' }
323324
});
324-
map.addLayer(graphThemeLayer);
325+
//ThemeLayer 75行已经添加过一次了
326+
// map.addLayer(graphThemeLayer);
325327
const graphThemeLayer2 = new Graph("GraphThemeLayer2", "Bar", {
326328
map: map,
327329
isOverLay: false,
@@ -332,13 +334,13 @@ describe('mapboxgl_GraphThemeLayer', () => {
332334
codomain: [0, 40000]
333335
},
334336
charts: [1, 2, 3],
335-
cache: {'name': 'ONETWO'}
337+
cache: { 'name': 'ONETWO' }
336338
});
337-
map.addLayer(graphThemeLayer2);
338-
const zIndex = graphThemeLayer.div.style.zIndex;
339-
const zIndex2 = graphThemeLayer2.div.style.zIndex;
340-
expect(zIndex2).toBeGreaterThan(zIndex);
341-
graphThemeLayer.moveTo("graphThemeLayer2");
342-
expect(zIndex).toBeGreaterThan(zIndex2);
339+
//ThemeLayer 75行已经添加过一次了
340+
// map.addLayer(graphThemeLayer2);
341+
//移动前,第一个layer是第一个
342+
expect(graphThemeLayer.div.parentNode.getElementsByClassName("themeLayer")[0].id).toEqual(graphThemeLayer.id);
343+
graphThemeLayer2.moveTo(graphThemeLayer.id);
344+
expect(graphThemeLayer.div.parentNode.getElementsByClassName("themeLayer")[0].id).toEqual(graphThemeLayer2.id);
343345
});
344346
});

test/mapboxgl/services/DensityAnalysisSpec.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,4 @@ describe('mapboxgl_SpatialAnalystService_densityAnalysis', () => {
9494
});
9595
});
9696

97-
// 删除测试过程中产生的测试数据集
98-
xit('delete test resources', (done)=> {
99-
var testResult = GlobeParameter.datachangchunURL + resultDataset;
100-
request.delete(testResult);
101-
done();
102-
});
10397
});

test/mapboxgl/services/LayerInfoServiceSpec.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ describe('mapboxgl_LayerInfoService', () => {
3333
return Promise.resolve(new Response("["+JSON.stringify(layersInfo)+"]"));
3434
});
3535
service.getLayersInfo((result) => {
36-
serviceResult = result
37-
});
38-
setTimeout(() => {
36+
serviceResult = result;
3937
try {
4038
expect(service).not.toBeNull();
4139
expect(serviceResult).not.toBeNull();
@@ -57,11 +55,12 @@ describe('mapboxgl_LayerInfoService', () => {
5755
expect(false).toBeTruthy();
5856
done();
5957
}
60-
}, 5000)
58+
});
59+
6160
});
6261

6362
//子图层显示控制服务
64-
it('setLayerStatus', (done) => {
63+
it('setLayerStatus', (done) => {
6564
var layerStatus = [new LayerStatus({
6665
layerName: "continent_T@World",
6766
isVisible: true,
@@ -95,8 +94,6 @@ describe('mapboxgl_LayerInfoService', () => {
9594
});
9695
layerService.setLayerStatus(setLayerStatusParameters, (result) => {
9796
serviceResult = result;
98-
});
99-
setTimeout(() => {
10097
try {
10198
expect(layerService).not.toBeNull();
10299
expect(serviceResult).not.toBeNull();
@@ -109,7 +106,8 @@ describe('mapboxgl_LayerInfoService', () => {
109106
expect(false).toBeTruthy();
110107
done();
111108
}
112-
}, 5000);
109+
});
110+
113111
});
114112

115113
//新建临时图层 isTempLayers=false
@@ -127,9 +125,7 @@ describe('mapboxgl_LayerInfoService', () => {
127125
return Promise.resolve(new Response(`{"postResultType":"CreateChild","newResourceID":"c01d29d8d41743adb673cd1cecda6ed0_1c0bda07fde943a4a5f3f3d4eb44235d","succeed":true,"newResourceLocation":"http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/c01d29d8d41743adb673cd1cecda6ed0_1c0bda07fde943a4a5f3f3d4eb44235d.json"}`));
128126
});
129127
service.setLayersInfo(setLayersInfoParameters, (result) => {
130-
serviceResult = result
131-
});
132-
setTimeout(() => {
128+
serviceResult = result;
133129
try {
134130
expect(service).not.toBeNull();
135131
expect(serviceResult).not.toBeNull();
@@ -145,7 +141,8 @@ describe('mapboxgl_LayerInfoService', () => {
145141
expect(false).toBeTruthy();
146142
done();
147143
}
148-
}, 5000)
144+
});
145+
149146
});
150147

151148
//修改临时图层的信息 isTempLayers=true
@@ -164,9 +161,7 @@ describe('mapboxgl_LayerInfoService', () => {
164161
return Promise.resolve(new Response(`{"succeed":true}`));
165162
});
166163
service.setLayersInfo(setLayersInfoParameters, (result) => {
167-
serviceResult = result
168-
});
169-
setTimeout(() => {
164+
serviceResult = result;
170165
try {
171166
expect(service).not.toBeNull();
172167
expect(serviceResult).not.toBeNull();
@@ -181,11 +176,11 @@ describe('mapboxgl_LayerInfoService', () => {
181176
expect(false).toBeTruthy();
182177
done();
183178
}
184-
}, 5000)
179+
});
185180
});
186181

187182
//设置图层信息服务 并实现临时图层中子图层的修改
188-
xit('setLayerInfo', (done) => {
183+
it('setLayerInfo', (done) => {
189184
var layers = layerInfo;
190185
layers.description = "this is a test";
191186
var setLayerInfoParameters = new SetLayerInfoParameters({
@@ -194,10 +189,13 @@ describe('mapboxgl_LayerInfoService', () => {
194189
layerInfo: layers
195190
});
196191
var service = new LayerInfoService(url);
197-
service.setLayerInfo(setLayerInfoParameters, (result) => {
198-
serviceResult = result
192+
spyOn(FetchRequest, 'put').and.callFake((testUrl) => {
193+
expect(testUrl).toContain("continent_T@World.1@@World.json");
194+
expect(options).not.toBeNull();
195+
return Promise.resolve(new Response(`{"succeed":true,"newResourceLocation":"http://localhost:8090/iserver/services/map-world/rest/maps/World Map/tempLayersSet/c01d29d8d41743adb673cd1cecda6ed0_1c0bda07fde943a4a5f3f3d4eb44235d/continent_T@World.1@@World"}`));
199196
});
200-
setTimeout(() => {
197+
service.setLayerInfo(setLayerInfoParameters, (result) => {
198+
serviceResult = result;
201199
try {
202200
expect(service).not.toBeNull();
203201
expect(serviceResult).not.toBeNull();
@@ -212,7 +210,8 @@ describe('mapboxgl_LayerInfoService', () => {
212210
expect(false).toBeTruthy();
213211
done();
214212
}
215-
}, 8000);
213+
});
214+
216215
});
217216
});
218217

test/openlayers/overlay/VectorTileSuperMapRestSpec.js

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,32 +57,4 @@ describe('openlayers_VectorTileSuperMapRest', () => {
5757
}
5858
}, 6000);
5959
});
60-
61-
xit('serverType of iportal', () => {
62-
var iportaoUrl = "http://support.supermap.com.cn:8092/web/maps/44";
63-
var vectorTileOptions, vectorTilesource;
64-
65-
new MapService(iportaoUrl).getMapInfo((serviceResult) => {
66-
vectorTileOptions = VectorTileSuperMapRest.optionsFromMapJSON(iportaoUrl, serviceResult.result);
67-
vectorTilesource = new VectorTileSuperMapRest(vectorTileOptions);
68-
var vectorLayer = new ol.layer.VectorTile({
69-
source: vectorTilesource
70-
});
71-
map.addLayer(vectorLayer);
72-
});
73-
setTimeout(() => {
74-
try {
75-
expect(vectorTileOptions).not.toBeNull();
76-
expect(vectorTileOptions.serverType).toBe("IPORTAL");
77-
expect(vectorTileOptions.crossOrigin).toBe("anonymous");
78-
79-
expect(vectorTilesource).not.toBeNull();
80-
expect(vectorTilesource.urls.length).toBe(1);
81-
done();
82-
} catch (exception) {
83-
console.log("'constructor and static test'案例失败:" + exception.name + ":" + exception.message);
84-
expect(false).toBeTruthy();
85-
}
86-
}, 6000);
87-
});
8860
});

0 commit comments

Comments
 (0)