Jarry1250 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/156132
Change subject: Whitespace fixes and rm debug code
......................................................................
Whitespace fixes and rm debug code
Change-Id: I67234f11b4bef91314d52c2c5a05ac011a83caac
---
M SVGMessageGroup.php
M tests/data/Speech_bubbles.svg
M tests/phpunit/SVGFileTest.php
3 files changed, 100 insertions(+), 42 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslateSvg
refs/changes/32/156132/1
diff --git a/SVGMessageGroup.php b/SVGMessageGroup.php
index 2562baa..5642db4 100644
--- a/SVGMessageGroup.php
+++ b/SVGMessageGroup.php
@@ -30,7 +30,7 @@
$title = Title::newFromText( $filename, NS_FILE );
if( $title === null || !$title->exists() ) {
- throw new MWException( 'File not found ' . $filename );
+ throw new MWException( 'File not found' );
}
// Pick up normalisation
diff --git a/tests/data/Speech_bubbles.svg b/tests/data/Speech_bubbles.svg
index 6b1ef7a..dc64920 100644
--- a/tests/data/Speech_bubbles.svg
+++ b/tests/data/Speech_bubbles.svg
@@ -1,14 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="17.7cm"
height="13cm" id="svg2" version="1.1" inkscape:version="0.48.2 r9819"
sodipodi:docname="New document 1">
- <defs id="defs4"/>
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666"
borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2"
inkscape:zoom="0.7" inkscape:cx="296.43458" inkscape:cy="130.17435"
inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false"
fit-margin-top="0" fit-margin-left="0" fit-margin-right="0"
fit-margin-bottom="0" inkscape:window-width="1366" inkscape:window-height="706"
inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1"/>
- <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1"
transform="translate(-0.28125,-1.21875)">
- <switch
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"><text
xml:space="preserve" x="90" y="108.07646" id="text2985-de"
sodipodi:linespacing="125%" systemLanguage="de"><tspan text-decoration="normal"
font-style="normal" font-weight="normal"
id="tspan2987-de">Hallo!</tspan></text><text xml:space="preserve" x="90"
y="108.07646" id="text2985-fr" sodipodi:linespacing="125%"
systemLanguage="fr"><tspan x="80" y="108.07646" text-decoration="normal"
font-style="normal" font-weight="normal"
id="tspan2987-fr">Bonjour</tspan></text><text xml:space="preserve" x="90"
y="108.07646" id="text2985-nl" sodipodi:linespacing="125%" systemLanguage="nl,
tlh-ca"><tspan x="90" y="108.07646" text-decoration="normal"
font-style="normal" font-weight="normal"
id="tspan2987-nl">Hallo!</tspan></text><text xml:space="preserve" x="90"
y="108.07646" id="text2985" sodipodi:linespacing="125%"><tspan x="90"
y="108.07646" text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2987" sodipodi:role="line">Hello!</tspan></text></switch>
- <switch
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"><text
xml:space="preserve" x="330" y="188.07648" id="text2989-de"
sodipodi:linespacing="125%" systemLanguage="de"><tspan x="323" y="188.07648"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2991-de">Hallo! Wie</tspan><tspan x="350" y="238.07648"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2993-de" sodipodi:role="line">geht's?</tspan></text><text
xml:space="preserve" x="330" y="188.07648" id="text2989-fr"
sodipodi:linespacing="125%" systemLanguage="fr"><tspan x="335" y="188.07648"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2991-fr">Bonjour,</tspan><tspan x="350" y="238.07648"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2993-fr">ça va?</tspan></text><text xml:space="preserve" x="330"
y="188.07648" id="text2989-nl" sodipodi:linespacing="125%" systemLanguage="nl,
tlh-ca"><tspan x="310" y="188.07648" text-decoration="normal"
font-style="normal" font-weight="normal" id="tspan2991-nl">Hallo!
Hoe</tspan><tspan x="330" y="238.07648" text-decoration="normal"
font-style="normal" font-weight="normal" id="tspan2993-nl">gaat
het?</tspan></text><text xml:space="preserve" x="330" y="188.07648"
id="text2989" sodipodi:linespacing="125%"><tspan x="330" y="188.07648"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2991" sodipodi:role="line">Hello! How</tspan><tspan x="330"
y="238.07648" text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2993" sodipodi:role="line">are you?</tspan></text></switch>
- <switch
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"><text
xml:space="preserve" x="101.42857" y="318.64789" id="text2995-fr"
sodipodi:linespacing="125%" systemLanguage="fr"><tspan x="82" y="323"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2997-fr">Ça va bien,</tspan><tspan x="117.42857" y="368.64789"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2999-fr">et toi?</tspan></text><text xml:space="preserve"
x="101.42857" y="318.64789" id="text2995-nl" sodipodi:linespacing="125%"
systemLanguage="nl, tlh-ca"><tspan x="101.42857" y="318.64789"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2997-nl">Goed,</tspan><tspan x="101.42857" y="368.64789"
font-size="90%" text-decoration="normal" font-style="normal"
font-weight="normal" id="tspan2999-nl">met jou?</tspan></text><text
xml:space="preserve" x="101.42857" y="318.64789" id="text2995"
sodipodi:linespacing="125%"><tspan x="101.42857" y="318.64789"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2997" sodipodi:role="line">I'm well,</tspan><tspan x="101.42857"
y="368.64789" text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2999" sodipodi:role="line"> you?</tspan></text></switch>
+<defs id="defs4"/>
+<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666"
borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2"
inkscape:zoom="0.7" inkscape:cx="296.43458" inkscape:cy="130.17435"
inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false"
fit-margin-top="0" fit-margin-left="0" fit-margin-right="0"
fit-margin-bottom="0" inkscape:window-width="1366" inkscape:window-height="706"
inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1"/>
+<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1"
transform="translate(-0.28125,-1.21875)">
+ <switch
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans">
+ <text xml:space="preserve" x="90" y="108.07646" id="text2985-de"
sodipodi:linespacing="125%" systemLanguage="de"><tspan text-decoration="normal"
font-style="normal" font-weight="normal" id="tspan2987-de">Hallo!</tspan></text>
+ <text xml:space="preserve" x="90" y="108.07646" id="text2985-fr"
sodipodi:linespacing="125%" systemLanguage="fr"><tspan x="80" y="108.07646"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2987-fr">Bonjour</tspan></text>
+ <text xml:space="preserve" x="90" y="108.07646" id="text2985-nl"
sodipodi:linespacing="125%" systemLanguage="nl, tlh-ca"><tspan x="90"
y="108.07646" text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2987-nl">Hallo!</tspan></text>
+ <text xml:space="preserve" x="90" y="108.07646" id="text2985"
sodipodi:linespacing="125%"><tspan x="90" y="108.07646"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2987" sodipodi:role="line">Hello!</tspan></text>
+ </switch>
+ <switch
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans">
+ <text xml:space="preserve" x="330" y="188.07648" id="text2989-de"
sodipodi:linespacing="125%" systemLanguage="de"><tspan x="323" y="188.07648"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2991-de">Hallo! Wie</tspan><tspan x="350" y="238.07648"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2993-de" sodipodi:role="line">geht's?</tspan></text>
+ <text xml:space="preserve" x="330" y="188.07648" id="text2989-fr"
sodipodi:linespacing="125%" systemLanguage="fr"><tspan x="335" y="188.07648"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2991-fr">Bonjour,</tspan><tspan x="350" y="238.07648"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2993-fr">ça va?</tspan></text>
+ <text xml:space="preserve" x="330" y="188.07648" id="text2989-nl"
sodipodi:linespacing="125%" systemLanguage="nl,tlh-ca"><tspan x="310"
y="188.07648" text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2991-nl">Hallo! Hoe</tspan><tspan x="330" y="238.07648"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2993-nl">gaat het?</tspan></text>
+ <text xml:space="preserve" x="330" y="188.07648" id="text2989"
sodipodi:linespacing="125%"><tspan x="330" y="188.07648"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2991" sodipodi:role="line">Hello! How</tspan><tspan x="330"
y="238.07648" text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2993" sodipodi:role="line">are you?</tspan></text>
+ </switch>
+ <!-- Note that in this third set, the ? is moved outside the tspan. This
is deliberate. -->
+ <switch
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans">
+ <text xml:space="preserve" x="101.42857" y="318.64789"
id="text2995-fr" sodipodi:linespacing="125%" systemLanguage="fr"><tspan x="82"
y="323" text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2997-fr">Ça va bien,</tspan><tspan x="117.42857" y="368.64789"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2999-fr">et toi</tspan>?</text>
+ <text xml:space="preserve" x="101.42857" y="318.64789"
id="text2995-nl" sodipodi:linespacing="125%" systemLanguage="nl,tlh-ca"><tspan
x="101.42857" y="318.64789" text-decoration="normal" font-style="normal"
font-weight="normal" id="tspan2997-nl">Goed,</tspan><tspan x="101.42857"
y="368.64789" font-size="90%" text-decoration="normal" font-style="normal"
font-weight="normal" id="tspan2999-nl">met jou</tspan>?</text>
+ <text xml:space="preserve" x="101.42857" y="318.64789" id="text2995"
sodipodi:linespacing="125%"><tspan x="101.42857" y="318.64789"
text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2997" sodipodi:role="line">I'm well,</tspan><tspan x="101.42857"
y="368.64789" text-decoration="normal" font-style="normal" font-weight="normal"
id="tspan2999" sodipodi:role="line"> you</tspan>?</text>
+ </switch>
<path
style="color:#000000;fill:none;stroke:#808080;stroke-width:8.19999980999999960;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 145.41518,24.660714 c -54.439497,0 -98.562501,30.043022 -98.562501,67.125
0,9.936246 3.188468,19.358966 8.875,27.843746 -3.477405,24.25473 -24,58.71875
-24,58.71875 0,0 55.316401,-29.49598 68.544641,-28.55804 2.17169,0.15398
-0.660951,4.01645 -2.044641,0.93304 14.019951,5.22007 30.083661,8.21875
47.187501,8.21875 54.4395,0 98.59375,-30.07427 98.59375,-67.156246 0,-37.081978
-44.15425,-67.125 -98.59375,-67.125 z" id="path3769"
inkscape:connector-curvature="0" sodipodi:nodetypes="ssccscsss"/>
<path
style="color:#000000;fill:none;stroke:#808080;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 416.54255,99.214524 c 73.5252,0 133.11712,43.566276 133.11712,97.339926
0,14.40884 -4.3063,28.073 -11.98645,40.37703 4.69653,35.1725 32.41406,85.14978
32.41406,85.14978 0,0 -74.70955,-42.77297 -92.57542,-41.41284 -2.93306,0.22328
0.89266,5.82436 2.76145,1.35303 -18.93514,7.56977 -40.63057,11.91824
-63.73076,11.91824 -73.52523,0 -133.15935,-43.61157 -133.15935,-97.38524
0,-53.77365 59.63412,-97.339926 133.15935,-97.339926 z" id="path3769-1"
inkscape:connector-curvature="0" sodipodi:nodetypes="ssccscsss"/>
<path
style="color:#000000;fill:none;stroke:#808080;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 173.1621,250.34923 c -64.02996,0 -115.926026,34.29807
-115.926026,76.63201 0,11.34353 3.750173,22.1008 10.438488,31.7873
-4.090007,27.68997 -28.228023,67.03517 -28.228023,67.03517 0,0
65.061361,-33.67353 80.619991,-32.60275 2.55427,0.17578 -0.77738,4.5853
-2.40483,1.06519 16.4898,5.95939 35.38343,9.38278 55.5004,9.38278 64.02999,0
115.96279,-34.33373 115.96279,-76.66769 0,-42.33394 -51.9328,-76.63201
-115.96279,-76.63201 z" id="path3769-1-7" inkscape:connector-curvature="0"
sodipodi:nodetypes="ssccscsss"/>
- </g>
-</svg>
+</g>
+</svg>
\ No newline at end of file
diff --git a/tests/phpunit/SVGFileTest.php b/tests/phpunit/SVGFileTest.php
index 2e7de27..31727c8 100644
--- a/tests/phpunit/SVGFileTest.php
+++ b/tests/phpunit/SVGFileTest.php
@@ -26,17 +26,17 @@
}
public function testGetInFileTranslations() {
- $expected = array (
+ $expected = array(
'tspan2987' =>
- array (
+ array(
'de' =>
- array (
+ array(
'text' => 'Hallo!',
'id' => 'tspan2987-de',
'data-parent' =>
'text2985',
),
'fr' =>
- array (
+ array(
'text' => 'Bonjour',
'x' => '80',
'y' => '108.07646',
@@ -44,7 +44,7 @@
'data-parent' =>
'text2985',
),
'nl' =>
- array (
+ array(
'text' => 'Hallo!',
'x' => '90',
'y' => '108.07646',
@@ -52,7 +52,7 @@
'data-parent' =>
'text2985',
),
'tlh-ca' =>
- array (
+ array(
'text' => 'Hallo!',
'x' => '90',
'y' => '108.07646',
@@ -60,7 +60,7 @@
'data-parent' =>
'text2985',
),
'fallback' =>
- array (
+ array(
'text' => 'Hello!',
'x' => '90',
'y' => '108.07646',
@@ -70,9 +70,9 @@
),
),
'tspan2991' =>
- array (
+ array(
'de' =>
- array (
+ array(
'text' => 'Hallo! Wie',
'x' => '323',
'y' => '188.07648',
@@ -80,7 +80,7 @@
'data-parent' =>
'text2989',
),
'fr' =>
- array (
+ array(
'text' => 'Bonjour,',
'x' => '335',
'y' => '188.07648',
@@ -88,7 +88,7 @@
'data-parent' =>
'text2989',
),
'nl' =>
- array (
+ array(
'text' => 'Hallo! Hoe',
'x' => '310',
'y' => '188.07648',
@@ -96,7 +96,7 @@
'data-parent' =>
'text2989',
),
'tlh-ca' =>
- array (
+ array(
'text' => 'Hallo! Hoe',
'x' => '310',
'y' => '188.07648',
@@ -104,7 +104,7 @@
'data-parent' =>
'text2989',
),
'fallback' =>
- array (
+ array(
'text' => 'Hello! How',
'x' => '330',
'y' => '188.07648',
@@ -114,9 +114,9 @@
),
),
'tspan2993' =>
- array (
+ array(
'de' =>
- array (
+ array(
'text' => 'geht\'s?',
'x' => '350',
'y' => '238.07648',
@@ -125,7 +125,7 @@
'data-parent' =>
'text2989',
),
'fr' =>
- array (
+ array(
'text' => 'ça va?',
'x' => '350',
'y' => '238.07648',
@@ -133,7 +133,7 @@
'data-parent' =>
'text2989',
),
'nl' =>
- array (
+ array(
'text' => 'gaat het?',
'x' => '330',
'y' => '238.07648',
@@ -141,7 +141,7 @@
'data-parent' =>
'text2989',
),
'tlh-ca' =>
- array (
+ array(
'text' => 'gaat het?',
'x' => '330',
'y' => '238.07648',
@@ -149,7 +149,7 @@
'data-parent' =>
'text2989',
),
'fallback' =>
- array (
+ array(
'text' => 'are you?',
'x' => '330',
'y' => '238.07648',
@@ -159,9 +159,9 @@
),
),
'tspan2997' =>
- array (
+ array(
'fr' =>
- array (
+ array(
'text' => 'Ça va bien,',
'x' => '82',
'y' => '323',
@@ -169,7 +169,7 @@
'data-parent' =>
'text2995',
),
'nl' =>
- array (
+ array(
'text' => 'Goed,',
'x' => '101.42857',
'y' => '318.64789',
@@ -177,7 +177,7 @@
'data-parent' =>
'text2995',
),
'tlh-ca' =>
- array (
+ array(
'text' => 'Goed,',
'x' => '101.42857',
'y' => '318.64789',
@@ -185,7 +185,7 @@
'data-parent' =>
'text2995',
),
'fallback' =>
- array (
+ array(
'text' => 'I\'m well,',
'x' => '101.42857',
'y' => '318.64789',
@@ -195,18 +195,18 @@
),
),
'tspan2999' =>
- array (
+ array(
'fr' =>
- array (
- 'text' => 'et toi?',
+ array(
+ 'text' => 'et toi',
'x' => '117.42857',
'y' => '368.64789',
'id' => 'tspan2999-fr',
'data-parent' =>
'text2995',
),
'nl' =>
- array (
- 'text' => 'met jou?',
+ array(
+ 'text' => 'met jou',
'x' => '101.42857',
'y' => '368.64789',
'font-size' => '90%',
@@ -214,8 +214,8 @@
'data-parent' =>
'text2995',
),
'tlh-ca' =>
- array (
- 'text' => 'met jou?',
+ array(
+ 'text' => 'met jou',
'x' => '101.42857',
'y' => '368.64789',
'font-size' => '90%',
@@ -223,14 +223,57 @@
'data-parent' =>
'text2995',
),
'fallback' =>
- array (
- 'text' => ' you?',
+ array(
+ 'text' => ' you',
'x' => '101.42857',
'y' => '368.64789',
'id' => 'tspan2999',
'sodipodi:role' =>
'line',
'data-parent' =>
'text2995',
),
+ ),
+ 'text2995' =>
+ array(
+ 'fr' =>
+ array(
+ 'text' => '$1$2?',
+ 'xml:space' =>
'preserve',
+ 'x' => '101.42857',
+ 'y' => '318.64789',
+ 'id' => 'text2995-fr',
+ 'sodipodi:linespacing'
=> '125%',
+ 'data-children' =>
'tspan2997|tspan2999',
+ ),
+ 'nl' =>
+ array(
+ 'text' => '$1$2?',
+ 'xml:space' =>
'preserve',
+ 'x' => '101.42857',
+ 'y' => '318.64789',
+ 'id' => 'text2995-nl',
+ 'sodipodi:linespacing'
=> '125%',
+ 'data-children' =>
'tspan2997|tspan2999',
+ ),
+ 'tlh-ca' =>
+ array(
+ 'text' => '$1$2?',
+ 'xml:space' =>
'preserve',
+ 'x' => '101.42857',
+ 'y' => '318.64789',
+ 'id' => 'text2995-nl',
+ 'sodipodi:linespacing'
=> '125%',
+ 'data-children' =>
'tspan2997|tspan2999',
+ ),
+ 'fallback' =>
+ array(
+ 'text' => '$1$2?',
+ 'xml:space' =>
'preserve',
+ 'x' => '101.42857',
+ 'y' => '318.64789',
+ 'id' => 'text2995',
+ 'sodipodi:linespacing'
=> '125%',
+ 'data-children' =>
'tspan2997|tspan2999',
+ )
)
);
$this->assertEquals( $expected,
$this->svg->getInFileTranslations() );
--
To view, visit https://gerrit.wikimedia.org/r/156132
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I67234f11b4bef91314d52c2c5a05ac011a83caac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TranslateSvg
Gerrit-Branch: master
Gerrit-Owner: Jarry1250 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits