@@ -15,7 +15,6 @@ describe('classic_MapVLayer', function () {
1515 testDiv . style . width = "500px" ;
1616 testDiv . style . height = "500px" ;
1717 window . document . body . appendChild ( testDiv ) ;
18-
1918 map = new SuperMap . Map ( "map" , {
2019 controls : [
2120 new SuperMap . Control . Attribution ( ) ,
@@ -28,28 +27,23 @@ describe('classic_MapVLayer', function () {
2827 } ) ]
2928 } ) ;
3029 baseLayer = new SuperMap . Layer . TiledDynamicRESTLayer ( "China" , url , {
31- units :"m" ,
30+ units : "m" ,
3231 transparent : true ,
3332 cacheEnabled : true
3433 } , { maxResolution : "auto" } ) ;
3534 baseLayer . events . on ( { "layerInitialized" : addLayer } ) ;
36-
3735 function addLayer ( ) {
3836 map . addLayers ( [ baseLayer ] ) ;
3937 map . setCenter ( new SuperMap . LonLat ( 104 , 34.7 ) , 2 ) ;
4038 }
4139 } ) ;
4240 beforeEach ( function ( ) {
43-
4441 //创建mapVLayer
4542 var randomCount = 1000 ;
46-
4743 var data = [ ] ;
48-
4944 var citys = [ "北京" , "天津" , "上海" , "重庆" , "石家庄" , "太原" , "呼和浩特" , "哈尔滨" , "长春" , "沈阳" , "济南" ,
5045 "南京" , "合肥" , "杭州" , "南昌" , "福州" , "郑州" , "武汉" , "长沙" , "广州" , "南宁" , "西安" , "银川" , "兰州" ,
5146 "西宁" , "乌鲁木齐" , "成都" , "贵阳" , "昆明" , "拉萨" , "海口" ] ;
52-
5347 // 构造数据
5448 while ( randomCount -- ) {
5549 var cityCenter = mapv . utilCityCenter . getCenterByCityName ( citys [ parseInt ( Math . random ( ) * citys . length ) ] ) ;
@@ -61,9 +55,7 @@ describe('classic_MapVLayer', function () {
6155 count : 30 * Math . random ( )
6256 } ) ;
6357 }
64-
6558 var dataSet = new mapv . DataSet ( data ) ;
66-
6759 var options = {
6860 fillStyle : 'rgba(55, 50, 250, 0.8)' ,
6961 shadowColor : 'rgba(255, 250, 50, 1)' ,
@@ -78,30 +70,25 @@ describe('classic_MapVLayer', function () {
7870 gradient : { 0.25 : "rgb(0,0,255)" , 0.55 : "rgb(0,255,0)" , 0.85 : "yellow" , 1.0 : "rgb(255,0,0)" } ,
7971 draw : 'honeycomb'
8072 } ;
81-
8273 mapvLayer = new SuperMap . Layer . MapVLayer ( "mapv" , { dataSet : dataSet , options : options } ) ;
8374 map . addLayer ( mapvLayer ) ;
84-
8575 originalTimeout = jasmine . DEFAULT_TIMEOUT_INTERVAL ;
8676 jasmine . DEFAULT_TIMEOUT_INTERVAL = 50000 ;
8777 } ) ;
88-
8978 afterEach ( function ( ) {
9079 jasmine . DEFAULT_TIMEOUT_INTERVAL = originalTimeout ;
9180 mapvLayer . destroy ( ) ;
9281 } ) ;
93-
9482 afterAll ( function ( ) {
9583 document . body . removeChild ( testDiv ) ;
9684 //map.destroy();
9785 mapv = null ;
9886 } ) ;
9987
100- it ( 'constructor test ' , function ( ) {
88+ it ( 'constructor' , function ( ) {
10189 expect ( mapvLayer ) . not . toBeNull ( ) ;
10290 expect ( mapvLayer . options . shadowBlur ) . toEqual ( 20 ) ;
10391 expect ( mapvLayer . options . draw ) . toBe ( "honeycomb" ) ;
104-
10592 //判断是否返回期望的maplayer
10693 expect ( mapvLayer . renderer ) . not . toBeNull ( ) ;
10794 expect ( mapvLayer . renderer . context ) . toBe ( "2d" ) ;
@@ -112,7 +99,7 @@ describe('classic_MapVLayer', function () {
11299 expect ( mapvLayer . renderer . canvasLayer . minScale ) . toEqual ( 590591790 ) ;
113100 } ) ;
114101
115- it ( 'adddata test ' , function ( ) {
102+ it ( 'addData ' , function ( ) {
116103 var data = [ {
117104 geometry : {
118105 type : 'Point' ,
@@ -125,35 +112,34 @@ describe('classic_MapVLayer', function () {
125112 shadowBlur : 30
126113 }
127114 mapvLayer . addData ( dataset , tempoption ) ;
128-
129115 expect ( mapvLayer . dataSet ) . not . toBeNull ( ) ;
130116 expect ( mapvLayer . dataSet . _data [ 1000 ] . count ) . toEqual ( 111 ) ;
131117 expect ( mapvLayer . dataSet . _data [ 1000 ] . geometry . coordinates [ 0 ] ) . toEqual ( 109 ) ;
132118 expect ( mapvLayer . dataSet . _data [ 1000 ] . geometry . coordinates [ 1 ] ) . toEqual ( 32 ) ;
133119 expect ( mapvLayer . options . shadowBlur ) . toEqual ( 30 ) ;
134120 } ) ;
135121
136- it ( 'getData test ' , function ( ) {
122+ it ( 'getData' , function ( ) {
137123 var dataset = mapvLayer . getData ( )
138124 expect ( dataset . _data . length ) . toEqual ( 1000 ) ;
139125 } ) ;
140126
141127 //删除数据 待开发修改
142- xit ( 'removeData test' , function ( done ) {
143- var filter = function ( data ) {
144- if ( mapvLayer . dataSet . _data . indexOf ( data ) === 2 ) {
145- return true
146- }
147- return false ;
148- }
149- mapvLayer . removeData ( filter ) ;
150- setTimeout ( function ( ) {
151- expect ( mapvLayer . dataSet . _data . length ) . toEqual ( 999 ) ;
152- done ( ) ;
153- } , 5000 ) ;
154- } ) ;
128+ xit ( 'removeData' , function ( done ) {
129+ var filter = function ( data ) {
130+ if ( mapvLayer . dataSet . _data . indexOf ( data ) === 2 ) {
131+ return true
132+ }
133+ return false ;
134+ }
135+ mapvLayer . removeData ( filter ) ;
136+ setTimeout ( function ( ) {
137+ expect ( mapvLayer . dataSet . _data . length ) . toEqual ( 999 ) ;
138+ done ( ) ;
139+ } , 5000 ) ;
140+ } ) ;
155141
156- it ( 'setData test ' , function ( ) {
142+ it ( 'setData' , function ( ) {
157143 var data = [ {
158144 geometry : {
159145 type : 'Point' ,
@@ -166,20 +152,19 @@ describe('classic_MapVLayer', function () {
166152 shadowBlur : 40
167153 }
168154 mapvLayer . setData ( dataset , tempoption ) ;
169-
170155 expect ( mapvLayer . dataSet . _data . length ) . toEqual ( 1 ) ;
171156 expect ( mapvLayer . dataSet . _data [ 0 ] . count ) . toEqual ( 111 ) ;
172157 expect ( mapvLayer . dataSet . _data [ 0 ] . geometry . coordinates [ 0 ] ) . toEqual ( 109 ) ;
173158 expect ( mapvLayer . dataSet . _data [ 0 ] . geometry . coordinates [ 1 ] ) . toEqual ( 32 ) ;
174159 expect ( mapvLayer . options . shadowBlur ) . toEqual ( 40 ) ;
175160 } ) ;
176161
177- it ( 'clearData test ' , function ( ) {
162+ it ( 'clearData' , function ( ) {
178163 mapvLayer . clearData ( ) ;
179164 expect ( mapvLayer . dataSet . _data . length ) . toEqual ( 0 ) ;
180165 } ) ;
181166
182- it ( 'destroy test ' , function ( ) {
167+ it ( 'destroy' , function ( ) {
183168 mapvLayer . destroy ( ) ;
184169 expect ( mapvLayer . dataSet ) . toBeNull ( ) ;
185170 expect ( mapvLayer . options ) . toBeNull ( ) ;
@@ -190,13 +175,13 @@ describe('classic_MapVLayer', function () {
190175 expect ( mapvLayer . maxHeight ) . toBeNull ( ) ;
191176 } ) ;
192177
193- xit ( 'setMap test ' , function ( ) {
178+ xit ( 'setMap' , function ( ) {
194179 mapvLayer . setMap ( map ) ;
195180 expect ( mapvLayer ) . not . toBeNull ( ) ;
196181 expect ( mapvLayer . dataSet . _data . length ) . toEqual ( 1000 ) ;
197182 } ) ;
198183
199- xit ( 'moveTo test ' , function ( ) {
184+ xit ( 'moveTo' , function ( ) {
200185 var bounds = new SuperMap . Bounds ( - 180 , - 90 , 180 , 90 ) ;
201186 mapvLayer . moveTo ( bounds , false , true ) ;
202187 expect ( mapvLayer ) . not . toBeNull ( ) ;
@@ -208,10 +193,9 @@ describe('classic_MapVLayer', function () {
208193 } ) ;
209194
210195 //开发bug,待确认
211- xit ( 'transferToMapLatLng test ' , function ( ) {
196+ xit ( 'transferToMapLatLng' , function ( ) {
212197 var latlng = new SuperMap . LonLat ( 104 , 34.7 ) ;
213198 mapvLayer . transferToMapLatLng ( latlng ) ;
214-
215199 expect ( mapvLayer ) . not . toBeNull ( ) ;
216200 } ) ;
217201} ) ;
0 commit comments