Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
18c1b3bf
Commit
18c1b3bf
authored
Nov 17, 2016
by
Tebjan Halm
Committed by
GitHub
Nov 17, 2016
Browse files
Merge pull request #251 from sovietmagic/master
SvgPointCollection ToString method fix
parents
6fa3f29a
c5369109
Changes
3
Hide whitespace changes
Inline
Side-by-side
Source/DataTypes/SvgPointCollection.cs
View file @
18c1b3bf
...
...
@@ -15,13 +15,22 @@ namespace Svg
{
public
override
string
ToString
()
{
string
ret
=
""
;
for
each
(
var
unit
in
this
)
var
builder
=
new
StringBuilder
()
;
for
(
var
i
=
0
;
i
<
Count
;
i
+=
2
)
{
ret
+=
unit
.
ToString
()
+
" "
;
if
(
i
+
1
<
Count
)
{
if
(
i
>
1
)
{
builder
.
Append
(
" "
);
}
// we don't need unit type
builder
.
Append
(
this
[
i
].
Value
.
ToString
(
CultureInfo
.
InvariantCulture
));
builder
.
Append
(
","
);
builder
.
Append
(
this
[
i
+
1
].
Value
.
ToString
(
CultureInfo
.
InvariantCulture
));
}
}
return
ret
;
return
builder
.
ToString
();
}
}
...
...
Tests/Svg.UnitTests/Svg.UnitTests.csproj
View file @
18c1b3bf
...
...
@@ -62,6 +62,7 @@
<Compile
Include=
"PrivateFontsTests.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"SmallEmbeddingImageTest.cs"
/>
<Compile
Include=
"SvgPointCollectionTests.cs"
/>
<Compile
Include=
"SvgTestHelper.cs"
/>
</ItemGroup>
<ItemGroup>
...
...
Tests/Svg.UnitTests/SvgPointCollectionTests.cs
0 → 100644
View file @
18c1b3bf
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
namespace
Svg.UnitTests
{
[
TestClass
]
public
class
SvgPointCollectionTests
{
[
TestMethod
]
public
void
ToStringReturnsValidString
()
{
var
collection
=
new
SvgPointCollection
{
new
SvgUnit
(
1.6f
),
new
SvgUnit
(
3.2f
),
new
SvgUnit
(
1.2f
),
new
SvgUnit
(
5f
)
};
Assert
.
AreEqual
(
"1.6,3.2 1.2,5"
,
collection
.
ToString
());
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment