Skip to content

Commit

Permalink
restore zip raster layer style test - still needs a test for vector l…
Browse files Browse the repository at this point in the history
…ayers
  • Loading branch information
etiennesky committed Apr 28, 2013
1 parent 785f614 commit ddbfb2e
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tests/src/core/testziplayer.cpp
Expand Up @@ -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:

Expand All @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -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 )
Expand All @@ -250,7 +260,6 @@ bool TestZipLayer::testZipItemTransparency( QString myFileName, QString myProvid
}
return true;
}
#endif


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

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

void TestZipLayer::testZipItemSubfolder()
{
Expand Down

0 comments on commit ddbfb2e

Please sign in to comment.