mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-11 04:15:37 +08:00
41 lines
870 B
C++
Executable File
41 lines
870 B
C++
Executable File
#include <gtest/gtest.h>
|
|
#include <cdroid.h>
|
|
#include <ngl_os.h>
|
|
|
|
using namespace cdroid;
|
|
|
|
class RECTTEST:public testing::Test{
|
|
|
|
public :
|
|
virtual void SetUp(){
|
|
}
|
|
virtual void TearDown(){
|
|
}
|
|
};
|
|
|
|
|
|
TEST_F(RECTTEST,intersect){
|
|
RECT rc1={0,0,100,100};
|
|
RECT rc2={-40,-50,100,100};
|
|
rc2.intersect(rc1);
|
|
printf("%d,%d %d,%d\r\n",rc2.left,rc2.top,rc2.width,rc2.height);
|
|
ASSERT_EQ(rc2.left,0);
|
|
ASSERT_EQ(rc2.top,0);
|
|
ASSERT_EQ(rc2.width,60);
|
|
ASSERT_EQ(rc2.height,50);
|
|
|
|
}
|
|
TEST_F(RECTTEST,intersect2){
|
|
RECT rc1={0,0,100,100};
|
|
RECT rc2={-40,-40,100,100};
|
|
rc1.intersect(rc2);
|
|
printf("%d,%d %d,%d\r\n",rc1.left,rc1.top,rc1.width,rc1.height);
|
|
}
|
|
|
|
TEST_F(RECTTEST,Union){
|
|
RECT rc1={-83,-83,566,566};
|
|
RECT rc2={0,0,800,600};
|
|
rc1.Union(rc2);
|
|
printf("%d,%d %d,%d\r\n",rc1.left,rc1.top,rc1.width,rc1.height);
|
|
}
|