[fdo-commits] r2562 - trunk/Providers/GDAL/Src/UnitTest
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Tue Feb 20 14:11:35 EST 2007
Author: warmerdam
Date: 2007-02-20 14:11:35 -0500 (Tue, 20 Feb 2007)
New Revision: 2562
Modified:
trunk/Providers/GDAL/Src/UnitTest/RfpTestBandConfig.cpp
trunk/Providers/GDAL/Src/UnitTest/RfpTestJpg.cpp
trunk/Providers/GDAL/Src/UnitTest/RfpTestPng.cpp
Log:
reformat code - no meaningful changes
Modified: trunk/Providers/GDAL/Src/UnitTest/RfpTestBandConfig.cpp
===================================================================
--- trunk/Providers/GDAL/Src/UnitTest/RfpTestBandConfig.cpp 2007-02-20 19:03:02 UTC (rev 2561)
+++ trunk/Providers/GDAL/Src/UnitTest/RfpTestBandConfig.cpp 2007-02-20 19:11:35 UTC (rev 2562)
@@ -199,22 +199,22 @@
// --------------------------------------------------------------
void RfpTestBandConfig::testNoGeoReference()
{
- FdoPtr<FdoIConnection> connection = CreateConnection();
- FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/band_no_geo.xml", L"r");
- connection->SetConfiguration(stream);
- // it must fail for there is no geo-reference associated with the raster image
- bool bError = false;
- try
- {
- connection->Open();
- }
- catch(...)
- {
- bError = true;
- connection->Close();
- }
+ FdoPtr<FdoIConnection> connection = CreateConnection();
+ FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/band_no_geo.xml", L"r");
+ connection->SetConfiguration(stream);
+ // it must fail for there is no geo-reference associated with the raster image
+ bool bError = false;
+ try
+ {
+ connection->Open();
+ }
+ catch(...)
+ {
+ bError = true;
+ connection->Close();
+ }
- CPPUNIT_ASSERT(bError == true);
+ CPPUNIT_ASSERT(bError == true);
}
// --------------------------------------------------------------
@@ -223,38 +223,38 @@
// --------------------------------------------------------------
void RfpTestBandConfig::testMixDataModel1()
{
- // currently it's hard to find two rasters with DEM and RGBA data model while they have the same coordinate system.
- // it is commented out considering the coordinate system
+ // currently it's hard to find two rasters with DEM and RGBA data model while they have the same coordinate system.
+ // it is commented out considering the coordinate system
#ifdef _WIN32
- //FdoPtr<FdoIConnection> connection = CreateConnection();
- //FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/mix_datamodel.xml", L"r");
- //connection->SetConfiguration(stream);
- //connection->Open();
+ //FdoPtr<FdoIConnection> connection = CreateConnection();
+ //FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/mix_datamodel.xml", L"r");
+ //connection->SetConfiguration(stream);
+ //connection->Open();
- //FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
- //FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
- //cmdSelect->SetFeatureClassName(L"Photo");
- //FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
+ //FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
+ //FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
+ //cmdSelect->SetFeatureClassName(L"Photo");
+ //FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
- //// the first feature is a jpg file
- //CPPUNIT_ASSERT(featureReader->ReadNext());
+ //// the first feature is a jpg file
+ //CPPUNIT_ASSERT(featureReader->ReadNext());
- //FdoPtr<FdoIRaster> raster = featureReader->GetRaster(L"Image");
- // FdoInt32 xSize = raster->GetImageXSize();
- // FdoInt32 ySize = raster->GetImageYSize();
- //CPPUNIT_ASSERT(xSize == 800);
- //CPPUNIT_ASSERT(ySize == 600);
+ //FdoPtr<FdoIRaster> raster = featureReader->GetRaster(L"Image");
+ // FdoInt32 xSize = raster->GetImageXSize();
+ // FdoInt32 ySize = raster->GetImageYSize();
+ //CPPUNIT_ASSERT(xSize == 800);
+ //CPPUNIT_ASSERT(ySize == 600);
- //// the first feature is a dem file
- //CPPUNIT_ASSERT(featureReader->ReadNext());
+ //// the first feature is a dem file
+ //CPPUNIT_ASSERT(featureReader->ReadNext());
- //raster = featureReader->GetRaster(L"Image");
- // xSize = raster->GetImageXSize();
- // ySize = raster->GetImageYSize();
- //CPPUNIT_ASSERT(xSize == 337);
- //CPPUNIT_ASSERT(ySize == 467);
+ //raster = featureReader->GetRaster(L"Image");
+ // xSize = raster->GetImageXSize();
+ // ySize = raster->GetImageYSize();
+ //CPPUNIT_ASSERT(xSize == 337);
+ //CPPUNIT_ASSERT(ySize == 467);
- //connection->Close();
+ //connection->Close();
#endif
}
@@ -317,62 +317,62 @@
//
void RfpTestBandConfig::testGetNullValue1()
{
- FdoPtr<FdoIConnection> connection = CreateConnection();
- FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/getnullvalue1.xml", L"r");
- connection->SetConfiguration(stream);
- connection->Open();
+ FdoPtr<FdoIConnection> connection = CreateConnection();
+ FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/getnullvalue1.xml", L"r");
+ connection->SetConfiguration(stream);
+ connection->Open();
- FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
+ FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
// for static_cast info see http://trac.osgeo.org/fdo/ticket/12#comment:2
#ifndef WIN32
- FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
#else
- FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
#endif
- cmdSelect->SetFeatureClassName(L"Photo");
- FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
+ cmdSelect->SetFeatureClassName(L"Photo");
+ FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
- // the first feature is a jpg file
- CPPUNIT_ASSERT(featureReader->ReadNext());
+ // the first feature is a jpg file
+ CPPUNIT_ASSERT(featureReader->ReadNext());
- FdoPtr<FdoIRaster> raster = featureReader->GetRaster(L"Image");
- FdoDataValue* nullVal = raster->GetNullPixelValue();
- FdoPtr<FdoInt32Value> val = static_cast<FdoInt32Value*>(nullVal);
+ FdoPtr<FdoIRaster> raster = featureReader->GetRaster(L"Image");
+ FdoDataValue* nullVal = raster->GetNullPixelValue();
+ FdoPtr<FdoInt32Value> val = static_cast<FdoInt32Value*>(nullVal);
- CPPUNIT_ASSERT(nullVal == NULL);
+ CPPUNIT_ASSERT(nullVal == NULL);
- connection->Close();
+ connection->Close();
}
//
void RfpTestBandConfig::testGetNullValue2()
{
- FdoPtr<FdoIConnection> connection = CreateConnection();
- FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/getnullvalue2.xml", L"r");
- connection->SetConfiguration(stream);
- connection->Open();
+ FdoPtr<FdoIConnection> connection = CreateConnection();
+ FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/getnullvalue2.xml", L"r");
+ connection->SetConfiguration(stream);
+ connection->Open();
- FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
+ FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
#ifndef WIN32
- FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
#else
- FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
#endif
- cmdSelect->SetFeatureClassName(L"Photo");
- FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
+ cmdSelect->SetFeatureClassName(L"Photo");
+ FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
- // the first feature is a dem file
- CPPUNIT_ASSERT(featureReader->ReadNext());
+ // the first feature is a dem file
+ CPPUNIT_ASSERT(featureReader->ReadNext());
- FdoPtr<FdoIRaster> raster = featureReader->GetRaster(L"Image");
- FdoDataValue* nullVal = raster->GetNullPixelValue();
- FdoPtr<FdoInt16Value> val = static_cast<FdoInt16Value*>(nullVal);
+ FdoPtr<FdoIRaster> raster = featureReader->GetRaster(L"Image");
+ FdoDataValue* nullVal = raster->GetNullPixelValue();
+ FdoPtr<FdoInt16Value> val = static_cast<FdoInt16Value*>(nullVal);
- CPPUNIT_ASSERT(nullVal->GetDataType() == FdoDataType_Int16);
- CPPUNIT_ASSERT(val->GetInt16() == -32767);
+ CPPUNIT_ASSERT(nullVal->GetDataType() == FdoDataType_Int16);
+ CPPUNIT_ASSERT(val->GetInt16() == -32767);
- connection->Close();
+ connection->Close();
}
// --------------------------------------------------------------
@@ -381,150 +381,150 @@
// --------------------------------------------------------------
void RfpTestBandConfig::testResolution()
{
- FdoPtr<FdoIConnection> connection = CreateConnection();
- FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/geo_resolution_rot.xml", L"r");
- connection->SetConfiguration(stream);
- connection->Open();
+ FdoPtr<FdoIConnection> connection = CreateConnection();
+ FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/geo_resolution_rot.xml", L"r");
+ connection->SetConfiguration(stream);
+ connection->Open();
- FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
+ FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
#ifndef WIN32
- FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
#else
- FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
#endif
- cmdSelect->SetFeatureClassName(L"Photo");
- FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
+ cmdSelect->SetFeatureClassName(L"Photo");
+ FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
- // feature "photo11_1", rotation = 0, resolution = 1;
- CPPUNIT_ASSERT(featureReader->ReadNext());
+ // feature "photo11_1", rotation = 0, resolution = 1;
+ CPPUNIT_ASSERT(featureReader->ReadNext());
- FdoPtr<FdoIRaster> raster = featureReader->GetRaster(L"Image");
- CPPUNIT_ASSERT(raster->GetImageXSize() == 800);
- CPPUNIT_ASSERT(raster->GetImageYSize() == 600);
+ FdoPtr<FdoIRaster> raster = featureReader->GetRaster(L"Image");
+ CPPUNIT_ASSERT(raster->GetImageXSize() == 800);
+ CPPUNIT_ASSERT(raster->GetImageYSize() == 600);
FdoPtr<FdoFgfGeometryFactory> geomFactory = FdoFgfGeometryFactory::GetInstance();
FdoPtr<FdoByteArray> ba = raster->GetBounds();
FdoPtr<FdoIGeometry> geometery = geomFactory->CreateGeometryFromFgf(ba);
FdoPtr<FdoIEnvelope> bounds = geometery->GetEnvelope();
- CPPUNIT_ASSERT(fabs(bounds->GetMinX() - 100000.000000) < 0.001);
- CPPUNIT_ASSERT(fabs(bounds->GetMinY() - 100000.000000) < 0.001);
- CPPUNIT_ASSERT(fabs(bounds->GetMaxX() - 100800.000000) < 0.001);
- CPPUNIT_ASSERT(fabs(bounds->GetMaxY() - 100600.000000) < 0.001);
+ CPPUNIT_ASSERT(fabs(bounds->GetMinX() - 100000.000000) < 0.001);
+ CPPUNIT_ASSERT(fabs(bounds->GetMinY() - 100000.000000) < 0.001);
+ CPPUNIT_ASSERT(fabs(bounds->GetMaxX() - 100800.000000) < 0.001);
+ CPPUNIT_ASSERT(fabs(bounds->GetMaxY() - 100600.000000) < 0.001);
- // feature "photo11_2", rotation = 0, resolution = 2;
- CPPUNIT_ASSERT(featureReader->ReadNext());
+ // feature "photo11_2", rotation = 0, resolution = 2;
+ CPPUNIT_ASSERT(featureReader->ReadNext());
- raster = featureReader->GetRaster(L"Image");
- CPPUNIT_ASSERT(raster->GetImageXSize() == 800);
- CPPUNIT_ASSERT(raster->GetImageYSize() == 600);
+ raster = featureReader->GetRaster(L"Image");
+ CPPUNIT_ASSERT(raster->GetImageXSize() == 800);
+ CPPUNIT_ASSERT(raster->GetImageYSize() == 600);
ba = raster->GetBounds();
geometery = geomFactory->CreateGeometryFromFgf(ba);
bounds = geometery->GetEnvelope();
- CPPUNIT_ASSERT(fabs(bounds->GetMinX() - 100000.000000) < 0.001);
- CPPUNIT_ASSERT(fabs(bounds->GetMinY() - 100000.000000) < 0.001);
- CPPUNIT_ASSERT(fabs(bounds->GetMaxX() - 101600.000000) < 0.001);
- CPPUNIT_ASSERT(fabs(bounds->GetMaxY() - 101200.000000) < 0.001);
+ CPPUNIT_ASSERT(fabs(bounds->GetMinX() - 100000.000000) < 0.001);
+ CPPUNIT_ASSERT(fabs(bounds->GetMinY() - 100000.000000) < 0.001);
+ CPPUNIT_ASSERT(fabs(bounds->GetMaxX() - 101600.000000) < 0.001);
+ CPPUNIT_ASSERT(fabs(bounds->GetMaxY() - 101200.000000) < 0.001);
- // feature "photo11_3", rotation = 90, resolution = 1;
- CPPUNIT_ASSERT(featureReader->ReadNext());
+ // feature "photo11_3", rotation = 90, resolution = 1;
+ CPPUNIT_ASSERT(featureReader->ReadNext());
- raster = featureReader->GetRaster(L"Image");
- CPPUNIT_ASSERT(raster->GetImageXSize() == 600);
- CPPUNIT_ASSERT(raster->GetImageYSize() == 800);
+ raster = featureReader->GetRaster(L"Image");
+ CPPUNIT_ASSERT(raster->GetImageXSize() == 600);
+ CPPUNIT_ASSERT(raster->GetImageYSize() == 800);
ba = raster->GetBounds();
geometery = geomFactory->CreateGeometryFromFgf(ba);
bounds = geometery->GetEnvelope();
CPPUNIT_ASSERT(bounds->GetMinX() == 100000.000000 - 600);
- CPPUNIT_ASSERT(bounds->GetMinY() == 100000.000000);
- CPPUNIT_ASSERT(fabs(bounds->GetMaxX() - 100000.000000) < 0.0001);
- CPPUNIT_ASSERT(fabs(bounds->GetMaxY() - 100800.000000) < 0.0001);
+ CPPUNIT_ASSERT(bounds->GetMinY() == 100000.000000);
+ CPPUNIT_ASSERT(fabs(bounds->GetMaxX() - 100000.000000) < 0.0001);
+ CPPUNIT_ASSERT(fabs(bounds->GetMaxY() - 100800.000000) < 0.0001);
- // feature "photo11_4", rotation = 90, resolution = 2;
- CPPUNIT_ASSERT(featureReader->ReadNext());
+ // feature "photo11_4", rotation = 90, resolution = 2;
+ CPPUNIT_ASSERT(featureReader->ReadNext());
- raster = featureReader->GetRaster(L"Image");
- CPPUNIT_ASSERT(raster->GetImageXSize() == 600);
- CPPUNIT_ASSERT(raster->GetImageYSize() == 800);
+ raster = featureReader->GetRaster(L"Image");
+ CPPUNIT_ASSERT(raster->GetImageXSize() == 600);
+ CPPUNIT_ASSERT(raster->GetImageYSize() == 800);
ba = raster->GetBounds();
geometery = geomFactory->CreateGeometryFromFgf(ba);
bounds = geometery->GetEnvelope();
CPPUNIT_ASSERT(bounds->GetMinX() == 100000.000000 - 1200);
- CPPUNIT_ASSERT(bounds->GetMinY() == 100000.000000);
- CPPUNIT_ASSERT(fabs(bounds->GetMaxX() - 100000.000000) < 0.0001);
- CPPUNIT_ASSERT(fabs(bounds->GetMaxY() - 101600.000000) < 0.0001);
+ CPPUNIT_ASSERT(bounds->GetMinY() == 100000.000000);
+ CPPUNIT_ASSERT(fabs(bounds->GetMaxX() - 100000.000000) < 0.0001);
+ CPPUNIT_ASSERT(fabs(bounds->GetMaxY() - 101600.000000) < 0.0001);
- connection->Close();
+ connection->Close();
}
void RfpTestBandConfig::testMissingXmlTag()
{
- FdoPtr<FdoIConnection> connection = CreateConnection();
+ FdoPtr<FdoIConnection> connection = CreateConnection();
- bool bError = false;
+ bool bError = false;
- // missing <Location>
- try
- {
- FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/missing_location.xml", L"r");
- connection->SetConfiguration(stream);
- connection->Open();
- }
- catch(...)
- {
- bError = true;
- connection->Close();
- }
- CPPUNIT_ASSERT(bError == true);
+ // missing <Location>
+ try
+ {
+ FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/missing_location.xml", L"r");
+ connection->SetConfiguration(stream);
+ connection->Open();
+ }
+ catch(...)
+ {
+ bError = true;
+ connection->Close();
+ }
+ CPPUNIT_ASSERT(bError == true);
- // missing <Feature>
- bError = false;
- try
- {
- FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/missing_feature.xml", L"r");
- connection->SetConfiguration(stream);
- connection->Open();
- }
- catch(...)
- {
- bError = true;
- connection->Close();
- }
- CPPUNIT_ASSERT(bError == true);
+ // missing <Feature>
+ bError = false;
+ try
+ {
+ FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/missing_feature.xml", L"r");
+ connection->SetConfiguration(stream);
+ connection->Open();
+ }
+ catch(...)
+ {
+ bError = true;
+ connection->Close();
+ }
+ CPPUNIT_ASSERT(bError == true);
- // missing <Band>
- bError = false;
- try
- {
- FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/missing_band.xml", L"r");
- connection->SetConfiguration(stream);
- connection->Open();
- }
- catch(...)
- {
- bError = true;
- connection->Close();
- }
- CPPUNIT_ASSERT(bError == true);
+ // missing <Band>
+ bError = false;
+ try
+ {
+ FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/missing_band.xml", L"r");
+ connection->SetConfiguration(stream);
+ connection->Open();
+ }
+ catch(...)
+ {
+ bError = true;
+ connection->Close();
+ }
+ CPPUNIT_ASSERT(bError == true);
- // missing <Image>
- bError = false;
- try
- {
- FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/missing_image.xml", L"r");
- connection->SetConfiguration(stream);
- connection->Open();
- }
- catch(...)
- {
- bError = true;
- connection->Close();
- }
- CPPUNIT_ASSERT(bError == true);
+ // missing <Image>
+ bError = false;
+ try
+ {
+ FdoPtr<FdoIoStream> stream = FdoIoFileStream::Create(L"../../TestData/band/missing_image.xml", L"r");
+ connection->SetConfiguration(stream);
+ connection->Open();
+ }
+ catch(...)
+ {
+ bError = true;
+ connection->Close();
+ }
+ CPPUNIT_ASSERT(bError == true);
}
Modified: trunk/Providers/GDAL/Src/UnitTest/RfpTestJpg.cpp
===================================================================
--- trunk/Providers/GDAL/Src/UnitTest/RfpTestJpg.cpp 2007-02-20 19:03:02 UTC (rev 2561)
+++ trunk/Providers/GDAL/Src/UnitTest/RfpTestJpg.cpp 2007-02-20 19:11:35 UTC (rev 2562)
@@ -45,18 +45,18 @@
void RfpTestJpg::testLoad()
{
- FdoPtr<FdoIConnection> connection = CreateConnection();
- connection->SetConnectionString(L"DefaultRasterFileLocation=../../TestData/JPG");
- connection->Open();
+ FdoPtr<FdoIConnection> connection = CreateConnection();
+ connection->SetConnectionString(L"DefaultRasterFileLocation=../../TestData/JPG");
+ connection->Open();
- FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
+ FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
#ifndef WIN32
- FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
#else
- FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
#endif
- cmdSelect->SetFeatureClassName(L"default");
- FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
+ cmdSelect->SetFeatureClassName(L"default");
+ FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
FdoInt32 count=0;
while (featureReader->ReadNext())
@@ -66,58 +66,58 @@
FdoInt32 xsize = raster->GetImageXSize();
FdoInt32 ysize = raster->GetImageYSize();
- FdoPtr<FdoRasterDataModel> dataModel = raster->GetDataModel();
+ FdoPtr<FdoRasterDataModel> dataModel = raster->GetDataModel();
FdoInt32 ppb = dataModel->GetBitsPerPixel();
- FdoRasterDataModelType dmType = dataModel->GetDataModelType();
+ FdoRasterDataModelType dmType = dataModel->GetDataModelType();
- FdoInt32 xTileSize = dataModel->GetTileSizeX();
- FdoInt32 yTileSize = dataModel->GetTileSizeY();
+ FdoInt32 xTileSize = dataModel->GetTileSizeX();
+ FdoInt32 yTileSize = dataModel->GetTileSizeY();
- dataModel->SetTileSizeX(1024);
- dataModel->SetTileSizeY(1024);
+ dataModel->SetTileSizeX(1024);
+ dataModel->SetTileSizeY(1024);
- raster->SetDataModel(dataModel);
+ raster->SetDataModel(dataModel);
- FdoPtr<FdoIStreamReaderTmpl<FdoByte> > reader = dynamic_cast<FdoIStreamReaderTmpl<FdoByte>*>(raster->GetStreamReader());
- int numTileRows = (xsize - 1) / 1024 + 1;
- int numTileCols = (ysize - 1) / 1024 + 1;
- const int bytesTile = 1024 * 1024 * 1;
+ FdoPtr<FdoIStreamReaderTmpl<FdoByte> > reader = dynamic_cast<FdoIStreamReaderTmpl<FdoByte>*>(raster->GetStreamReader());
+ int numTileRows = (xsize - 1) / 1024 + 1;
+ int numTileCols = (ysize - 1) / 1024 + 1;
+ const int bytesTile = 1024 * 1024 * 1;
- FdoByte* buffer = new FdoByte[bytesTile];
- for (int i = 0; i < numTileRows; i++)
- {
- // read the first tile of the tile row
- FdoInt32 numRead = reader->ReadNext(buffer, 0, bytesTile);
- CPPUNIT_ASSERT(numRead == bytesTile);
- // skip the rest tiles
- reader->Skip(bytesTile * (numTileCols - 1));
- }
+ FdoByte* buffer = new FdoByte[bytesTile];
+ for (int i = 0; i < numTileRows; i++)
+ {
+ // read the first tile of the tile row
+ FdoInt32 numRead = reader->ReadNext(buffer, 0, bytesTile);
+ CPPUNIT_ASSERT(numRead == bytesTile);
+ // skip the rest tiles
+ reader->Skip(bytesTile * (numTileCols - 1));
+ }
- delete buffer;
+ delete buffer;
count++;
}
CPPUNIT_ASSERT(count == 1);
- connection->Close();
+ connection->Close();
}
void RfpTestJpg::testSpecialCharacters()
{
try
{
- FdoPtr<FdoIConnection> connection = CreateConnection();
- connection->SetConnectionString(L"DefaultRasterFileLocation=\"../../TestData/JPG/NBenguela.2004357.aqua.250m (.!,@#$%^()_+=-`~[]').jpg\"");
- connection->Open();
+ FdoPtr<FdoIConnection> connection = CreateConnection();
+ connection->SetConnectionString(L"DefaultRasterFileLocation=\"../../TestData/JPG/NBenguela.2004357.aqua.250m (.!,@#$%^()_+=-`~[]').jpg\"");
+ connection->Open();
- FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
+ FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
#ifndef WIN32
- FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
#else
- FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
#endif
- cmdSelect->SetFeatureClassName(L"default");
- FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
+ cmdSelect->SetFeatureClassName(L"default");
+ FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
FdoInt32 count=0;
while (featureReader->ReadNext())
@@ -126,51 +126,51 @@
FdoPtr<FdoIRaster> raster = featureReader->GetRaster(L"Raster");
FdoInt32 xsize = raster->GetImageXSize();
FdoInt32 ysize = raster->GetImageYSize();
- CPPUNIT_ASSERT(xsize == 4000);
- CPPUNIT_ASSERT(ysize == 5400);
+ CPPUNIT_ASSERT(xsize == 4000);
+ CPPUNIT_ASSERT(ysize == 5400);
- FdoPtr<FdoRasterDataModel> dataModel = raster->GetDataModel();
+ FdoPtr<FdoRasterDataModel> dataModel = raster->GetDataModel();
FdoInt32 ppb = dataModel->GetBitsPerPixel();
- CPPUNIT_ASSERT(ppb == 24);
- FdoRasterDataModelType dmType = dataModel->GetDataModelType();
- CPPUNIT_ASSERT(dmType == FdoRasterDataModelType_RGB);
+ CPPUNIT_ASSERT(ppb == 24);
+ FdoRasterDataModelType dmType = dataModel->GetDataModelType();
+ CPPUNIT_ASSERT(dmType == FdoRasterDataModelType_RGB);
- FdoInt32 xTileSize = dataModel->GetTileSizeX();
- FdoInt32 yTileSize = dataModel->GetTileSizeY();
- CPPUNIT_ASSERT(xTileSize == 4000);
- CPPUNIT_ASSERT(yTileSize == 1);
+ FdoInt32 xTileSize = dataModel->GetTileSizeX();
+ FdoInt32 yTileSize = dataModel->GetTileSizeY();
+ CPPUNIT_ASSERT(xTileSize == 4000);
+ CPPUNIT_ASSERT(yTileSize == 1);
- dataModel->SetTileSizeX(1024);
- dataModel->SetTileSizeY(1024);
+ dataModel->SetTileSizeX(1024);
+ dataModel->SetTileSizeY(1024);
- raster->SetDataModel(dataModel);
+ raster->SetDataModel(dataModel);
- FdoPtr<FdoIStreamReaderTmpl<FdoByte> > reader = dynamic_cast<FdoIStreamReaderTmpl<FdoByte>*>(raster->GetStreamReader());
- int numTileRows = (xsize - 1) / 1024 + 1;
- int numTileCols = (ysize - 1) / 1024 + 1;
- const int bytesTile = 1024 * 1024 * 1;
+ FdoPtr<FdoIStreamReaderTmpl<FdoByte> > reader = dynamic_cast<FdoIStreamReaderTmpl<FdoByte>*>(raster->GetStreamReader());
+ int numTileRows = (xsize - 1) / 1024 + 1;
+ int numTileCols = (ysize - 1) / 1024 + 1;
+ const int bytesTile = 1024 * 1024 * 1;
- FdoByte* buffer = new FdoByte[bytesTile];
- for (int i = 0; i < numTileRows; i++)
- {
- // read the first tile of the tile row
- FdoInt32 numRead = reader->ReadNext(buffer, 0, bytesTile);
- CPPUNIT_ASSERT(numRead == bytesTile);
- // skip the rest tiles
- reader->Skip(bytesTile * (numTileCols - 1));
- }
+ FdoByte* buffer = new FdoByte[bytesTile];
+ for (int i = 0; i < numTileRows; i++)
+ {
+ // read the first tile of the tile row
+ FdoInt32 numRead = reader->ReadNext(buffer, 0, bytesTile);
+ CPPUNIT_ASSERT(numRead == bytesTile);
+ // skip the rest tiles
+ reader->Skip(bytesTile * (numTileCols - 1));
+ }
- delete buffer;
+ delete buffer;
count++;
}
CPPUNIT_ASSERT(count == 1);
- connection->Close();
+ connection->Close();
}
- catch (FdoException* e)
+ catch (FdoException* e)
{
CPPUNIT_FAIL((const char*)FdoStringP(e->GetExceptionMessage()));
- }
+ }
}
Modified: trunk/Providers/GDAL/Src/UnitTest/RfpTestPng.cpp
===================================================================
--- trunk/Providers/GDAL/Src/UnitTest/RfpTestPng.cpp 2007-02-20 19:03:02 UTC (rev 2561)
+++ trunk/Providers/GDAL/Src/UnitTest/RfpTestPng.cpp 2007-02-20 19:11:35 UTC (rev 2562)
@@ -45,20 +45,20 @@
void RfpTestPng::testLoad()
{
- try
+ try
{
- FdoPtr<FdoIConnection> connection = CreateConnection();
- connection->SetConnectionString(L"DefaultRasterFileLocation=../../TestData/PNG");
- connection->Open();
+ FdoPtr<FdoIConnection> connection = CreateConnection();
+ connection->SetConnectionString(L"DefaultRasterFileLocation=../../TestData/PNG");
+ connection->Open();
- FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
+ FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
#ifndef WIN32
- FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
#else
- FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
#endif
- cmdSelect->SetFeatureClassName(L"default");
- FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
+ cmdSelect->SetFeatureClassName(L"default");
+ FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
FdoInt32 count=0;
while (featureReader->ReadNext())
@@ -68,65 +68,65 @@
FdoInt32 xsize = raster->GetImageXSize();
FdoInt32 ysize = raster->GetImageYSize();
- FdoPtr<FdoRasterDataModel> dataModel = raster->GetDataModel();
+ FdoPtr<FdoRasterDataModel> dataModel = raster->GetDataModel();
FdoInt32 ppb = dataModel->GetBitsPerPixel();
- FdoRasterDataModelType dmType = dataModel->GetDataModelType();
+ FdoRasterDataModelType dmType = dataModel->GetDataModelType();
- FdoInt32 xTileSize = dataModel->GetTileSizeX();
- FdoInt32 yTileSize = dataModel->GetTileSizeY();
+ FdoInt32 xTileSize = dataModel->GetTileSizeX();
+ FdoInt32 yTileSize = dataModel->GetTileSizeY();
- dataModel->SetTileSizeX(1024);
- dataModel->SetTileSizeY(1024);
+ dataModel->SetTileSizeX(1024);
+ dataModel->SetTileSizeY(1024);
- raster->SetDataModel(dataModel);
+ raster->SetDataModel(dataModel);
- FdoPtr<FdoIStreamReaderTmpl<FdoByte> > reader = dynamic_cast<FdoIStreamReaderTmpl<FdoByte>*>(raster->GetStreamReader());
- int numTileRows = (xsize - 1) / 1024 + 1;
- int numTileCols = (ysize - 1) / 1024 + 1;
- const int bytesTile = 1024 * 1024 * 1;
+ FdoPtr<FdoIStreamReaderTmpl<FdoByte> > reader = dynamic_cast<FdoIStreamReaderTmpl<FdoByte>*>(raster->GetStreamReader());
+ int numTileRows = (xsize - 1) / 1024 + 1;
+ int numTileCols = (ysize - 1) / 1024 + 1;
+ const int bytesTile = 1024 * 1024 * 1;
- FdoByte* buffer = new FdoByte[bytesTile];
- for (int i = 0; i < numTileRows; i++)
- {
- // read the first tile of the tile row
- FdoInt32 numRead = reader->ReadNext(buffer, 0, bytesTile);
- CPPUNIT_ASSERT(numRead == bytesTile);
- // skip the rest tiles
- reader->Skip(bytesTile * (numTileCols - 1));
- }
+ FdoByte* buffer = new FdoByte[bytesTile];
+ for (int i = 0; i < numTileRows; i++)
+ {
+ // read the first tile of the tile row
+ FdoInt32 numRead = reader->ReadNext(buffer, 0, bytesTile);
+ CPPUNIT_ASSERT(numRead == bytesTile);
+ // skip the rest tiles
+ reader->Skip(bytesTile * (numTileCols - 1));
+ }
- // no data
- CPPUNIT_ASSERT(reader->ReadNext(buffer, 0, 1) == 0);
- delete buffer;
+ // no data
+ CPPUNIT_ASSERT(reader->ReadNext(buffer, 0, 1) == 0);
+ delete buffer;
count++;
}
CPPUNIT_ASSERT(count == 11);
- connection->Close();
+ connection->Close();
}
- catch (FdoException* e)
+ catch (FdoException* e)
{
CPPUNIT_FAIL((const char*)FdoStringP(e->GetExceptionMessage()));
- }
+ }
}
void RfpTestPng::testSpecialCharacters()
{
- try
+ try
{
FdoPtr<FdoIConnection> connection = CreateConnection();
- connection->SetConnectionString(L"DefaultRasterFileLocation=\"../../TestData/PNG/COTcvdm.U (.!,@#$%^()_+=-`~[]').png\"");
- connection->Open();
+ connection->SetConnectionString(L"DefaultRasterFileLocation=\"../../TestData/PNG/COTcvdm.U (.!,@#$%^()_+=-`~[]').png\"");
+ connection->Open();
- FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
+ FdoICommand* cmd = connection->CreateCommand(FdoCommandType_Select);
#ifndef WIN32
- FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = static_cast<FdoISelect*>(cmd);
#else
- FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
+ FdoPtr<FdoISelect> cmdSelect = dynamic_cast<FdoISelect*>(cmd);
#endif
- cmdSelect->SetFeatureClassName(L"default");
- FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
+ cmdSelect->SetFeatureClassName(L"default");
+ FdoPtr<FdoIFeatureReader> featureReader = cmdSelect->Execute();
FdoInt32 count=0;
while (featureReader->ReadNext())
@@ -135,52 +135,52 @@
FdoPtr<FdoIRaster> raster = featureReader->GetRaster(L"Raster");
FdoInt32 xsize = raster->GetImageXSize();
FdoInt32 ysize = raster->GetImageYSize();
- CPPUNIT_ASSERT(xsize == 2227);
- CPPUNIT_ASSERT(ysize == 2267);
+ CPPUNIT_ASSERT(xsize == 2227);
+ CPPUNIT_ASSERT(ysize == 2267);
- FdoPtr<FdoRasterDataModel> dataModel = raster->GetDataModel();
+ FdoPtr<FdoRasterDataModel> dataModel = raster->GetDataModel();
FdoInt32 ppb = dataModel->GetBitsPerPixel();
- CPPUNIT_ASSERT(ppb == 8);
- FdoRasterDataModelType dmType = dataModel->GetDataModelType();
- CPPUNIT_ASSERT(dmType == FdoRasterDataModelType_Palette);
+ CPPUNIT_ASSERT(ppb == 8);
+ FdoRasterDataModelType dmType = dataModel->GetDataModelType();
+ CPPUNIT_ASSERT(dmType == FdoRasterDataModelType_Palette);
- FdoInt32 xTileSize = dataModel->GetTileSizeX();
- FdoInt32 yTileSize = dataModel->GetTileSizeY();
- CPPUNIT_ASSERT(xTileSize == 2227);
- CPPUNIT_ASSERT(yTileSize == 1);
+ FdoInt32 xTileSize = dataModel->GetTileSizeX();
+ FdoInt32 yTileSize = dataModel->GetTileSizeY();
+ CPPUNIT_ASSERT(xTileSize == 2227);
+ CPPUNIT_ASSERT(yTileSize == 1);
- dataModel->SetTileSizeX(1024);
- dataModel->SetTileSizeY(1024);
+ dataModel->SetTileSizeX(1024);
+ dataModel->SetTileSizeY(1024);
- raster->SetDataModel(dataModel);
+ raster->SetDataModel(dataModel);
- FdoPtr<FdoIStreamReaderTmpl<FdoByte> > reader = dynamic_cast<FdoIStreamReaderTmpl<FdoByte>*>(raster->GetStreamReader());
- int numTileRows = (xsize - 1) / 1024 + 1;
- int numTileCols = (ysize - 1) / 1024 + 1;
- const int bytesTile = 1024 * 1024 * 1;
+ FdoPtr<FdoIStreamReaderTmpl<FdoByte> > reader = dynamic_cast<FdoIStreamReaderTmpl<FdoByte>*>(raster->GetStreamReader());
+ int numTileRows = (xsize - 1) / 1024 + 1;
+ int numTileCols = (ysize - 1) / 1024 + 1;
+ const int bytesTile = 1024 * 1024 * 1;
- FdoByte* buffer = new FdoByte[bytesTile];
- for (int i = 0; i < numTileRows; i++)
- {
- // read the first tile of the tile row
- FdoInt32 numRead = reader->ReadNext(buffer, 0, bytesTile);
- CPPUNIT_ASSERT(numRead == bytesTile);
- // skip the rest tiles
- reader->Skip(bytesTile * (numTileCols - 1));
- }
+ FdoByte* buffer = new FdoByte[bytesTile];
+ for (int i = 0; i < numTileRows; i++)
+ {
+ // read the first tile of the tile row
+ FdoInt32 numRead = reader->ReadNext(buffer, 0, bytesTile);
+ CPPUNIT_ASSERT(numRead == bytesTile);
+ // skip the rest tiles
+ reader->Skip(bytesTile * (numTileCols - 1));
+ }
- // no data
- CPPUNIT_ASSERT(reader->ReadNext(buffer, 0, 1) == 0);
- delete buffer;
+ // no data
+ CPPUNIT_ASSERT(reader->ReadNext(buffer, 0, 1) == 0);
+ delete buffer;
count++;
}
CPPUNIT_ASSERT(count == 1);
- connection->Close();
+ connection->Close();
}
- catch (FdoException* e)
+ catch (FdoException* e)
{
CPPUNIT_FAIL((const char*)FdoStringP(e->GetExceptionMessage()));
- }
+ }
}
More information about the fdo-commits
mailing list