| 16 | #include <vtkProperty.h> |
| 17 | |
| 18 | int mitkEnumerationPropertyTest(int /*argc*/, char * /*argv*/ []) |
| 19 | { |
| 20 | mitk::EnumerationProperty::Pointer enumerationProperty(mitk::EnumerationProperty::New()); |
| 21 | |
| 22 | std::cout << "Testing mitk::EnumerationProperty::AddEnum(...): "; |
| 23 | bool success = true; |
| 24 | success = success && enumerationProperty->AddEnum("first", 1); |
| 25 | success = success && enumerationProperty->AddEnum("second", 2); |
| 26 | success = success && enumerationProperty->AddEnum("third", 3); |
| 27 | if (!success) |
| 28 | { |
| 29 | std::cout << "[FAILED]" << std::endl; |
| 30 | return EXIT_FAILURE; |
| 31 | } |
| 32 | else |
| 33 | { |
| 34 | std::cout << "[PASSED]" << std::endl; |
| 35 | } |
| 36 | |
| 37 | std::cout << "Testing mitk::EnumerationProperty::Size(): "; |
| 38 | if (enumerationProperty->Size() != 3) |
| 39 | { |
| 40 | std::cout << "[FAILED]" << std::endl; |
| 41 | return EXIT_FAILURE; |
| 42 | } |
| 43 | else |
| 44 | { |
| 45 | std::cout << "[PASSED]" << std::endl; |
| 46 | } |
| 47 | |
| 48 | std::cout << "Testing mitk::EnumerationProperty::AddEnum() with invalid entries: "; |
| 49 | if (enumerationProperty->AddEnum("first", 0)) |
| 50 | { |
| 51 | std::cout << "[FAILED]" << std::endl; |
| 52 | return EXIT_FAILURE; |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | std::cout << "[PASSED]" << std::endl; |
| 57 | } |
| 58 | |
| 59 | std::cout << "Testing mitk::EnumerationProperty::SetValue(id): "; |
| 60 | if (!enumerationProperty->SetValue(2)) |
| 61 | { |
| 62 | std::cout << "[FAILED]" << std::endl; |
| 63 | return EXIT_FAILURE; |
| 64 | } |
| 65 | if (enumerationProperty->GetValueAsId() != 2) |
| 66 | { |
| 67 | std::cout << "[FAILED]" << std::endl; |
| 68 | return EXIT_FAILURE; |
| 69 | } |
| 70 | if (enumerationProperty->GetValueAsString() != "second") |
| 71 | { |
| 72 | std::cout << "[FAILED]" << std::endl; |
| 73 | return EXIT_FAILURE; |
| 74 | } |
| 75 | std::cout << "[PASSED]" << std::endl; |
nothing calls this directly
no test coverage detected