Skip to content
Permalink
Browse files

add a few cpt-city svg files to tests

  • Loading branch information
etiennesky committed Aug 6, 2012
1 parent 3391f42 commit 6861078d02f0a055f5ba5eb0349ab27be8842aa5
@@ -254,7 +254,8 @@ void TestQgsRasterLayer::colorRamp2()

void TestQgsRasterLayer::colorRamp3()
{
// cpt-city ramp
// cpt-city ramp, small selection available in <testdir>/cpt-city
QgsCptCityColorRampV2::setBaseDir( mTestDataDir + "cpt-city" );
QVERIFY( testColorRamp( "raster_colorRamp3",
new QgsCptCityColorRampV2( "gmt/GMT_panoply", "" ),
QgsColorRampShader::DISCRETE, 10 ) );
@@ -37,6 +37,7 @@ class TestStyleV2: public QObject
private:

QgsStyleV2 *mStyle;
QString mTestDataDir;

bool testValidColor( QgsVectorColorRampV2 *ramp, double value, QColor expected );

@@ -58,9 +59,10 @@ class TestStyleV2: public QObject
// slots
void TestStyleV2::initTestCase()
{
// initialize with test directory so we don't mess with user's stuff
// initialize with test settings directory so we don't mess with user's stuff
QgsApplication::init( QDir::homePath() + QString( "/.qgis_test" ) );
QgsApplication::initQgis();
mTestDataDir = QString( TEST_DATA_DIR ) + QDir::separator(); //defined in CmakeLists.txt

// output test environment
QgsApplication::showSettings();
@@ -79,6 +81,10 @@ void TestStyleV2::initTestCase()
}
mStyle = QgsStyleV2::defaultStyle();
// mStyle->clear();

// cpt-city ramp, small selection available in <testdir>/cpt-city
QgsCptCityColorRampV2::setBaseDir( mTestDataDir + "cpt-city" );
QgsCptCityColorRampV2::loadSchemes( "" );
}

void TestStyleV2::cleanupTestCase()
@@ -119,21 +125,17 @@ void TestStyleV2::testCreateColorRamps()
QgsVectorColorBrewerColorRampV2* cb2Ramp = new QgsVectorColorBrewerColorRampV2( "RdYlGn", 6 );
QVERIFY( mStyle->addColorRamp( "test_cb2", cb2Ramp ) == true );

// cpt-city ramp - use gradients that are free to distribute
// set base dir because we are using a test home path - change this if we distribute a minimal set with qgis
QgsCptCityColorRampV2::setBaseDir( QDir::homePath() + QString( "/.qgis/cpt-city" ) );
QgsCptCityColorRampV2::loadSchemes( "" );
if ( QgsCptCityColorRampV2::hasBasicSchemes() )
{
QgsCptCityColorRampV2* cc1Ramp = new QgsCptCityColorRampV2( "jjg/misc/temperature", "" );
QVERIFY( mStyle->addColorRamp( "test_cc1", cc1Ramp ) == true );
QgsCptCityColorRampV2* cc2Ramp = new QgsCptCityColorRampV2( "cb/div/PiYG", "_10" );
QVERIFY( mStyle->addColorRamp( "test_cc2", cc2Ramp ) == true );
}
else
{
QWARN( "cpt-city support files not found - skipping cpt-city color ramp tests" );
}
// if ( QgsCptCityColorRampV2::hasBasicSchemes() )
// {
QgsCptCityColorRampV2* cc1Ramp = new QgsCptCityColorRampV2( "jjg/misc/temperature", "" );
QVERIFY( mStyle->addColorRamp( "test_cc1", cc1Ramp ) == true );
QgsCptCityColorRampV2* cc2Ramp = new QgsCptCityColorRampV2( "cb/div/PiYG", "_10" );
QVERIFY( mStyle->addColorRamp( "test_cc2", cc2Ramp ) == true );
// }
// else
// {
// QWARN( "cpt-city support files not found - skipping cpt-city color ramp tests" );
// }
}

void TestStyleV2::testLoadColorRamps()
@@ -154,15 +156,15 @@ void TestStyleV2::testLoadColorRamps()
colorTests.insert( "test_cb2", qMakePair( 0.66, QColor( "#d9ef8b" ) ) );

