test/unit/GdEscposImageTest.php
/**
     * Check image against known width, height, output.
     */
Check image against known width, height, output.
Check image against known width height output .
private function checkImg(EscposImage $img, $width, $height, $rasterFormatExpected = null, $columnFormatExpected = null)
    {
        $rasterFormatActual = $img -> toRasterFormat();
        $columnFormatActual = $img -> toColumnFormat();
        if ($rasterFormatExpected === null) {
            echo "\nImage was: " . $img -> getWidth() . "x" . $img -> getHeight() . ", raster data \"" . friendlyBinary($rasterFormatActual) . "\"";
        }
        if ($columnFormatExpected === null) {
            echo "\nImage was: " . $img -> getWidth() . "x" . $img -> getHeight() . ", column data \"" . friendlyBinary($columnFormatActual) . "\"";
        }
        $this -> assertTrue($img -> getHeight() == $height);
        $this -> assertTrue($img -> getWidth() == $width);
        $this -> assertTrue($rasterFormatExpected === $rasterFormatActual);
        $this -> assertTrue($columnFormatExpected === $columnFormatActual);
    }
private function checkImg ( EscposImage $ img , $ width , $ height , $ rasterFormatExpected = null , $ columnFormatExpected = null ) { $ rasterFormatActual = $ img -> toRasterFormat ( ) ; $ columnFormatActual = $ img -> toColumnFormat ( ) ; if ( $ rasterFormatExpected === null ) { echo " \n Image was:  " . $ img -> getWidth ( ) . " x " . $ img -> getHeight ( ) . " , raster data  \" " . friendlyBinary ( $ rasterFormatActual ) . " \" " ; } if ( $ columnFormatExpected === null ) { echo " \n Image was:  " . $ img -> getWidth ( ) . " x " . $ img -> getHeight ( ) . " , column data  \" " . friendlyBinary ( $ columnFormatActual ) . " \" " ; } $ this -> assertTrue ( $ img -> getHeight ( ) == $ height ) ; $ this -> assertTrue ( $ img -> getWidth ( ) == $ width ) ; $ this -> assertTrue ( $ rasterFormatExpected === $ rasterFormatActual ) ; $ this -> assertTrue ( $ columnFormatExpected === $ columnFormatActual ) ; }
Check image against known width, height, output.
Check image against known width height output .