package com.ibm.emb.test.mfb;

// java stuff
import javax.emb.MediaConverterSpec;
import javax.emb.MediaException;

import org.objectweb.jonas.emb.mfb.converter.image.ImageResizeConverterSpec;

import com.ibm.emb.junit.EMBTestRunner;
import com.ibm.emb.test.MediaConverterSpecTest;

public class ImageResizeConverterSpecTest extends MediaConverterSpecTest {

    /**
     * constructor
     */
    public ImageResizeConverterSpecTest(String name) throws MediaException {
        super(name);
    }

    /**
     * main method
     */
    public static void main(String args[]) {
        EMBTestRunner.run(ImageResizeConverterSpecTest.class);
    }

    /**
     * do initialisation here
     */
    protected void setUp() {
    }

    /**
     * freeup resources
     */
    protected void tearDown() {
    }

    /**
     * creates an instance of ImageResizeConverterSpec with the given Parameters
     * used in super class of ImageResizeConverterSpecTest
     */
    public MediaConverterSpec createMediaConverterSpec() {

        return new ImageResizeConverterSpec();
    }

    /**
     * <pre>
     * 
     *  
     *   
     *        Testcase Name: ImageResizeConverterSpec(double)
     *        Testcase Number: TEMB0103SBA  
     *        
     *        setup:
     *        
     *        test procedure: 
     *        1.create ImageResizeConverterSpec passing 0.5
     *        --&gt; check for horizontalCropFactor = 0.5;
     *        --&gt; check for	verticalCropFactor = 0.5;
     *        --&gt; check for	width = 0;
     *        --&gt; check for	height = 0;
     *        
     *   
     *  
     * </pre>
     */
    public void testTEMB0103SBA() {
        //
        // test 1
        //
        ImageResizeConverterSpec testInstance = new ImageResizeConverterSpec(0.5);

        assertTrue("test 1 : ", testInstance.getHorizontalCropFactor() == 0.5
                && testInstance.getVerticalCropFactor() == 0.5 && testInstance.getWidth() == 0
                && testInstance.getHeight() == 0);
        testTrace("test 1 passed");

        succeed();
    }

    /**
     * <pre>
     * 
     *  
     *   
     *        Testcase Name: ImageResizeConverterSpec(double, double)
     *        Testcase Number: TEMB0104SBA  
     *        
     *        setup:
     *        
     *        test procedure:
     *        1.create ImageResizeConverterSpec passing 0.5 and 2.0
     *        --&gt; check for horizontalCropFactor = 0.5;
     *        --&gt; check for	verticalCropFactor = 2.0;
     *        --&gt; check for	width = 0;
     *        --&gt; check for	height = 0;	
     *        
     *   
     *  
     * </pre>
     */
    public void testTEMB0104SBA() {
        //
        // test 1
        //
        ImageResizeConverterSpec testInstance = new ImageResizeConverterSpec(0.5, 2.0);

        assertTrue("test 1 : ", testInstance.getHorizontalCropFactor() == 0.5
                && testInstance.getVerticalCropFactor() == 2.0 && testInstance.getWidth() == 0
                && testInstance.getHeight() == 0);
        testTrace("test 1 passed");

        succeed();
    }

    /**
     * <pre>
     * 
     *  
     *   
     *        Testcase Name: ImageResizeConverterSpec(double, int)
     *        Testcase Number: TEMB0105SBA  
     *        
     *        setup:
     *        
     *        test procedure:
     *        1.create ImageResizeConverterSpec passing 0.5 and 480
     *        --&gt; check for horizontalCropFactor = 0.5;
     *        --&gt; check for	verticalCropFactor = 0.0;
     *        --&gt; check for	width = 0;
     *        --&gt; check for	height = 480;
     *        
     *   
     *  
     * </pre>
     */
    public void testTEMB0105SBA() {
        //
        // test 1
        //
        ImageResizeConverterSpec testInstance = new ImageResizeConverterSpec(0.5, 480);

        assertTrue("test 1 : ", testInstance.getHorizontalCropFactor() == 0.5
                && testInstance.getVerticalCropFactor() == 0.0 && testInstance.getWidth() == 0
                && testInstance.getHeight() == 480);
        testTrace("test 1 passed");

        succeed();
    }

    /**
     * <pre>
     * 
     *  
     *   
     *        Testcase Name: ImageResizeConverterSpec(int, double)
     *        Testcase Number: TEMB0106SBA  
     *        
     *        setup:
     *        
     *        test procedure:
     *        1.create ImageResizeConverterSpec passing 640 and 0.5
     *        --&gt; check for horizontalCropFactor = 0.0;
     *        --&gt; check for	verticalCropFactor = 0.5;
     *        --&gt; check for	width = 640;
     *        --&gt; check for	height = 0;
     *        
     *   
     *  
     * </pre>
     */
    public void testTEMB0106SBA() {
        //
        // test 1
        //
        ImageResizeConverterSpec testInstance = new ImageResizeConverterSpec(640, 0.5);

        assertTrue("test 1 : ", testInstance.getHorizontalCropFactor() == 0.0
                && testInstance.getVerticalCropFactor() == 0.5 && testInstance.getWidth() == 640
                && testInstance.getHeight() == 0);
        testTrace("test 1 passed");

        succeed();
    }

}