image.lib.test.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. require_once api_get_path(LIBRARY_PATH).'image.lib.php';
  3. class TestImage extends UnitTestCase {
  4. public $timage;
  5. public function TestImage(){
  6. $this->UnitTestCase('All main image function tests');
  7. }
  8. public function setUp(){
  9. $this->timage = new Image();
  10. }
  11. public function tearDown(){
  12. $this->timage = null;
  13. }
  14. /*public function testAddBackGround() {
  15. $bgfile='';
  16. $res = image::addbackground($bgfile);
  17. $this->assertTrue(is_null($res));
  18. //var_dump($bgfile);
  19. }
  20. public function testAddLogo() {
  21. $file='';
  22. $res = image::addlogo($file);
  23. $this->assertTrue(is_null($res));
  24. //var_dump($res);
  25. }
  26. public function testaddtext() {
  27. $text='';
  28. $res = image::addtext($text);
  29. $this->assertTrue(is_null($res));
  30. //var_dump($res);
  31. }
  32. public function testcreateimagefromtype() {
  33. $file='';
  34. $handler='';
  35. $res = image::createimagefromtype($file,$handler);
  36. $this->assertTrue(is_null($res));
  37. //var_dump($res);
  38. }
  39. public function testimageaddback() {
  40. $bgfile='';
  41. $res = image::image($bgfile);
  42. $this->assertTrue(is_null($res));
  43. //var_dump($res);
  44. }
  45. public function testmakecolor() {
  46. $red='';
  47. $green='';
  48. $blue='';
  49. $res = image::makecolor($red, $green, $blue);
  50. $this->assertTrue(is_null($res));
  51. //var_dump($res);
  52. }
  53. public function testmergelogo() {
  54. $x='';
  55. $y='';
  56. $res = image::mergelogo($x,$y);
  57. $this->assertTrue(is_bool($res));
  58. //var_dump($res);
  59. }*/
  60. public function testresize() {
  61. $thumbw='';
  62. $thumbh='';
  63. $border='';
  64. $res = image::resize($thumbw , $thumbh , $border);
  65. $this->assertTrue(is_null($res));
  66. //var_dump($res);
  67. }
  68. public function testsend_image() {
  69. $type='';
  70. $res = image::send_image($type);
  71. $this->assertTrue(is_numeric($res));
  72. //var_dump($res);
  73. }
  74. /*
  75. public function testsetfont() {
  76. $fontfile=$this->fontfile;
  77. $res = image::setfont($fontfile);
  78. $this->assertTrue(is_null($res));
  79. //var_dump($res);
  80. }*/
  81. /*
  82. public function TestDeleteCourse(){
  83. $code = 'COURSETEST';
  84. $res = CourseManager::delete_course($code);
  85. $path = api_get_path(SYS_PATH).'archive';
  86. if ($handle = opendir($path)) {
  87. while (false !== ($file = readdir($handle))) {
  88. if (strpos($file,$code)!==false) {
  89. if (is_dir($path.'/'.$file)) {
  90. rmdirr($path.'/'.$file);
  91. }
  92. }
  93. }
  94. closedir($handle);
  95. }
  96. }
  97. */
  98. }