replace all usage of copyOf() with clone(). Now copyOf() is officially deprecated and unused. supported only if users out there have used it, but we can phase it out in the next official release.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@961 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -75,11 +75,11 @@
|
||||
t.ok( bounds.getSize().equals(new OpenLayers.Size(100, 110)), "getCenterPixel() works correctly");
|
||||
}
|
||||
|
||||
function test_07_Bounds_copyOf(t) {
|
||||
function test_07_Bounds_clone(t) {
|
||||
t.plan( 6 );
|
||||
var oldBounds = new OpenLayers.Bounds(1,2,3,4);
|
||||
var bounds = oldBounds.copyOf();
|
||||
t.ok( bounds instanceof OpenLayers.Bounds, "copyOf returns new OpenLayers.Bounds object" );
|
||||
var bounds = oldBounds.clone();
|
||||
t.ok( bounds instanceof OpenLayers.Bounds, "clone returns new OpenLayers.Bounds object" );
|
||||
t.eq( bounds.left, 1, "bounds.left is set correctly" );
|
||||
t.eq( bounds.bottom, 2, "bounds.bottom is set correctly" );
|
||||
t.eq( bounds.right, 3, "bounds.right is set correctly" );
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
t.eq( lonlat.toShortString(), "5, 6", "lonlat.toShortString() returns correctly");
|
||||
}
|
||||
|
||||
function test_03_LonLat_copyOf(t) {
|
||||
function test_03_LonLat_clone(t) {
|
||||
t.plan( 4 );
|
||||
oldLonLat = new OpenLayers.LonLat(5,6);
|
||||
lonlat = oldLonLat.copyOf();
|
||||
t.ok( lonlat instanceof OpenLayers.LonLat, "copyOf returns new OpenLayers.LonLat object" );
|
||||
lonlat = oldLonLat.clone();
|
||||
t.ok( lonlat instanceof OpenLayers.LonLat, "clone returns new OpenLayers.LonLat object" );
|
||||
t.eq( lonlat.lon, 5, "lonlat.lon is set correctly");
|
||||
t.eq( lonlat.lat, 6, "lonlat.lat is set correctly");
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
t.eq( pixel.toString(), "x=5,y=6", "pixel.toString() returns correctly");
|
||||
}
|
||||
|
||||
function test_03_Pixel_copyOf(t) {
|
||||
function test_03_Pixel_clone(t) {
|
||||
t.plan( 4 );
|
||||
oldPixel = new OpenLayers.Pixel(5,6);
|
||||
pixel = oldPixel.copyOf();
|
||||
t.ok( pixel instanceof OpenLayers.Pixel, "copyOf returns new OpenLayers.Pixel object" );
|
||||
pixel = oldPixel.clone();
|
||||
t.ok( pixel instanceof OpenLayers.Pixel, "clone returns new OpenLayers.Pixel object" );
|
||||
t.eq( pixel.x, 5, "pixel.x is set correctly");
|
||||
t.eq( pixel.y, 6, "pixel.y is set correctly");
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
t.eq( size.toString(), "w=5,h=6", "size.toString() returns correctly");
|
||||
}
|
||||
|
||||
function test_03_Size_copyOf(t) {
|
||||
function test_03_Size_clone(t) {
|
||||
t.plan( 4 );
|
||||
|
||||
oldSize = new OpenLayers.Size(5,6);
|
||||
size = oldSize.copyOf();
|
||||
t.ok( size instanceof OpenLayers.Size, "copyOf returns new OpenLayers.Size object" );
|
||||
size = oldSize.clone();
|
||||
t.ok( size instanceof OpenLayers.Size, "clone returns new OpenLayers.Size object" );
|
||||
t.eq( size.w, 5, "Size.w is set correctly");
|
||||
t.eq( size.h, 6, "Size.h is set correctly");
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
array.remove(3);
|
||||
t.eq( array.toString(), "0,1,2,4,5,6", "array.remove works");
|
||||
|
||||
copy = array.copyOf();
|
||||
t.eq( copy.toString(), "0,1,2,4,5,6", "array.copyOf() works");
|
||||
copy = array.clone();
|
||||
t.eq( copy.toString(), "0,1,2,4,5,6", "array.clone() works");
|
||||
array.append(7);
|
||||
t.eq( copy.toString(), "0,1,2,4,5,6", "changing a value in the copied array doesnt affect the new array");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user