1 /// Unit tests for reference counting and smart pointer classes
2 #define BOOST_TEST_MODULE structure
3 #include <BoostTestTargetConfig.h>
5 #include "MouseEvent.hxx"
6 #include "CustomEvent.hxx"
8 namespace sc = simgear::canvas;
10 BOOST_AUTO_TEST_CASE( canvas_event_types )
13 BOOST_REQUIRE_EQUAL( sc::Event::strToType("test"),
15 BOOST_REQUIRE_EQUAL( sc::Event::getOrRegisterType("test"),
16 sc::Event::CUSTOM_EVENT );
17 BOOST_REQUIRE_EQUAL( sc::Event::strToType("test"),
18 sc::Event::CUSTOM_EVENT );
19 BOOST_REQUIRE_EQUAL( sc::Event::typeToStr(sc::Event::CUSTOM_EVENT),
22 // Basic internal type
23 BOOST_REQUIRE_EQUAL( sc::Event::typeToStr(sc::Event::MOUSE_DOWN),
25 BOOST_REQUIRE_EQUAL( sc::Event::strToType("mousedown"),
26 sc::Event::MOUSE_DOWN );
29 BOOST_REQUIRE_EQUAL( sc::Event::typeToStr(123),
32 // Register type through custom event instance
33 sc::CustomEvent e("blub");
34 BOOST_REQUIRE_EQUAL( e.getTypeString(), "blub" );
35 BOOST_REQUIRE_NE( e.getType(), sc::Event::UNKNOWN );