<commit_before><?php
    namespace Chameleon;

    use PHPUnit\Framework\TestCase;

    use Chameleon\Image;
    use Chameleon\Vector2;
    use Chameleon\Colors\RGBColor;
    use Chameleon\Patterns\BackgroundColor;

    final class ImageTest extends TestCase {

        private $image;

        /**
         * @before
         */
        public function setUp() {
            $this -> image = Image::create(20, 10);
        }

        /**
         * @covers \Chameleon\Image::create
         */
        public function testCreate() {
            $this -> assertObjectHasAttribute("imageResource", $this -> image);
        }

        /**
         * @covers \Chameleon\Image::fromFile
         */
        public function testfromFile() {
            $this -> image = Image::fromFile(__DIR__ . "/../docs/img/index/example.png");
            $this -> assertObjectHasAttribute("imageResource", $this -> image);
        }

        /**
         * @covers \Chameleon\Image::getWidth
         */
        public function testGetWidth() {
            $this -> assertEquals(20, $this -> image -> getWidth());
        }

        /**
         * @covers \Chameleon\Image::getHeight
         */
        public function testGetHeight() {
            $this -> assertEquals(10, $this -> image -> getHeight());
        }

        /**
         * @covers \Chameleon\Image::registerColor
         */
        public function testRegisterColor() {
            $color = new RGBColor(0, 0, 0);

            $this -> assertNotEquals(-1, $this -> image -> registerColor($color));
        }
        
        /**
         * @covers \Chameleon\Image::isColorRegistered
         */
        public function testIsColorRegisteredYes() {
            $color = new RGBColor(0, 0, 0);
            $this -> image -> registerColor($color);

            $this -> assertTrue($this -> image -> isColorRegistered($color));
        }

        /**
         * @covers \Chameleon\Image::isColorRegistered
         */
        public function testIsColorRegisteredNo() {
            $color = new RGBColor(0, 0, 0);

            $this -> assertFalse($this -> image -> isColorRegistered($color));
        }

        /**
         * @covers \Chameleon\Image::getPixel
         */
        public function testGetPixel() {
            // TODO: Use existing image as soon as implemented
            $color = new RGBColor(255, 127, 63);
            $this -> image -> setBackgroundPattern(new BackgroundColor($color));

            $this -> assertEquals($color, $this -> image -> getPixel(5, 5));
        }

        /**
         * @covers \Chameleon\Image::setPixel
         */
        public function testSetPixel() {
            $color = new RGBColor(63, 127, 255);<commit_msg>fix test<commit_after><?php
    namespace Chameleon;

    use PHPUnit\Framework\TestCase;

    use Chameleon\Image;
    use Chameleon\Vector2;
    use Chameleon\Colors\RGBColor;
    use Chameleon\Patterns\BackgroundColor;

    final class ImageTest extends TestCase {

        private $image;

        /**
         * @before
         */
        public function setUp() {
            $this -> image = Image::create(20, 10);
        }

        /**
         * @covers \Chameleon\Image::create
         */
        public function testCreate() {
            $this -> assertObjectHasAttribute("imageResource", $this -> image);
        }

        /**
         * @covers \Chameleon\Image::fromFile
         */
        public function testfromFile() {
            $this -> image = Image::fromFile(__DIR__ . "/../docs/img/index/example.png");
            $this -> assertObjectHasAttribute("imageResource", $this -> image);
        }

        /**
         * @covers \Chameleon\Image::getWidth
         */
        public function testGetWidth() {
            $this -> assertEquals(20, $this -> image -> getWidth());
        }

        /**
         * @covers \Chameleon\Image::getHeight
         */
        public function testGetHeight() {
            $this -> assertEquals(10, $this -> image -> getHeight());
        }

        /**
         * @covers \Chameleon\Image::registerColor
         */
        public function testRegisterColor() {
            $color = new RGBColor(0, 0, 0);

            $this -> assertNotEquals(-1, $this -> image -> registerColor($color));
        }
        
        /**
         * @covers \Chameleon\Image::isColorRegistered
         */
        public function testIsColorRegisteredYes() {
            $color = new RGBColor(0, 28, 0);
            $this -> image -> registerColor($color);

            $this -> assertTrue($this -> image -> isColorRegistered($color));
        }

        /**
         * @covers \Chameleon\Image::isColorRegistered
         */
        public function testIsColorRegisteredNo() {
            $color = new RGBColor(0, 28, 0);

            $this -> assertFalse($this -> image -> isColorRegistered($color));
        }

        /**
         * @covers \Chameleon\Image::getPixel
         */
        public function testGetPixel() {
            // TODO: Use existing image as soon as implemented
            $color = new RGBColor(255, 127, 63);
            $this -> image -> setBackgroundPattern(new BackgroundColor($color));

            $this -> assertEquals($color, $this -> image -> getPixel(5, 5));
        }

        /**
         * @covers \Chameleon\Image::setPixel
         */
        public function testSetPixel() {
            $color = new RGBColor(63, 127, 255);
{'fraction_non_alphanumeric': 0.13505059797608096, 'fraction_numerical': 0.013983440662373505, 'mean_word_length': 1.6725663716814159, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3665502', 'n_tokens_mistral': 1566, 'n_tokens_neox': 1473, 'n_words': 308}