Skip to content

Commit 51bff1c

Browse files
unusualinsightspestophagous
authored andcommitted
Change TEST to TEST_F in navigation_test.cc
Put a test fixture and TEST_F() tests based on that fixture instead of just a TEST() in navigation_test.cc.
1 parent d3ce472 commit 51bff1c

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

src/lib_app/navigation_test.cc

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,49 @@
77
//
88
#include "gtest/gtest.h"
99

10-
TEST( NavigationTest, FirstDemo )
10+
#include <QString>
11+
12+
namespace
13+
{
14+
class NavigationTest : public ::testing::Test
15+
{
16+
protected:
17+
NavigationTest()
18+
: m_name( "Fake Dialog" ), m_got_focus( false )
19+
{
20+
}
21+
22+
void GetFocus()
23+
{
24+
m_got_focus = true;
25+
}
26+
void LoseFocus()
27+
{
28+
m_got_focus = false;
29+
}
30+
31+
const QString m_name;
32+
33+
bool m_got_focus;
34+
};
35+
36+
TEST_F( NavigationTest, NameIsFakeDialog )
1137
{
12-
EXPECT_EQ( 2, 2 );
38+
EXPECT_EQ( m_name, QString( "Fake Dialog" ) );
1339
}
40+
41+
TEST_F( NavigationTest, InitiallyLacksFocus )
42+
{
43+
EXPECT_EQ( m_got_focus, false );
44+
}
45+
46+
TEST_F( NavigationTest, GotFocus )
47+
{
48+
GetFocus();
49+
EXPECT_EQ( m_got_focus, true );
50+
51+
LoseFocus();
52+
EXPECT_EQ( m_got_focus, false );
53+
}
54+
55+
} // namespace

0 commit comments

Comments
 (0)