@@ -83,7 +83,7 @@ void TestStyleV2::initTestCase()
83
83
// mStyle->clear();
84
84
85
85
// cpt-city ramp, small selection available in <testdir>/cpt-city
86
- QgsCptCityCollection::initCollection ( DEFAULT_CPTCITY_COLLECTION, mTestDataDir + " cpt-city " );
86
+ QgsCptCityCollection::initCollections ( );
87
87
}
88
88
89
89
void TestStyleV2::cleanupTestCase ()
@@ -124,17 +124,15 @@ void TestStyleV2::testCreateColorRamps()
124
124
QgsVectorColorBrewerColorRampV2* cb2Ramp = new QgsVectorColorBrewerColorRampV2 ( " RdYlGn" , 6 );
125
125
QVERIFY ( mStyle ->addColorRamp ( " test_cb2" , cb2Ramp ) );
126
126
127
- // if ( QgsCptCityColorRampV2::hasBasicSchemes() )
128
- // {
129
- QgsCptCityColorRampV2* cc1Ramp = new QgsCptCityColorRampV2 ( " jjg/misc/temperature" , " " );
127
+ // discrete ramp with no variant
128
+ QgsCptCityColorRampV2* cc1Ramp = new QgsCptCityColorRampV2 ( " cb/seq/PuBuGn_06" , " " );
130
129
QVERIFY ( mStyle ->addColorRamp ( " test_cc1" , cc1Ramp ) );
130
+ // discrete ramp with variant
131
131
QgsCptCityColorRampV2* cc2Ramp = new QgsCptCityColorRampV2 ( " cb/div/PiYG" , " _10" );
132
132
QVERIFY ( mStyle ->addColorRamp ( " test_cc2" , cc2Ramp ) );
133
- // }
134
- // else
135
- // {
136
- // QWARN( "cpt-city support files not found - skipping cpt-city color ramp tests" );
137
- // }
133
+ // continuous ramp
134
+ QgsCptCityColorRampV2* cc3Ramp = new QgsCptCityColorRampV2 ( " grass/byr" , " " );
135
+ QVERIFY ( mStyle ->addColorRamp ( " test_cc3" , cc3Ramp ) );
138
136
}
139
137
140
138
void TestStyleV2::testLoadColorRamps ()
@@ -155,15 +153,15 @@ void TestStyleV2::testLoadColorRamps()
155
153
colorTests.insert ( " test_cb2" , qMakePair ( 0.66 , QColor ( " #d9ef8b" ) ) );
156
154
157
155
// cpt-city
158
- // if ( QgsCptCityColorRampV2::hasAllSchemes() )
159
- // {
160
156
colorRampsTest << " test_cc1" ;
161
- colorTests.insert ( " test_cc1" , qMakePair ( 0.25 , QColor ( " #466fcf " ) ) );
162
- colorTests.insert ( " test_cc1" , qMakePair ( 0.66 , QColor ( " #dbc85b " ) ) );
157
+ colorTests.insert ( " test_cc1" , qMakePair ( 0.25 , QColor ( " #d0d1e6 " ) ) );
158
+ colorTests.insert ( " test_cc1" , qMakePair ( 0.66 , QColor ( " #67a9cf " ) ) );
163
159
colorRampsTest << " test_cc2" ;
164
160
colorTests.insert ( " test_cc2" , qMakePair ( 0.25 , QColor ( " #de77ae" ) ) );
165
161
colorTests.insert ( " test_cc2" , qMakePair ( 0.66 , QColor ( " #b8e186" ) ) );
166
- // }
162
+ colorRampsTest << " test_cc3" ;
163
+ colorTests.insert ( " test_cc3" , qMakePair ( 0.25 , QColor ( " #7f7f7f" ) ) );
164
+ colorTests.insert ( " test_cc3" , qMakePair ( 0.66 , QColor ( " #ffad00" ) ) );
167
165
168
166
foreach ( QString name, colorRampsTest )
169
167
{
@@ -187,7 +185,7 @@ void TestStyleV2::testLoadColorRamps()
187
185
188
186
void TestStyleV2::testSaveLoad ()
189
187
{
190
- #if 0
188
+ // #if 0
191
189
mStyle ->save ();
192
190
mStyle ->clear ();
193
191
mStyle ->load ( QgsApplication::userStyleV2Path () );
@@ -204,7 +202,9 @@ void TestStyleV2::testSaveLoad()
204
202
if ( ramp )
205
203
delete ramp;
206
204
}
207
- #endif
205
+ // test color ramps again
206
+ testLoadColorRamps ();
207
+ // #endif
208
208
}
209
209
210
210
0 commit comments