ABC
ABC
ABC
ABC
ABC
This is a test of the SVGLengthList::initialize() API.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


Check initial list state of text1
PASS text1.x.baseVal.numberOfItems is 3
PASS text1.x.baseVal.getItem(0).value is 500
PASS text1.x.baseVal.getItem(1).value is 1000
PASS text1.x.baseVal.getItem(2).value is 1500
PASS text1.x.baseVal.getItem(3) threw exception Error: IndexSizeError: DOM Exception 1.

Check initial list state of text2
PASS text2.x.baseVal.numberOfItems is 2
PASS text2.x.baseVal.getItem(0).value is 50
PASS text2.x.baseVal.getItem(1).value is 500
PASS text2.x.baseVal.getItem(2) threw exception Error: IndexSizeError: DOM Exception 1.

Check initial list state of text3
PASS text3.x.baseVal.numberOfItems is 3
PASS text3.x.baseVal.getItem(0).value is 50
PASS text3.x.baseVal.getItem(1).value is 500
PASS text3.x.baseVal.getItem(2).value is 50
PASS text3.x.baseVal.getItem(3) threw exception Error: IndexSizeError: DOM Exception 1.

Check initial list state of text4
PASS text4.x.baseVal.numberOfItems is 1
PASS text4.x.baseVal.getItem(0).value is 500
PASS text4.x.baseVal.getItem(1) threw exception Error: IndexSizeError: DOM Exception 1.

Create a new SVGLength object, that will be the only x coordinate in the first text element.
PASS newLength.value is 50

Initialize SVGLengthList with 'newLength'
PASS text1.x.baseVal.initialize(newLength) is newLength
PASS text1.x.baseVal.getItem(0) is newLength

Take the second x item '500' of the second text element, store it in 'itemInAnotherList' change it to '50'
PASS text2.x.baseVal.getItem(1).value is 500
PASS text2.x.baseVal.getItem(1).value is 50

Override the third text elements x list with the item x=50 from the second text element, where it should be removed afterwards
PASS text3.x.baseVal.initialize(itemInAnotherList) is itemInAnotherList
PASS text3.x.baseVal.getItem(0).value is 50
PASS text2.x.baseVal.getItem(0).value is 50
PASS text2.x.baseVal.getItem(1) threw exception Error: IndexSizeError: DOM Exception 1.

Assure that the 'itemInAnotherList' item is still live anymore, set value to 999 then back to 50
PASS itemInAnotherList.value = 999; is 999
PASS itemInAnotherList.value is 999
PASS text3.x.baseVal.getItem(0).value is 999
PASS itemInAnotherList.value = 50; is 50
PASS itemInAnotherList.value is 50
PASS text3.x.baseVal.getItem(0).value is 50

Move item from text3 to text4
PASS text4.x.baseVal.initialize(text3.x.baseVal.getItem(0)) is itemInAnotherList
PASS text4.x.baseVal.getItem(0).value is 50
PASS text3.x.baseVal.getItem(0) threw exception Error: IndexSizeError: DOM Exception 1.

Initialize text3 using setAttribute('x', '50')
PASS text3.x.baseVal.getItem(0).value is 50

Final check whether the lists all look like expected
PASS text1.x.baseVal.getItem(0).value is 50
PASS text2.x.baseVal.getItem(0).value is 50
PASS text3.x.baseVal.getItem(0).value is 50
PASS text4.x.baseVal.getItem(0).value is 50
PASS text1.x.baseVal.numberOfItems is 1
PASS text2.x.baseVal.numberOfItems is 1
PASS text3.x.baseVal.numberOfItems is 1
PASS text4.x.baseVal.numberOfItems is 1
PASS text1.x.baseVal.getItem(1) threw exception Error: IndexSizeError: DOM Exception 1.
PASS text2.x.baseVal.getItem(1) threw exception Error: IndexSizeError: DOM Exception 1.
PASS text3.x.baseVal.getItem(1) threw exception Error: IndexSizeError: DOM Exception 1.
PASS text4.x.baseVal.getItem(1) threw exception Error: IndexSizeError: DOM Exception 1.

The test passes if you only see 'PASS' messages, and all five text elements on top look the same

PASS successfullyParsed is true

TEST COMPLETE

