forked from mike42/gfx-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add 16-bit decoding with default masks
- Loading branch information
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Mike42\GfxPhp\Codec\Bmp; | ||
|
||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
class GifCodecTest extends TestCase | ||
{ | ||
|
||
/** | ||
* Decode various 16-bit pixels with the default 5-5-5 bit depths | ||
*/ | ||
public function testReadDefaults() | ||
{ | ||
// 5-5-5, little-endian encoded as 2 bytes. | ||
$this -> assertEquals([0, 0, 0], BmpFile::read16bit([0x00, 0x00])); // Black | ||
$this -> assertEquals([0, 0, 0], BmpFile::read16bit([0x00, 0x80])); // Also black (MSB ignored) | ||
$this -> assertEquals([255, 255, 255], BmpFile::read16bit([0xff, 0xff])); // White | ||
$this -> assertEquals([0, 0, 255], BmpFile::read16bit([0x1f, 0])); // Blue | ||
$this -> assertEquals([0, 255, 0], BmpFile::read16bit([0xe0, 0x03])); // Green | ||
$this -> assertEquals([255, 0, 0], BmpFile::read16bit([0x00, 0x7c])); // Red | ||
} | ||
|
||
|
||
} |