package net.ranides.assira.ui.parsers;

import org.junit.Test;

import java.awt.*;
import java.util.List;

import static org.junit.Assert.*;

public class ParseSwingGeometryTest {

    @Test
    public void testPoint() {
        assertEquals(new Point(10,15), ParseSwingGeometry.parsePoint("10 15"));
        assertEquals(new Point(10,15), ParseSwingGeometry.parsePoint("10, 15"));
        assertEquals(new Point(10,15), ParseSwingGeometry.parsePoint("10px 15px"));
        assertEquals(new Point(10,15), ParseSwingGeometry.parsePoint("10px, 15px"));
    }

    @Test
    public void testDimension() {
        assertEquals(new Dimension(10,15), ParseSwingGeometry.parseDimension("10 15"));
        assertEquals(new Dimension(10,15), ParseSwingGeometry.parseDimension("10, 15"));
        assertEquals(new Dimension(10,15), ParseSwingGeometry.parseDimension("10px 15px"));
        assertEquals(new Dimension(10,15), ParseSwingGeometry.parseDimension("10px, 15px"));
    }

    @Test
    public void testRectangle() {
        assertEquals(new Rectangle(10, 15, 20, 40), ParseSwingGeometry.parseRectangle("10 15 20 40"));
        assertEquals(new Rectangle(10, 15, 20, 40), ParseSwingGeometry.parseRectangle("10, 15, 20, 40"));
        assertEquals(new Rectangle(10, 15, 20, 40), ParseSwingGeometry.parseRectangle("10px 15px 20px 40px"));
        assertEquals(new Rectangle(10, 15, 20, 40), ParseSwingGeometry.parseRectangle("10px, 15px, 20px, 40px"));
    }

    @Test
    public void testInsets() {
        assertEquals(new Insets(10, 15, 20, 40), ParseSwingGeometry.parseInsets("10 15 20 40"));
        assertEquals(new Insets(10, 15, 20, 40), ParseSwingGeometry.parseInsets("10, 15, 20, 40"));
        assertEquals(new Insets(10, 15, 20, 40), ParseSwingGeometry.parseInsets("10px 15px 20px 40px"));
        assertEquals(new Insets(10, 15, 20, 40), ParseSwingGeometry.parseInsets("10px, 15px, 20px, 40px"));
//        assertThrows(IllegalArgumentException.class, () -> {
//            ParseSwingGeometry.parseInsets("10px, 15px, 20px, 40px");
//        });
    }

}