[TEST] added a simple Wt test

This commit is contained in:
emeric
2015-09-27 20:49:59 +02:00
parent 1a0b12e223
commit c21dfe6880
+49
View File
@@ -0,0 +1,49 @@
#include <Wt/WServer>
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WText>
class TestApplication : public Wt::WApplication
{
public:
TestApplication(const Wt::WEnvironment& env)
: Wt::WApplication(env)
{
root()->addWidget(new Wt::WText("Hello, world!"));
}
};
static Wt::WApplication *createTestApplication(const Wt::WEnvironment& env)
{
return new TestApplication(env);
}
int main(int argc, char *argv[])
{
try
{
Wt::WServer server(argv[0]);
server.setServerConfiguration (argc, argv);
server.addEntryPoint(Wt::Application, createTestApplication);
server.start();
Wt::WServer::waitForShutdown(argv[0]);
server.stop();
return EXIT_SUCCESS;
}
catch (std::exception& e)
{
std::cerr << "Caught exception: " << e.what();
return EXIT_FAILURE;
}
}