2 * @file LeftAndRightNonRecursive.cpp
\r
4 * @brief Implementation for LeftAndRightNonRecursive testcase.
\r
8 #include <gtest/gtest.h>
\r
9 #include "UnicodeString.h"
\r
10 #include "ProjectFile.h"
\r
12 /** @brief Projectfile to load. */
\r
13 static const TCHAR FileName[] = _T("..\\TestData\\LeftAndRightNonRecursive.WinMerge");
\r
14 /** @brief Left path we should get from file. */
\r
15 static const TCHAR LeftPath[] = _T("C:\\Temp\\Left");
\r
16 /** @brief Right path we should get from file. */
\r
17 static const TCHAR RightPath[] = _T("C:\\Temp\\Right");
\r
22 class LeftAndRightNonRecursiveTest : public testing::Test
\r
25 LeftAndRightNonRecursiveTest() : m_pProjectFile(nullptr)
\r
27 // You can do set-up work for each test here.
\r
30 virtual ~LeftAndRightNonRecursiveTest()
\r
32 // You can do clean-up work that doesn't throw exceptions here.
\r
35 // If the constructor and destructor are not enough for setting up
\r
36 // and cleaning up each test, you can define the following methods:
\r
38 virtual void SetUp()
\r
40 // Code here will be called immediately after the constructor (right
\r
41 // before each test).
\r
43 m_pProjectFile = new ProjectFile;
\r
45 bool success = m_pProjectFile->Read(FileName);
\r
48 virtual void TearDown()
\r
50 // Code here will be called immediately after each test (right
\r
51 // before the destructor).
\r
52 delete m_pProjectFile;
\r
55 // Objects declared here can be used by all tests in the test case for Foo.
\r
56 ProjectFile *m_pProjectFile;
\r
60 * @brief Load the projectfile.
\r
62 TEST_F(LeftAndRightNonRecursiveTest, Load)
\r
64 // setUp already created the project file for us, but this
\r
65 // test is for testing creation and loading..
\r
67 delete m_pProjectFile;
\r
68 m_pProjectFile = new ProjectFile;
\r
69 ASSERT_TRUE(m_pProjectFile != NULL);
\r
71 bool success = m_pProjectFile->Read(FileName);
\r
74 ASSERT_TRUE(success == true);
\r
78 * @brief Read left path different ways.
\r
80 TEST_F(LeftAndRightNonRecursiveTest, GetLeftPath)
\r
83 bool bIsLeft = m_pProjectFile->HasLeft();
\r
84 ASSERT_TRUE(bIsLeft == true);
\r
86 // Get left path without read-only info
\r
87 String left = m_pProjectFile->GetLeft();
\r
88 ASSERT_TRUE(left.compare(LeftPath) == 0);
\r
90 // Get left path with read-only info
\r
92 left = m_pProjectFile->GetLeft(&bReadOnly);
\r
93 ASSERT_TRUE(left.compare(LeftPath) == 0);
\r
94 ASSERT_TRUE(bReadOnly == false);
\r
98 * @brief Read right path different ways.
\r
100 TEST_F(LeftAndRightNonRecursiveTest, GetRightPath)
\r
103 bool bIsRight = m_pProjectFile->HasRight();
\r
104 ASSERT_TRUE(bIsRight == true);
\r
106 // Get right path without read-only info
\r
107 String right = m_pProjectFile->GetRight();
\r
108 ASSERT_TRUE(right.compare(RightPath) == 0);
\r
110 // Get right path with read-only info
\r
112 right = m_pProjectFile->GetRight(&bReadOnly);
\r
113 ASSERT_TRUE(right.compare(RightPath) == 0);
\r
114 ASSERT_TRUE(bReadOnly == false);
\r
118 * @brief Make sure subfolder inclusion is get and disabled.
\r
120 TEST_F(LeftAndRightNonRecursiveTest, GetSubfolders)
\r
122 // Now we have subfolders
\r
123 bool bHasSubfolders = m_pProjectFile->HasSubfolders();
\r
124 ASSERT_TRUE(bHasSubfolders == true);
\r
126 // But the setting says we don't want recursive compare
\r
127 int subfolders = m_pProjectFile->GetSubfolders();
\r
128 ASSERT_TRUE(subfolders == 0);
\r
132 * @brief Make sure filter is not get.
\r
134 TEST_F(LeftAndRightNonRecursiveTest, GetFilter)
\r
136 // We don't have a filter
\r
137 bool bHasFilter = m_pProjectFile->HasFilter();
\r
138 ASSERT_TRUE(bHasFilter == false);
\r
140 String filter = m_pProjectFile->GetFilter();
\r
141 ASSERT_TRUE(filter.empty());
\r