bug fixes to get pocket-infinity converted
This commit is contained in:
@@ -431,6 +431,50 @@ TEST_CASE( "r2x: a single PointLight entity can be converted", "[EntityConverter
|
||||
REQUIRE( converted[1] == "\"origin\" \"-216.00000 -1488.000488 -132.00000\"\n" );
|
||||
REQUIRE( converted[2] == "\"light\" \"75\"\n" );
|
||||
|
||||
INFO( converted[3] );
|
||||
std::istringstream iss(converted[3]);
|
||||
std::string attribute;
|
||||
std::string r;
|
||||
float red;
|
||||
float green;
|
||||
float blue;
|
||||
iss >> attribute >> r >> green >> blue;
|
||||
r.erase(r.begin()); //removing preceding quote is necessary
|
||||
std::stringstream redStream(r);
|
||||
redStream >> red;
|
||||
|
||||
REQUIRE( attribute == "\"_color\"" );
|
||||
|
||||
REQUIRE( fabs( 1.0 - red) <= DELTA );
|
||||
REQUIRE( fabs( 0.768627 - green) <= DELTA );
|
||||
REQUIRE( fabs( 0.0 - blue) <= DELTA );
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE( "r2x: PointLight defaults to white light of typical intensity", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
entity.push_back(" type PointLight");
|
||||
entity.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488");
|
||||
|
||||
// Mock up entity queue
|
||||
std::queue<std::vector<std::string>> q;
|
||||
q.push( entity );
|
||||
|
||||
// Match related entities (none)
|
||||
ec.extractMapInfo( q );
|
||||
|
||||
// Convert a single entity
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
|
||||
REQUIRE( converted[0] == "\"classname\" \"light\"\n" );
|
||||
REQUIRE( converted[1] == "\"origin\" \"-216.00000 -1488.000488 -132.00000\"\n" );
|
||||
REQUIRE( converted[2] == "\"light\" \"50\"\n" );
|
||||
|
||||
INFO( converted[3] );
|
||||
std::istringstream iss(converted[3]);
|
||||
std::string attribute;
|
||||
@@ -444,10 +488,11 @@ TEST_CASE( "r2x: a single PointLight entity can be converted", "[EntityConverter
|
||||
redStream >> red;
|
||||
|
||||
REQUIRE( attribute == "\"_color\"" );
|
||||
|
||||
REQUIRE( fabs(1.0 - red) <= DELTA );
|
||||
REQUIRE( fabs(0.768627 - green) <= DELTA );
|
||||
REQUIRE( fabs(0.0 - blue) <= DELTA );
|
||||
|
||||
REQUIRE( fabs( 0.0 - red) <= DELTA );
|
||||
REQUIRE( fabs( 0.0 - green) <= DELTA );
|
||||
REQUIRE( fabs( 0.0 - blue) <= DELTA );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -457,8 +502,5 @@ TEST_CASE( "r2x: a single PointLight entity can be converted", "[EntityConverter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif //CATCH_CONFIG_MAIN
|
||||
|
||||
|
Reference in New Issue
Block a user