source: branches/work_311/core/OpenWindowHelperTest.cpp @ 603

Revision 603, 2.2 KB checked in by jls17, 5 years ago (diff)
  • moved and renamed "doc/DocOpenWindowHelper.*" to "core/OpenWindowHelper.*"
Line 
1#include "ARInsideTest.h"
2#include "OpenWindowHelper.h"
3
4using namespace testing;
5
6char* testReportString = "Report: \00121=AR System\00122=\00129=\00127=\00128=null\00124=\00125=\00126=\00130=0\00131=\00132=true\001\nto-screen: ";
7
8// A fixture class with a instance of CDocActionOpenWindowHelper using the testReportString above
9class DocActionOpenWindowHelperTests : public Test
10{
11public:
12        DocActionOpenWindowHelperTests() : reportData(testReportString) {}
13
14protected:
15        CDocActionOpenWindowHelper reportData;
16};
17
18// verify the testReportString above is valid for the parser
19TEST_F(DocActionOpenWindowHelperTests, ValidInput)
20{
21        ASSERT_TRUE(reportData.IsValid());
22}
23
24// now just verify a few values we've in the report string
25TEST_F(DocActionOpenWindowHelperTests, VerifyReportType)
26{
27        string result = reportData.getReportType();
28        ASSERT_STREQ("AR System", result.c_str());
29}
30
31TEST_F(DocActionOpenWindowHelperTests, VerifyReportName)
32{
33        string result = reportData.getReportName();
34        ASSERT_STREQ("", result.c_str());
35}
36
37TEST_F(DocActionOpenWindowHelperTests, VerifyQueryOverride)
38{
39        string result = reportData.getQueryOverride();
40        ASSERT_STREQ("null", result.c_str());
41}
42
43TEST_F(DocActionOpenWindowHelperTests, VerifyReportDestination)
44{
45        string result = reportData.getReportDestination();
46        ASSERT_STREQ("to-screen: ", result.c_str());
47}
48
49TEST_F(DocActionOpenWindowHelperTests, VerifyInlineForm)
50{
51        string result = reportData.getInlineForm();
52        ASSERT_STREQ("true", result.c_str());
53}
54
55// even if the property (here "Report Name") is not in the (valid) report, it shouldn't fail
56TEST_F(DocActionOpenWindowHelperTests, TryToReadAValueNotInTheReportString)
57{
58        char* mostlyEmptyReport = "Report: \00121=AR System\001\nto-screen: ";
59        CDocActionOpenWindowHelper reportData(mostlyEmptyReport);
60
61        string result = reportData.getReportName();
62        ASSERT_STREQ("", result.c_str());
63}
64
65// if the report is simply invalid, it shouldn't fail as well
66TEST_F(DocActionOpenWindowHelperTests, TryToReadAValueFromInvalidReport)
67{
68        char* invalidReport = "WrongReport: \001";
69        CDocActionOpenWindowHelper reportData(invalidReport);
70
71        string result = reportData.getReportDestination();
72        ASSERT_STREQ("", result.c_str());
73}
Note: See TracBrowser for help on using the repository browser.