forked from pxscene/pxCore2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pxPixel.h code coverage (pxscene#805)
* pxPixel.h code coverage * Fixed mac compilation error
- Loading branch information
1 parent
1b6a966
commit 0e6d4b0
Showing
2 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "pxCore.h" | ||
#include "pxPixel.h" | ||
#include "test_includes.h" // Needs to be included last | ||
|
||
using namespace std; | ||
|
||
class pxPixelTest : public testing::Test | ||
{ | ||
public: | ||
virtual void SetUp() | ||
{ | ||
} | ||
|
||
virtual void TearDown() | ||
{ | ||
} | ||
void pxPixelParam0() | ||
{ | ||
pxPixel p = pxPixel(); | ||
EXPECT_TRUE(sizeof(p) == sizeof(pxPixel)); | ||
} | ||
void pxPixelParam1() | ||
{ | ||
uint32_t u = 1; | ||
pxPixel p = pxPixel(u); | ||
EXPECT_TRUE(1 == p.u); | ||
} | ||
void pxPixelParam1Struct() | ||
{ | ||
uint32_t u = 2; | ||
pxPixel p = pxPixel(u); | ||
EXPECT_TRUE(2 == p.u); | ||
p = pxPixel((const pxPixel&)p); | ||
} | ||
void pxPixelParam4() | ||
{ | ||
uint32_t r= 1; | ||
uint32_t g= 1; | ||
uint32_t b= 1; | ||
uint32_t a= 1; | ||
pxPixel p = pxPixel(r, g, b, a); | ||
EXPECT_TRUE(1 == p.r); | ||
EXPECT_TRUE(1 == p.g); | ||
EXPECT_TRUE(1 == p.b); | ||
EXPECT_TRUE(1 == p.a); | ||
|
||
p = pxPixel(r, g, b); | ||
EXPECT_TRUE(1 == p.r); | ||
EXPECT_TRUE(1 == p.g); | ||
EXPECT_TRUE(1 == p.b); | ||
EXPECT_TRUE(255 == p.a); | ||
} | ||
}; | ||
TEST_F(pxPixelTest, pxPixelCompleteTest) | ||
{ | ||
pxPixelParam0(); | ||
pxPixelParam1(); | ||
pxPixelParam1Struct(); | ||
pxPixelParam4(); | ||
} |