$ctx1->draw_filled_rectangle_size(3, 3, 4, 3); $ctx1->set('color', $img->color_from_string('#969')); $ctx1->draw_rectangle(3, 3, 6, 7); $ctx1->draw_filled_rectangle_size(15, 2, 2, 2); $ctx1->draw_filled_rectangle_size(15, 2, -1, -1); $col = $img->color_from_string('#36c'); $ctx1->set('color', $col); $ctx1->draw_filled_rectangle(20, 2, 18, 3); assert('$ctx1->color_at(19, 2) == $col'); /* Blow up so we can count the pixels in the result */ $img->resize_relative(10, false); $img->flush_png(); $img->destroy(); } } $test = AnewtRequest::get_string('test'); if (is_null($test)) { /* Show test chooser */ anewt_include('page'); $p = new AnewtPage(); $p->set('title', 'Choose a test'); $p->append(ax_h1('Choose a test')); foreach (get_class_methods('AnewtImageTestCases') as $name) { $url = AnewtURL::build(AnewtRequest::relative_url(), array('test' => $name)); $p->append(ax_p(ax_a_href(sprintf('Test: %s', $name), $url))); } $p->flush(); } else { /* Invoke test function */ AnewtImageTestCases::$test(); }