diff --git a/public/Examples/Glyphs_GD.php b/public/Examples/Glyphs_GD.php index 68ce7ec..49ad241 100755 --- a/public/Examples/Glyphs_GD.php +++ b/public/Examples/Glyphs_GD.php @@ -14,7 +14,7 @@ error_reporting(E_ALL); // Set the content-type -header("Content-type: image/png"); +//header("Content-type: image/png"); // Create the image $im = @imagecreatefromgif('GD/bg.gif'); diff --git a/tests/Arabic/GlyphsTest.php b/tests/Arabic/GlyphsTest.php index deceac9..5ff628c 100644 --- a/tests/Arabic/GlyphsTest.php +++ b/tests/Arabic/GlyphsTest.php @@ -32,5 +32,37 @@ public function it_loads_glyphs_class() $this->assertInstanceOf(I18N_Arabic_Glyphs::class, $this->glyphs->myObject); } + /** @test */ + public function it_calculate_the_max_number_of_character_fit_in_one_A4_page() + { + $this->assertEquals(101, $this->glyphs->a4MaxChars(16)); + } + + /** @test */ + public function calculate_the_lines_number_of_given_Arabic_text_and_font_size_that_will_fit_in_A4_page_size() + { + $text = <<assertEquals(9, $this->glyphs->a4Lines($text, 14)); + } + + /** + * Need more work to test quality + * @test + */ + public function it_Convert_Arabic_Windows_1256_charset_string_into_glyph_joining_in_UTF8_hexadecimals_stream() + { + $text = 'بسم الله الرحمن الرحيم'; + $expectedText = 'ﻢﻴﺣﺮﻟﺍ ﻦﻤﺣﺮﻟﺍ ﻪﻠﻟﺍ ﻢﺴﺑ'; + $this->assertEquals($expectedText, $this->glyphs->utf8Glyphs($text)); + + $text = 'A text mixed مع حروف عربية وانجليزية ١٤٢٨ And number 1234'; + $expectedText = '1234 ًًًً ﺔﻳﺰﻴﻠﺠﻧﺍﻭ ﺔﻴﺑﺮﻋ ﻑﻭﺮﺣ ﻊﻣ A text mixed +And number'; + $this->assertEquals($expectedText, $this->glyphs->utf8Glyphs($text)); + } + }