mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-02 04:07:42 +08:00
msvc compatible changes got haltests
This commit is contained in:
parent
c6453a568f
commit
8f7575df82
@ -27,7 +27,6 @@
|
|||||||
#include<iostream>
|
#include<iostream>
|
||||||
#include<fstream>
|
#include<fstream>
|
||||||
#include<vector>
|
#include<vector>
|
||||||
//#include<cdlog.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
add_definitions(--include cdtypes.h)
|
|
||||||
add_definitions(--include cdlog.h)
|
|
||||||
find_package(GTEST)
|
find_package(GTEST)
|
||||||
if (BUILD_CDROID_TESTS AND GTEST_FOUND)
|
if (BUILD_CDROID_TESTS AND GTEST_FOUND)
|
||||||
add_subdirectory(gui)
|
add_subdirectory(gui)
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#if defined(__linux__)||defined(__unix__)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#elif defined(_WIN32)||defined(_WIN64)
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <dtvos.h>
|
#include <porting/dtvos.h>
|
||||||
|
|
||||||
class OSEVENT:public testing::Test{
|
class OSEVENT:public testing::Test{
|
||||||
public :
|
public :
|
||||||
|
@ -1,7 +1,30 @@
|
|||||||
#include<cdgraph.h>
|
#include<porting/cdgraph.h>
|
||||||
#include<cdlog.h>
|
#include<porting/cdlog.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
#if defined(__Linux__)||defined(__unix__)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#elif defined(_WIN32)||defined(_WIN64)
|
||||||
|
#include <Windows.h>
|
||||||
|
void usleep(unsigned int microseconds) {
|
||||||
|
LARGE_INTEGER frequency;
|
||||||
|
QueryPerformanceFrequency(&frequency);
|
||||||
|
LARGE_INTEGER start;
|
||||||
|
QueryPerformanceCounter(&start);
|
||||||
|
long long end = start.QuadPart + static_cast<long long>(microseconds) * frequency.QuadPart / 1000000;
|
||||||
|
|
||||||
|
do {
|
||||||
|
QueryPerformanceCounter(&start);
|
||||||
|
} while (start.QuadPart < end);
|
||||||
|
}
|
||||||
|
void sleep(unsigned int secs) {
|
||||||
|
usleep(secs * 1000000);
|
||||||
|
}
|
||||||
|
void gettimeofday(struct timeval* t1,struct timezone* zone) {
|
||||||
|
auto tt = GetTickCount64();
|
||||||
|
t1->tv_sec = tt%1000;
|
||||||
|
t1->tv_usec = (tt % 1000) * 1000;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define INVALID_COLOR 0x01010101
|
#define INVALID_COLOR 0x01010101
|
||||||
typedef struct{
|
typedef struct{
|
||||||
@ -148,7 +171,7 @@ TEST_F(GRAPH,CreateSurface_1){
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GRAPH,CreateSurface_2){
|
TEST_F(GRAPH,CreateSurface_2){
|
||||||
uint32_t width,height,pitch;
|
uint32_t width=0,height=0,pitch=0;
|
||||||
int fmts[]={GPF_ARGB4444,GPF_ARGB1555,GPF_ARGB,GPF_ABGR,GPF_RGB32};
|
int fmts[]={GPF_ARGB4444,GPF_ARGB1555,GPF_ARGB,GPF_ABGR,GPF_RGB32};
|
||||||
int bps[] ={ 2, 2 , 4 , 4 , 4 };
|
int bps[] ={ 2, 2 , 4 , 4 , 4 };
|
||||||
ASSERT_EQ(0,GFXGetDisplaySize(0,&width,&height));
|
ASSERT_EQ(0,GFXGetDisplaySize(0,&width,&height));
|
||||||
@ -192,7 +215,7 @@ TEST_F(GRAPH,Alpha){
|
|||||||
|
|
||||||
TEST_F(GRAPH,Colors){
|
TEST_F(GRAPH,Colors){
|
||||||
HANDLE surface=0;
|
HANDLE surface=0;
|
||||||
uint32_t width,height;
|
uint32_t width=0,height=0;
|
||||||
GFXRect r={0,0,0,0};
|
GFXRect r={0,0,0,0};
|
||||||
ASSERT_EQ(0,GFXGetDisplaySize(0,&width,&height));
|
ASSERT_EQ(0,GFXGetDisplaySize(0,&width,&height));
|
||||||
ASSERT_EQ(0,GFXCreateSurface(0,&surface,width,height,GPF_ARGB,1));
|
ASSERT_EQ(0,GFXCreateSurface(0,&surface,width,height,GPF_ARGB,1));
|
||||||
@ -212,7 +235,7 @@ TEST_F(GRAPH,Colors){
|
|||||||
|
|
||||||
TEST_F(GRAPH,Blit){
|
TEST_F(GRAPH,Blit){
|
||||||
HANDLE mainsurface=0,surface;
|
HANDLE mainsurface=0,surface;
|
||||||
uint32_t width,height;
|
uint32_t width=0,height=0;
|
||||||
GFXRect r={0,0,0,0};
|
GFXRect r={0,0,0,0};
|
||||||
ASSERT_EQ(0,GFXGetDisplaySize(0,&width,&height));
|
ASSERT_EQ(0,GFXGetDisplaySize(0,&width,&height));
|
||||||
ASSERT_EQ(0,GFXCreateSurface(0,&mainsurface,width,height,GPF_ARGB,1));
|
ASSERT_EQ(0,GFXCreateSurface(0,&mainsurface,width,height,GPF_ARGB,1));
|
||||||
@ -253,10 +276,10 @@ TEST_F(GRAPH,Multilayer){
|
|||||||
for(int i=0;i<4;i++){
|
for(int i=0;i<4;i++){
|
||||||
int sw,sh,fmt;
|
int sw,sh,fmt;
|
||||||
gettimeofday(&tv,NULL);
|
gettimeofday(&tv,NULL);
|
||||||
srandom(tv.tv_usec);
|
srand(tv.tv_usec);
|
||||||
if(layers[i]){
|
if(layers[i]){
|
||||||
int x=k-500+random()%width;
|
int x=k-500+rand()%width;
|
||||||
int y=k-500+random()%height;
|
int y=k-500+rand()%height;
|
||||||
GFXGetSurfaceInfo(layers[i],(uint32_t*)&sw,(uint32_t*)&sh,&fmt);
|
GFXGetSurfaceInfo(layers[i],(uint32_t*)&sw,(uint32_t*)&sh,&fmt);
|
||||||
if((x+sw>0) && (y+sh>0) && (x<(int)width) && (y<(int)height))
|
if((x+sw>0) && (y+sh>0) && (x<(int)width) && (y<(int)height))
|
||||||
ASSERT_EQ(0,GFXBlit(hwsurface,x,y,layers[i],NULL));
|
ASSERT_EQ(0,GFXBlit(hwsurface,x,y,layers[i],NULL));
|
||||||
@ -307,7 +330,7 @@ TEST_F(GRAPH,Benchmark_Fill){
|
|||||||
r.w=width;r.h=height;
|
r.w=width;r.h=height;
|
||||||
gettimeofday(&t1,NULL);
|
gettimeofday(&t1,NULL);
|
||||||
for(int i=0;i<TEST_TIMES;i++){
|
for(int i=0;i<TEST_TIMES;i++){
|
||||||
GFXFillRect(surface,&r,0xFF000000|(i<<8)|(i+i<<16));
|
GFXFillRect(surface,&r,0xFF000000|(i<<8)|((i+i)<<16));
|
||||||
}
|
}
|
||||||
gettimeofday(&t2,NULL);
|
gettimeofday(&t2,NULL);
|
||||||
int usedtime=(t2.tv_sec*1000+t2.tv_usec/1000-t1.tv_sec*1000+t1.tv_usec/1000);
|
int usedtime=(t2.tv_sec*1000+t2.tv_usec/1000-t1.tv_sec*1000+t1.tv_usec/1000);
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <cdinput.h>
|
#include <porting/cdinput.h>
|
||||||
|
#if defined(__linux__)||defined(__unix__)
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
|
#else
|
||||||
|
#include <core/eventcodes.h>
|
||||||
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
class INPUT:public testing::Test{
|
class INPUT:public testing::Test{
|
||||||
public :
|
public :
|
||||||
@ -27,7 +31,7 @@ TEST_F(INPUT,InjectEvent){
|
|||||||
INPUTEVENT e;
|
INPUTEVENT e;
|
||||||
INPUTEVENT e2;
|
INPUTEVENT e2;
|
||||||
e.type=EV_KEY;
|
e.type=EV_KEY;
|
||||||
e.code=KEY_ENTER;
|
e.code = 100;// KEY_ENTER;
|
||||||
e.device=INJECTDEV_KEY;
|
e.device=INJECTDEV_KEY;
|
||||||
ASSERT_EQ(1,InputInjectEvents(&e,1,0));
|
ASSERT_EQ(1,InputInjectEvents(&e,1,0));
|
||||||
ASSERT_EQ(1,InputGetEvents(&e2,1,1));
|
ASSERT_EQ(1,InputGetEvents(&e2,1,1));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <dtvos.h>
|
#include <porting/dtvos.h>
|
||||||
|
|
||||||
class OSMEM:public testing::Test{
|
class OSMEM:public testing::Test{
|
||||||
public :
|
public :
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#if defined(__linux__)||defined(__unix___)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#else
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
extern "C"{
|
extern "C"{
|
||||||
#include <dtvos.h>
|
#include <porting/dtvos.h>
|
||||||
#include <dtvmsgq.h>
|
#include <porting/dtvmsgq.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
class OSMSGQ:public testing::Test{
|
class OSMSGQ:public testing::Test{
|
||||||
@ -14,9 +18,13 @@ class OSMSGQ:public testing::Test{
|
|||||||
virtual void TearDown(){
|
virtual void TearDown(){
|
||||||
}
|
}
|
||||||
unsigned long long gettime(){
|
unsigned long long gettime(){
|
||||||
|
#if defined(__linux__)||defined(__unix__)
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv,NULL);
|
gettimeofday(&tv,NULL);
|
||||||
return tv.tv_sec*1000+tv.tv_usec/1000;
|
return tv.tv_sec*1000+tv.tv_usec/1000;
|
||||||
|
#elif defined(_WIN32)||defined(_WIN64)
|
||||||
|
return GetTickCount64();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
typedef struct{
|
typedef struct{
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#if defined(__linux__)||defined(__unix__)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
extern "C"{
|
extern "C"{
|
||||||
#include <dtvos.h>
|
#include <porting/dtvos.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
class OSMUTEX:public testing::Test{
|
class OSMUTEX:public testing::Test{
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#if defined(__linux__)||defined(__unix__)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#elif defined(_WIN32)||defined(_WIN64)
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <dtvos.h>
|
#include <porting/dtvos.h>
|
||||||
|
|
||||||
class OSSEM:public testing::Test{
|
class OSSEM:public testing::Test{
|
||||||
public :
|
public :
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <cdtypes.h>
|
#include <porting/cdtypes.h>
|
||||||
#include <cdlog.h>
|
#include <porting/cdlog.h>
|
||||||
#include <cdgraph.h>
|
#include <porting/cdgraph.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
class HALEnvironment: public testing::Environment{
|
class HALEnvironment: public testing::Environment{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <dtvtimer.h>
|
#include <porting/dtvtimer.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
class TIMER:public testing::Test{
|
class TIMER:public testing::Test{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef __DTV_UTILS_H__
|
#ifndef __DTV_UTILS_H__
|
||||||
#define __DTV_UTILS_H__
|
#define __DTV_UTILS_H__
|
||||||
#include <cdtypes.h>
|
#include <porting/cdtypes.h>
|
||||||
#include <ngl_tuner.h>
|
#include <ngl_tuner.h>
|
||||||
|
|
||||||
namespace tvutils{
|
namespace tvutils{
|
||||||
|
Loading…
Reference in New Issue
Block a user