int main(int argc, char *argv[]) { QApplication app(argc, argv); TestForm form; form.show(); return app.exec(); }
void TestFormController::onSubmit(void* vform,HttpResponse* res) { TestForm* form = (TestForm*)vform; res->setHTTPResponseStatus(HTTPResponseStatus::Ok); res->addHeaderValue(HttpResponse::ContentType, ContentTypes::CONTENT_TYPE_TEXT_PLAIN); res->setContent(form->getTxt()+form->getChe()); std::cout << form->getTxt()+form->getChe() << "inside TestFormController" << std::endl; }
void TestFormController::onSubmit(void* vform,HttpResponse* res) { TestForm* form = (TestForm*)vform; res->setHTTPResponseStatus(HTTPResponseStatus::Ok); res->setContent_type(ContentTypes::CONTENT_TYPE_TEXT_PLAIN); res->setContent_str(form->getTxt()+form->getChe()); cout << form->getTxt()+form->getChe() << "inside TestFormController" << endl; }
void invalidNumber(){ TestForm form; std::map<std::string, const char*> params; params["number"] = "9"; form.setParams(params); form.registerValidators(); form.setScenario("default"); form.validate(); CPPUNIT_ASSERT(form.hasError() == true); }