more tests and fixes

This commit is contained in:
Shish 2009-07-19 17:39:07 +01:00
parent 8875422bed
commit f574d0d81d
3 changed files with 14 additions and 2 deletions

View File

@ -7,7 +7,14 @@ class BulkAddTest extends ShimmieWebTestCase {
$this->assertTitle("Admin Tools");
$this->setField('dir', "contrib/simpletest");
$this->click("Add");
$this->delete_image($image_id);
$this->get_page("post/list/hash=17fc89f372ed3636e28bd25cc7f3bac1/1");
$this->assertTitle(new PatternExpectation("/^Image \d+: data/"));
$this->click("Delete");
$this->get_page("post/list/hash=feb01bab5698a11dd87416724c7a89e3/1");
$this->assertTitle(new PatternExpectation("/^Image \d+: data/"));
$this->click("Delete");
$this->log_out();
}

View File

@ -124,7 +124,7 @@ class Index extends SimpleExtension {
$event->add_querylet(new Querylet("images.$col $cmp ?", array($val)));
}
else if(preg_match("/^hash=([0-9a-fA-F]*)$/i", $event->term, $matches)) {
$hash = strtolower($matches[2]);
$hash = strtolower($matches[1]);
$event->add_querylet(new Querylet("images.hash = '$hash'"));
}
else if(preg_match("/^(filetype|ext)=([a-zA-Z0-9]*)$/i", $event->term, $matches)) {

View File

@ -55,6 +55,11 @@ class IndexTest extends ShimmieWebTestCase {
$this->assertTitle("size=640x480");
$this->assertNoText("No Images Found");
# meta tag, one result
$this->get_page("post/list/hash=feb01bab5698a11dd87416724c7a89e3/1");
$this->assertTitle(new PatternExpectation("/^Image $image_id_2: /"));
$this->assertNoText("No Images Found");
# multiple tags, many results
$this->get_page('post/list/computer%20size=640x480/1');
$this->assertTitle("computer size=640x480");