// cpt-city
if ( QgsCptCityColorRampV2::hasAllSchemes() )
{
colorRampsTest << "test_cc1";
colorTests.insert( "test_cc1", qMakePair( 0.25, QColor( "#466fcf" ) ) );
colorTests.insert( "test_cc1", qMakePair( 0.66, QColor( "#dbc85b" ) ) );
colorRampsTest << "test_cc2";
colorTests.insert( "test_cc2", qMakePair( 0.25, QColor( "#de77ae" ) ) );
colorTests.insert( "test_cc2", qMakePair( 0.66, QColor( "#b8e186" ) ) );
}
// if ( QgsCptCityColorRampV2::hasAllSchemes() )
// {
colorRampsTest << "test_cc1";
colorTests.insert( "test_cc1", qMakePair( 0.25, QColor( "#466fcf" ) ) );
colorTests.insert( "test_cc1", qMakePair( 0.66, QColor( "#dbc85b" ) ) );
colorRampsTest << "test_cc2";
colorTests.insert( "test_cc2", qMakePair( 0.25, QColor( "#de77ae" ) ) );
colorTests.insert( "test_cc2", qMakePair( 0.66, QColor( "#b8e186" ) ) );
// }

foreach ( QString name, colorRampsTest )
{
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<copying>
<authors>
<author href="http://www.personal.psu.edu/cab38/">
<name>Cynthia Brewer</name>
<org>Pennsylvania State University</org>
</author>
<author href="http://www.geography.wisc.edu/~harrower/">
<name>Mark Harrower</name>
<org>University of Wisconsin-Madison</org>
</author>
</authors>
<license>
<informal>Apache-style</informal>
<year>2002</year>
<text>
Apache-Style Software License for ColorBrewer software and ColorBrewer
Color Schemes

Version 1.1

Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania
State University. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions as source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. The end-user documentation included with the redistribution, if any,
must include the following acknowledgment:

"This product includes color specifications and designs developed by
Cynthia Brewer (http://colorbrewer.org/)."

Alternately, this acknowledgment may appear in the software
itself, if and wherever such third-party acknowledgments normally appear.

4. The name "ColorBrewer" must not be used to endorse or promote products derived
from this software without prior written permission. For written permission, please
contact Cynthia Brewer at cbrewer@psu.edu.

5. Products derived from this software may not be called "ColorBrewer", nor may "ColorBrewer"
appear in their name, without prior written permission of Cynthia Brewer.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CYNTHIA BREWER, MARK HARROWER, OR THE
PENNSYLVANIA STATE UNIVERSITY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</text>
</license>
<src>
<format>Excel spreadsheet</format>
<link href="http://colorbrewer2.org/">ColorBrewer site</link>
<link href="http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_RGB.html">
Excel spreadsheet download</link>
</src>
</copying>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<description>
<dir>cb</dir>
<name>Colour schemes by Cynthia Brewer</name>
<full>
Colour schemes were designed by Cynthia Brewer,
Associate Professor of Geography at the Pennsylvania
State University.
</full>
<date>01/08/2012</date>
</description>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<description>
<dir>div</dir>
<name>Diverging</name>
<full>
Diverging colour schemes designed by Cynthia Brewer
</full>
<date>01/08/2012</date>
</description>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<linearGradient id="PiYG_03" gradientUnits="objectBoundingBox" spreadMethod="pad" x1="0%" x2="100%" y1="0%" y2="100%">
<stop offset="0.00%" stop-color="rgb(233,163,201)" stop-opacity="1.0000"/>
<stop offset="33.33%" stop-color="rgb(233,163,201)" stop-opacity="1.0000"/>
<stop offset="33.33%" stop-color="rgb(247,247,247)" stop-opacity="1.0000"/>
<stop offset="66.67%" stop-color="rgb(247,247,247)" stop-opacity="1.0000"/>
<stop offset="66.67%" stop-color="rgb(161,215,106)" stop-opacity="1.0000"/>
<stop offset="100.00%" stop-color="rgb(161,215,106)" stop-opacity="1.0000"/>
</linearGradient>
<metadata>
<creator name="cptutils" version="1.44"/>
<created date="Tue Mar 13 13:12:21 2012"/>
</metadata>
</svg>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<linearGradient id="PiYG_04" gradientUnits="objectBoundingBox" spreadMethod="pad" x1="0%" x2="100%" y1="0%" y2="100%">
<stop offset="0.00%" stop-color="rgb(208,28,139)" stop-opacity="1.0000"/>
<stop offset="25.00%" stop-color="rgb(208,28,139)" stop-opacity="1.0000"/>
<stop offset="25.00%" stop-color="rgb(241,182,218)" stop-opacity="1.0000"/>
<stop offset="50.00%" stop-color="rgb(241,182,218)" stop-opacity="1.0000"/>
<stop offset="50.00%" stop-color="rgb(184,225,134)" stop-opacity="1.0000"/>
<stop offset="75.00%" stop-color="rgb(184,225,134)" stop-opacity="1.0000"/>
<stop offset="75.00%" stop-color="rgb(77,172,38)" stop-opacity="1.0000"/>
<stop offset="100.00%" stop-color="rgb(77,172,38)" stop-opacity="1.0000"/>
</linearGradient>
<metadata>
<creator name="cptutils" version="1.44"/>
<created date="Tue Mar 13 13:12:23 2012"/>
</metadata>
</svg>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<linearGradient id="PiYG_05" gradientUnits="objectBoundingBox" spreadMethod="pad" x1="0%" x2="100%" y1="0%" y2="100%">
<stop offset="0.00%" stop-color="rgb(208,28,139)" stop-opacity="1.0000"/>
<stop offset="20.00%" stop-color="rgb(208,28,139)" stop-opacity="1.0000"/>
<stop offset="20.00%" stop-color="rgb(241,182,218)" stop-opacity="1.0000"/>
<stop offset="40.00%" stop-color="rgb(241,182,218)" stop-opacity="1.0000"/>
<stop offset="40.00%" stop-color="rgb(247,247,247)" stop-opacity="1.0000"/>
<stop offset="60.00%" stop-color="rgb(247,247,247)" stop-opacity="1.0000"/>
<stop offset="60.00%" stop-color="rgb(184,225,134)" stop-opacity="1.0000"/>
<stop offset="80.00%" stop-color="rgb(184,225,134)" stop-opacity="1.0000"/>
<stop offset="80.00%" stop-color="rgb(77,172,38)" stop-opacity="1.0000"/>
<stop offset="100.00%" stop-color="rgb(77,172,38)" stop-opacity="1.0000"/>
</linearGradient>
<metadata>
<creator name="cptutils" version="1.44"/>
<created date="Tue Mar 13 13:12:22 2012"/>
</metadata>
</svg>
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<linearGradient id="PiYG_06" gradientUnits="objectBoundingBox" spreadMethod="pad" x1="0%" x2="100%" y1="0%" y2="100%">
<stop offset="0.00%" stop-color="rgb(197,27,125)" stop-opacity="1.0000"/>
<stop offset="16.67%" stop-color="rgb(197,27,125)" stop-opacity="1.0000"/>
<stop offset="16.67%" stop-color="rgb(233,163,201)" stop-opacity="1.0000"/>
<stop offset="33.33%" stop-color="rgb(233,163,201)" stop-opacity="1.0000"/>
<stop offset="33.33%" stop-color="rgb(253,224,239)" stop-opacity="1.0000"/>
<stop offset="50.00%" stop-color="rgb(253,224,239)" stop-opacity="1.0000"/>
<stop offset="50.00%" stop-color="rgb(230,245,208)" stop-opacity="1.0000"/>
<stop offset="66.67%" stop-color="rgb(230,245,208)" stop-opacity="1.0000"/>
<stop offset="66.67%" stop-color="rgb(161,215,106)" stop-opacity="1.0000"/>
<stop offset="83.33%" stop-color="rgb(161,215,106)" stop-opacity="1.0000"/>
<stop offset="83.33%" stop-color="rgb(77,146,33)" stop-opacity="1.0000"/>
<stop offset="100.00%" stop-color="rgb(77,146,33)" stop-opacity="1.0000"/>
</linearGradient>
<metadata>
<creator name="cptutils" version="1.44"/>
<created date="Tue Mar 13 13:12:21 2012"/>
</metadata>
</svg>
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<linearGradient id="PiYG_07" gradientUnits="objectBoundingBox" spreadMethod="pad" x1="0%" x2="100%" y1="0%" y2="100%">
<stop offset="0.00%" stop-color="rgb(197,27,125)" stop-opacity="1.0000"/>
<stop offset="14.29%" stop-color="rgb(197,27,125)" stop-opacity="1.0000"/>
<stop offset="14.29%" stop-color="rgb(233,163,201)" stop-opacity="1.0000"/>
<stop offset="28.57%" stop-color="rgb(233,163,201)" stop-opacity="1.0000"/>
<stop offset="28.57%" stop-color="rgb(253,224,239)" stop-opacity="1.0000"/>
<stop offset="42.86%" stop-color="rgb(253,224,239)" stop-opacity="1.0000"/>
<stop offset="42.86%" stop-color="rgb(247,247,247)" stop-opacity="1.0000"/>
<stop offset="57.14%" stop-color="rgb(247,247,247)" stop-opacity="1.0000"/>
<stop offset="57.14%" stop-color="rgb(230,245,208)" stop-opacity="1.0000"/>
<stop offset="71.43%" stop-color="rgb(230,245,208)" stop-opacity="1.0000"/>
<stop offset="71.43%" stop-color="rgb(161,215,106)" stop-opacity="1.0000"/>
<stop offset="85.71%" stop-color="rgb(161,215,106)" stop-opacity="1.0000"/>
<stop offset="85.71%" stop-color="rgb(77,146,33)" stop-opacity="1.0000"/>
<stop offset="100.00%" stop-color="rgb(77,146,33)" stop-opacity="1.0000"/>
</linearGradient>
<metadata>
<creator name="cptutils" version="1.44"/>
<created date="Tue Mar 13 13:12:23 2012"/>
</metadata>
</svg>
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<linearGradient id="PiYG_08" gradientUnits="objectBoundingBox" spreadMethod="pad" x1="0%" x2="100%" y1="0%" y2="100%">
<stop offset="0.00%" stop-color="rgb(197,27,125)" stop-opacity="1.0000"/>
<stop offset="12.50%" stop-color="rgb(197,27,125)" stop-opacity="1.0000"/>
<stop offset="12.50%" stop-color="rgb(222,119,174)" stop-opacity="1.0000"/>
<stop offset="25.00%" stop-color="rgb(222,119,174)" stop-opacity="1.0000"/>
<stop offset="25.00%" stop-color="rgb(241,182,218)" stop-opacity="1.0000"/>
<stop offset="37.50%" stop-color="rgb(241,182,218)" stop-opacity="1.0000"/>
<stop offset="37.50%" stop-color="rgb(253,224,239)" stop-opacity="1.0000"/>
<stop offset="50.00%" stop-color="rgb(253,224,239)" stop-opacity="1.0000"/>
<stop offset="50.00%" stop-color="rgb(230,245,208)" stop-opacity="1.0000"/>
<stop offset="62.50%" stop-color="rgb(230,245,208)" stop-opacity="1.0000"/>
<stop offset="62.50%" stop-color="rgb(184,225,134)" stop-opacity="1.0000"/>
<stop offset="75.00%" stop-color="rgb(184,225,134)" stop-opacity="1.0000"/>
<stop offset="75.00%" stop-color="rgb(127,188,65)" stop-opacity="1.0000"/>
<stop offset="87.50%" stop-color="rgb(127,188,65)" stop-opacity="1.0000"/>
<stop offset="87.50%" stop-color="rgb(77,146,33)" stop-opacity="1.0000"/>
<stop offset="100.00%" stop-color="rgb(77,146,33)" stop-opacity="1.0000"/>
</linearGradient>
<metadata>
<creator name="cptutils" version="1.44"/>
<created date="Tue Mar 13 13:12:23 2012"/>
</metadata>
</svg>
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<linearGradient id="PiYG_09" gradientUnits="objectBoundingBox" spreadMethod="pad" x1="0%" x2="100%" y1="0%" y2="100%">
<stop offset="0.00%" stop-color="rgb(197,27,125)" stop-opacity="1.0000"/>
<stop offset="11.11%" stop-color="rgb(197,27,125)" stop-opacity="1.0000"/>
<stop offset="11.11%" stop-color="rgb(222,119,174)" stop-opacity="1.0000"/>
<stop offset="22.22%" stop-color="rgb(222,119,174)" stop-opacity="1.0000"/>
<stop offset="22.22%" stop-color="rgb(241,182,218)" stop-opacity="1.0000"/>
<stop offset="33.33%" stop-color="rgb(241,182,218)" stop-opacity="1.0000"/>
<stop offset="33.33%" stop-color="rgb(253,224,239)" stop-opacity="1.0000"/>
<stop offset="44.44%" stop-color="rgb(253,224,239)" stop-opacity="1.0000"/>
<stop offset="44.44%" stop-color="rgb(247,247,247)" stop-opacity="1.0000"/>
<stop offset="55.56%" stop-color="rgb(247,247,247)" stop-opacity="1.0000"/>
<stop offset="55.56%" stop-color="rgb(230,245,208)" stop-opacity="1.0000"/>
<stop offset="66.67%" stop-color="rgb(230,245,208)" stop-opacity="1.0000"/>
<stop offset="66.67%" stop-color="rgb(184,225,134)" stop-opacity="1.0000"/>
<stop offset="77.78%" stop-color="rgb(184,225,134)" stop-opacity="1.0000"/>
<stop offset="77.78%" stop-color="rgb(127,188,65)" stop-opacity="1.0000"/>
<stop offset="88.89%" stop-color="rgb(127,188,65)" stop-opacity="1.0000"/>
<stop offset="88.89%" stop-color="rgb(77,146,33)" stop-opacity="1.0000"/>
<stop offset="100.00%" stop-color="rgb(77,146,33)" stop-opacity="1.0000"/>
</linearGradient>
<metadata>
<creator name="cptutils" version="1.44"/>
<created date="Tue Mar 13 13:12:23 2012"/>
</metadata>
</svg>
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<linearGradient id="PiYG_10" gradientUnits="objectBoundingBox" spreadMethod="pad" x1="0%" x2="100%" y1="0%" y2="100%">
<stop offset="0.00%" stop-color="rgb(142,1,82)" stop-opacity="1.0000"/>
<stop offset="10.00%" stop-color="rgb(142,1,82)" stop-opacity="1.0000"/>
<stop offset="10.00%" stop-color="rgb(197,27,125)" stop-opacity="1.0000"/>
<stop offset="20.00%" stop-color="rgb(197,27,125)" stop-opacity="1.0000"/>
<stop offset="20.00%" stop-color="rgb(222,119,174)" stop-opacity="1.0000"/>
<stop offset="30.00%" stop-color="rgb(222,119,174)" stop-opacity="1.0000"/>
<stop offset="30.00%" stop-color="rgb(241,182,218)" stop-opacity="1.0000"/>
<stop offset="40.00%" stop-color="rgb(241,182,218)" stop-opacity="1.0000"/>
<stop offset="40.00%" stop-color="rgb(253,224,239)" stop-opacity="1.0000"/>
<stop offset="50.00%" stop-color="rgb(253,224,239)" stop-opacity="1.0000"/>
<stop offset="50.00%" stop-color="rgb(230,245,208)" stop-opacity="1.0000"/>
<stop offset="60.00%" stop-color="rgb(230,245,208)" stop-opacity="1.0000"/>
<stop offset="60.00%" stop-color="rgb(184,225,134)" stop-opacity="1.0000"/>
<stop offset="70.00%" stop-color="rgb(184,225,134)" stop-opacity="1.0000"/>
<stop offset="70.00%" stop-color="rgb(127,188,65)" stop-opacity="1.0000"/>
<stop offset="80.00%" stop-color="rgb(127,188,65)" stop-opacity="1.0000"/>
<stop offset="80.00%" stop-color="rgb(77,146,33)" stop-opacity="1.0000"/>
<stop offset="90.00%" stop-color="rgb(77,146,33)" stop-opacity="1.0000"/>
<stop offset="90.00%" stop-color="rgb(39,100,25)" stop-opacity="1.0000"/>
<stop offset="100.00%" stop-color="rgb(39,100,25)" stop-opacity="1.0000"/>
</linearGradient>
<metadata>
<creator name="cptutils" version="1.44"/>
<created date="Tue Mar 13 13:12:22 2012"/>
</metadata>
</svg>

0 comments on commit 6861078

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