Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <mitkAction.h>
00020 #include <mitkProperties.h>
00021
00022 #include <fstream>
00023 int mitkActionTest(int , char* [])
00024 {
00025 int actionId = 10;
00026
00027 mitk::Action::Pointer action = mitk::Action::New(actionId);
00028
00029
00030 std::cout << "check ActionId";
00031 if (action->GetActionId()!=actionId)
00032 {
00033 std::cout<<"[FAILED]"<<std::endl;
00034 return EXIT_FAILURE;
00035 }
00036 std::cout<<"[PASSED]"<<std::endl;
00037
00038
00039 action->AddProperty("boolproperty", mitk::BoolProperty::New(true));
00040 action->AddProperty("intproperty", mitk::IntProperty::New(10));
00041 action->AddProperty("floatproperty", mitk::FloatProperty::New(10.05));
00042
00043 std::cout << "try adding property BOOL and read them: ";
00044 bool boolproperty = false;
00045 boolproperty = dynamic_cast<mitk::BoolProperty *>(action->GetProperty("boolproperty"))->GetValue();
00046 if (boolproperty != true)
00047 {
00048 std::cout<<"[FAILED]"<<std::endl;
00049 return EXIT_FAILURE;
00050 }
00051 std::cout<<"[PASSED]"<<std::endl;
00052
00053 std::cout << "try adding property INT and read them: ";
00054 int intproperty = 0;
00055 intproperty = dynamic_cast<mitk::IntProperty *>(action->GetProperty("intproperty"))->GetValue();
00056 if (intproperty != 10)
00057 {
00058 std::cout<<"[FAILED]"<<std::endl;
00059 return EXIT_FAILURE;
00060 }
00061 std::cout<<"[PASSED]"<<std::endl;
00062
00063 std::cout << "try adding property FLOAT and read them: ";
00064 float floatproperty = 0.0;
00065 floatproperty = dynamic_cast<mitk::FloatProperty *>(action->GetProperty("floatproperty"))->GetValue();
00066 if (floatproperty != 10.05f)
00067 {
00068 std::cout<<"[FAILED]"<<std::endl;
00069 return EXIT_FAILURE;
00070 }
00071 std::cout<<"[PASSED]"<<std::endl;
00072
00073
00074
00075
00076
00077 std::cout<<"[EVERYTHING PASSED]"<<std::endl;
00078
00079 std::cout<<"[TEST DONE]"<<std::endl;
00080 return EXIT_SUCCESS;
00081 }