Skip to content
Permalink
Browse files

restore zip raster layer style test - still needs a test for vector l…

…ayers
  • Loading branch information
etiennesky committed Apr 28, 2013
1 parent 785f614 commit ddbfb2e8ea21e058d0727a2993feb834c1899d4d
Showing with 17 additions and 8 deletions.
  1. +17 −8 tests/src/core/testziplayer.cpp
@@ -51,8 +51,8 @@ class TestZipLayer: public QObject
// test item(s) in zip item (supply name or test all)
bool testZipItem( QString myFileName, QString myChildName = "", QString myDriverName = "" );
// get layer transparency to test for .qml loading
// int getLayerTransparency( QString myFileName, QString myProviderKey, QString myScanZipSetting = "basic" );
// bool testZipItemTransparency( QString myFileName, QString myProviderKey, int myTarget );
int getLayerTransparency( QString myFileName, QString myProviderKey, QString myScanZipSetting = "basic" );
bool testZipItemTransparency( QString myFileName, QString myProviderKey, int myTarget );

private slots:

@@ -77,15 +77,16 @@ class TestZipLayer: public QObject
void testTarItemVector();
void testZipItemAll();
void testTarItemAll();
#if 0
// test that styles are loaded from .qml files outside zip files
#if 0
// TODO - find a simple way to test vector style loading
void testZipItemVectorTransparency();
void testTarItemVectorTransparency();
void testGzipItemVectorTransparency();
#endif
void testZipItemRasterTransparency();
void testTarItemRasterTransparency();
void testGzipItemRasterTransparency();
#endif
//make sure items inside subfolders can be read
void testZipItemSubfolder();
void testTarItemSubfolder();
@@ -213,7 +214,6 @@ bool TestZipLayer::testZipItem( QString myFileName, QString myChildName, QString
return ok;
}

#if 0
int TestZipLayer::getLayerTransparency( QString myFileName, QString myProviderKey, QString myScanZipSetting )
{
int myTransparency = -1;
@@ -228,7 +228,17 @@ int TestZipLayer::getLayerTransparency( QString myFileName, QString myProviderKe
else
myLayer = getZipLayer( myFileName, "" );
if ( myLayer && myLayer->isValid() )
myTransparency = myLayer->getTransparency();
{
// myTransparency = myLayer->getTransparency();
if ( myLayer->type() == QgsMapLayer::RasterLayer )
{
QgsRasterLayer* layer = dynamic_cast<QgsRasterLayer*>( myLayer );
if ( layer && layer->renderer() )
{
myTransparency = ceil(layer->renderer()->opacity() * 255);
}
}
}
else
QWARN( QString( "Could not open filename %1 using %2 provider" ).arg( myFileName ).arg( myProviderKey ).toLocal8Bit().data() );
if ( myLayer )
@@ -250,7 +260,6 @@ bool TestZipLayer::testZipItemTransparency( QString myFileName, QString myProvid
}
return true;
}
#endif


// slots
@@ -466,6 +475,7 @@ void TestZipLayer::testGzipItemVectorTransparency()
#endif
QVERIFY( testZipItemTransparency( mDataDir + "points3.geojson.gz", "ogr", 250 ) );
}
#endif

void TestZipLayer::testZipItemRasterTransparency()
{
@@ -484,7 +494,6 @@ void TestZipLayer::testGzipItemRasterTransparency()
{
QVERIFY( testZipItemTransparency( mDataDir + "landsat_b1.tif.gz", "gdal", 250 ) );
}
#endif

void TestZipLayer::testZipItemSubfolder()
{

0 comments on commit ddbfb2e

Please sign in to comment.
You can’t perform that action at this time.