/*
 * Copyright 2004-2005 The Trix Development Team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.trix.cuery.value;

import junit.framework.TestCase;

/**
 * DOCUMENT.
 * 
 * @author <a href="mailto:Teletha.T@gmail.com">Teletha Testarossa</a>
 * @version $ Id: CSSValueTest.java,v 1.01 2005/09/28 11:14:05 Teletha Exp $
 */
public class CSSValueTest extends TestCase {

    /*
     * Test method for 'org.w3c.dom.css.CSSValueList.getLength()'
     */
    public void testGetLength() {
        CSSValue value1 = new Identifier("1", null);
        CSSValue value2 = new Identifier("2", value1);
        CSSValue value3 = new Identifier("3", value2);
        CSSValue value4 = new Identifier("4", value3);

        assertEquals(4, value1.getLength());
        assertEquals(4, value2.getLength());
        assertEquals(4, value3.getLength());
        assertEquals(4, value4.getLength());
    }

    /*
     * Test method for 'org.w3c.dom.css.CSSValueList.item(int)'
     */
    public void testItem() {
        CSSValue value1 = new Identifier("1", null);
        CSSValue value2 = new Identifier("2", value1);
        CSSValue value3 = new Identifier("3", value2);
        CSSValue value4 = new Identifier("4", value3);

        assertEquals("1", value1.item(0).getCssText());
        assertEquals("2", value1.item(1).getCssText());
        assertEquals("3", value4.item(2).getCssText());
        assertEquals("4", value4.item(3).getCssText());
        
        assertNull(value3.item(-1));
        assertNull(value3.item(4));
    }
    
    /*
     * Test method for CSSValue#getPosition().
     */
    public void testPosition() {
        CSSValue value1 = new Identifier("1", null);
        CSSValue value2 = new Identifier("2", value1);
        CSSValue value3 = new Identifier("3", value2);
        CSSValue value4 = new Identifier("4", value3);

        assertEquals(0, value1.getPosition());
        assertEquals(1, value2.getPosition());
        assertEquals(2, value3.getPosition());
        assertEquals(3, value4.getPosition());
    }

}
