summaryrefslogtreecommitdiffstats
path: root/testfiles
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2019-01-02 09:41:30 +0000
committerMarc Jeanmougin <marc@jeanmougin.fr>2019-01-02 09:41:30 +0000
commit169dff19d4da8d76e69b8e896aa25b0013639c03 (patch)
treea0c070fa95188b5cde708ac285e6a2db9df4a83f /testfiles
parentAvoid creating a new document before opening an old document. (diff)
downloadinkscape-169dff19d4da8d76e69b8e896aa25b0013639c03.tar.gz
inkscape-169dff19d4da8d76e69b8e896aa25b0013639c03.zip
modernize loops
Diffstat (limited to 'testfiles')
-rw-r--r--testfiles/src/attributes-test.cpp4
-rw-r--r--testfiles/src/color-profile-test.cpp18
-rw-r--r--testfiles/src/dir-util-test.cpp8
3 files changed, 15 insertions, 15 deletions
diff --git a/testfiles/src/attributes-test.cpp b/testfiles/src/attributes-test.cpp
index 7b3be37bd..ae933611d 100644
--- a/testfiles/src/attributes-test.cpp
+++ b/testfiles/src/attributes-test.cpp
@@ -548,8 +548,8 @@ std::vector<size_t> getIdIds()
std::vector<size_t> ids;
std::vector<AttributeInfo> all_attrs = getKnownAttrs();
ids.reserve(all_attrs.size()); // minimize memory thrashing
- for (AttrItr it(all_attrs.begin()); it != all_attrs.end(); ++it) {
- auto id = sp_attribute_lookup(it->attr.c_str());
+ for (auto & all_attr : all_attrs) {
+ auto id = sp_attribute_lookup(all_attr.attr.c_str());
if (id >= ids.size()) {
ids.resize(id + 1);
}
diff --git a/testfiles/src/color-profile-test.cpp b/testfiles/src/color-profile-test.cpp
index dcee8427a..4ed8b3655 100644
--- a/testfiles/src/color-profile-test.cpp
+++ b/testfiles/src/color-profile-test.cpp
@@ -70,9 +70,9 @@ TEST_F(ColorProfileTest, SetRenderingIntent)
{"auto2", (guint)Inkscape::RENDERING_INTENT_UNKNOWN},
};
- for ( size_t i = 0; i < G_N_ELEMENTS( cases ); i++ ) {
- _prof->setKeyValue( SP_ATTR_RENDERING_INTENT, cases[i].attr);
- ASSERT_EQ( (guint)cases[i].intVal, _prof->rendering_intent ) << cases[i].attr;
+ for (auto i : cases) {
+ _prof->setKeyValue( SP_ATTR_RENDERING_INTENT, i.attr);
+ ASSERT_EQ( (guint)i.intVal, _prof->rendering_intent ) << i.attr;
}
}
@@ -83,11 +83,11 @@ TEST_F(ColorProfileTest, SetLocal)
"something",
};
- for ( size_t i = 0; i < G_N_ELEMENTS( cases ); i++ ) {
- _prof->setKeyValue( SP_ATTR_LOCAL, cases[i]);
+ for (auto & i : cases) {
+ _prof->setKeyValue( SP_ATTR_LOCAL, i);
ASSERT_TRUE( _prof->local != NULL );
if ( _prof->local ) {
- ASSERT_EQ( std::string(cases[i]), _prof->local );
+ ASSERT_EQ( std::string(i), _prof->local );
}
}
_prof->setKeyValue( SP_ATTR_LOCAL, NULL);
@@ -101,11 +101,11 @@ TEST_F(ColorProfileTest, SetName)
"something",
};
- for ( size_t i = 0; i < G_N_ELEMENTS( cases ); i++ ) {
- _prof->setKeyValue( SP_ATTR_NAME, cases[i]);
+ for (auto & i : cases) {
+ _prof->setKeyValue( SP_ATTR_NAME, i);
ASSERT_TRUE( _prof->name != NULL );
if ( _prof->name ) {
- ASSERT_EQ( std::string(cases[i]), _prof->name );
+ ASSERT_EQ( std::string(i), _prof->name );
}
}
_prof->setKeyValue( SP_ATTR_NAME, NULL );
diff --git a/testfiles/src/dir-util-test.cpp b/testfiles/src/dir-util-test.cpp
index 25081771a..bac5e3cc2 100644
--- a/testfiles/src/dir-util-test.cpp
+++ b/testfiles/src/dir-util-test.cpp
@@ -37,14 +37,14 @@ TEST(DirUtilTest, Base)
#endif
};
- for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ )
+ for (auto & i : cases)
{
- if ( cases[i][0] && cases[i][1] ) { // std::string can't use null.
- std::string result = sp_relative_path_from_path( cases[i][0], cases[i][1] );
+ if ( i[0] && i[1] ) { // std::string can't use null.
+ std::string result = sp_relative_path_from_path( i[0], i[1] );
ASSERT_FALSE( result.empty() );
if ( !result.empty() )
{
- ASSERT_EQ( std::string(cases[i][2]), result );
+ ASSERT_EQ( std::string(i[2]), result );
}
}
}