Skip to content

Commit

Permalink
Item13388: Item13331: Add test cases for utf8 rendering
Browse files Browse the repository at this point in the history
Thanks to JozefMojzis for putting together these test topics.
  • Loading branch information
gac410 authored and Comment committed May 7, 2015
1 parent 08f0164 commit 6e027c7
Show file tree
Hide file tree
Showing 3 changed files with 431 additions and 0 deletions.
244 changes: 244 additions & 0 deletions core/data/TestCases/TestCaseUtf8Errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1430878946" format="1.1" version="1"}%
%META:TOPICPARENT{name="WebHome"}%
---+ %TOPIC% - Errors: <span id="totalerror"></span>

<!--

-->

---++ Demo of *some* UTF8 errors

View the topic with System.EditRowPlugin disabled, and the utf8 text is rendered
correctly. [[%TOPIC%?debugenableplugins=JQueryPlugin][Click here to reload this topic with only the JQueryPlugin enabled]].


%TOC%

---++ Json output from a QUERY áěśňž

| *Testname* | *Wanted* | *Actual* | *Result* |
| Q-plain | %PLTWL1%,%PUTWL1%,%PWTWL1%,%PTTWL1% | %QUERY{"preferences[name =~ 'TWL1'].value"}% | :FWTEST: |
| Q-json | ["%PLTWL1%","%PUTWL1%","%PWTWL1%","%PTTWL1%"] | %QUERY{"preferences[name =~ 'TWL1'].value" style="json"}% | :FWTEST: |

---++ Regex QUERY - fails for character classes and case comparisons too...
| *Testname* | *Wanted* | *Actual* | *Result* |
| asc-re2: /AbCdefgh/ =~ /\wCde\w/ | 1 | %QUERY{"preferences[name='PWTWA1'].value =~ '\wCde\w'"}% | :FWTEST: |
| asc-re3: /AbCdefgh/ =~ /(?i)cDE/ | 1 | %QUERY{"preferences[name='PWTWA1'].value =~ '(?i)cDE'"}% | :FWTEST: |
| asc-re4: /AbCdefgh/ =~ /[<nop>[:upper:]]/ | 1 | %QUERY{"preferences[name='PWTWA1'].value =~ '[[:upper:]]'"}% | :FWTEST: |
| utf-re2: /ÌæĈąṁēńã/ =~ /\wĈąṁ\w/ | 1 | %QUERY{"preferences[name='PWTWL1'].value =~ '\wĈąṁ\w'"}% | :FWTEST: |
| utf-re3: /ÌæĈąṁēńã/ =~ /(?i)ĉĄṀ/ | 1 | %QUERY{"preferences[name='PWTWL1'].value =~ '(?i)ĉĄṀ'"}% | :FWTEST: |
| utf-re4: /ÌæĈąṁēńã/ =~ /[<nop>[:upper:]]/ | 1 | %QUERY{"preferences[name='PWTWL1'].value =~ '[[:upper:]]'"}% | :FWTEST: |

---++ QUERY lc/uc - fails
| *Testname* | *Wanted* | *Actual* | *Result* |
| WTWA1: lc(%PWTWA1%) | %PLTWA1% | %QUERY{"lc(preferences[name='PWTWA1'].value)"}% | :FWTEST: |
| WTWA1: uc(%PWTWA1%) | %PUTWA1% | %QUERY{"uc(preferences[name='PWTWA1'].value)"}% | :FWTEST: |
| WTWL1: lc(%PWTWL1%) | %PLTWL1% | %QUERY{"lc(preferences[name='PWTWL1'].value)"}% | :FWTEST: |
| WTWL1: uc(%PWTWL1%) | %PUTWL1% | %QUERY{"uc(preferences[name='PWTWL1'].value)"}% | :FWTEST: |

---++ SEARCH with regex containing character classes such \w
| *Testname* | *Wanted* | *Actual* | *Result* |
| search for =\dxx= <br> _$pattern_ regex charclass<br> =\w*xx\w*= | abc1xxdef,áčž2xxøđß,ábc3xxdeš,qwe4xxuio | %SEARCH{ "\dxx" type="regex" nonoise="on" topic="%TOPIC%" multiple="on" separator="," format="$pattern(.*?(\w*xx\w*).*)" }% | :FWTEST: |
| Besides the =\w= regex error, I actually don't understand why found the string =<nop>d<nop>x<nop>x<nop>= too. The regex contais the =\d= as a character class. ||||

---++ Calc ERRORS (many string operation - examples (here are more))
| *Test* | *Wanted* | *Actual* | *Result* |
| %<nop>CALC{"$FIND(e, abcdefgh, 2)"}% | 5 | %CALC{"$FIND(e, abcdefgh, 2)"}% | :FWTEST: |
| %<nop>CALC{"$FIND(ó, śõñļóțķụ, 2)"}% | 5 | %CALC{"$FIND(ó, śõñļóțķụ, 2)"}% | :FWTEST: |
| %<nop>CALC{"$INSERTSTRING(abcdef, 3, XYZ)"}% | abcXYZdef | %CALC{"$INSERTSTRING(abcdef, 3, XYZ)"}% | :FWTEST: |
| %<nop>CALC{"$INSERTSTRING(áśčśěž, 3, ÁŠŤ)"}% | áśčÁŠŤśěž | %CALC{"$INSERTSTRING(áśčśěž, 3, ÁŠŤ)"}% | :FWTEST: |
| %<nop>CALC{"$LEFTSTRING(abcdefg, 5)"}% | abcde | %CALC{"$LEFTSTRING(abcdefg, 5)"}% | :FWTEST: |
| %<nop>CALC{"$LEFTSTRING(áśčśěžů, 5)"}% | áśčśě | %CALC{"$LEFTSTRING(áśčśěžů, 5)"}% | :FWTEST: |
| %<nop>CALC{"$LOWER(TEXT)"}% | text | %CALC{"$LOWER(TEXT)"}% | :FWTEST: |
| %<nop>CALC{"$LOWER(ÁĚŠŤ)"}% | áěšť | %CALC{"$LOWER(ÁĚŠŤ)"}% | :FWTEST: |
| %<nop>CALC{"$PROPER(a small STEP)"}% | A Small Step | %CALC{"$PROPER(a small STEP)"}% | :FWTEST: |
| %<nop>CALC{"$PROPER(á šňáĺľ ŠŤĚŘ)"}% | Á Šňáĺľ Šťěř | %CALC{"$PROPER(á šňáĺľ ŠŤĚŘ)"}% | :FWTEST: |
| %<nop>CALC{"$REPLACE(acdeilnorsz, 6, 5, $comma)"}% | acdei,z | %CALC{"$REPLACE(acdeilnorsz, 6, 5, $comma)"}% | :FWTEST: |
| %<nop>CALC{"$REPLACE(áčďéíľňóŕšž, 6, 5, $comma)"}% | áčďéí,ž | %CALC{"$REPLACE(áčďéíľňóŕšž, 6, 5, $comma)"}% | :FWTEST: |
| %<nop>CALC{"$TRANSLATE(boom,bm,cl)"}% | cool | %CALC{"$TRANSLATE(boom,bm,cl)"}% | :FWTEST: |
| %<nop>CALC{"$TRANSLATE(cumi,ci,čí)"}% | čumí | %CALC{"$TRANSLATE(cumi,ci,čí)"}% | :FWTEST: |
| %<nop>CALC{"$TRANSLATE(čumí,čí,ci)"}% | cumi | %CALC{"$TRANSLATE(čumí,čí,ci)"}% | :FWTEST: |

------
---++ Non critical (but annoying) errors
The table sorting doesn't sorts by the accented characters. For
this will be need to use *utf8 + locale* based sorting, what is
correctly available only from perl v5.20 (using an special pragma
usable from v.5.16).

Try: sort by the *Dolořęṁ* column.

%TABLE{ sort="on" tableborder="0" cellpadding="4" cellspacing="3" cellborder="0" headerbg="#D5CCB1" headercolor="#666" databg="#FAF0D4, #F3DFA8" headerrows="2" footerrows="1" }%
| *Přovìḋěṅṫ ôfḟiçîâ ñiĥìĺ perśṗįčiaṫîs quideṁ dųčïṁúṡ* ||||||
| *Nìsi* | *Aḻíqúid* | *Dolořęṁ* | *Fáčërę* | *Omņįs* | *Iṗsuṁ* |
| 1 | C | Ňuíă ñaťùs coňšêqúatúř | John | 1-Dec-02 | |
| 2 | X | Řelease | John | 1-Apr-02 | |
| 3 | | Get feedback | Anne | 1-Feb-02 | |
| 12 | C | Špec error handling | Jack | 1-Dec-02 | |
| 5 | | Ábc | John | | |
| *Nìsi* | *Aḻíqúid* | *Dolořęṁ* | *Fáčërę* | *Omņįs* | *Iṗsuṁ* |

The =%<nop>SPACEOUT{"SomeUtfText"}%= won't add spaces even if the Uppercases are ASCII.
=%<nop>SPACEOUT{"UśđáṁAŝșūṁėṉďáCøṅŝêĉṫēťúŕDøḻóř" separator=", "}%=
%SPACEOUT{"UśđáṁAŝșūṁėṉďáCøṅŝêĉṫēťúŕDøḻóř" separator=", "}%

---+ Strange Errors
---++ EDITTABLE
The following *NOT utf8* table using the %<nop>EDITTABLE% (copy
from the System.EditRowPlugin), screws the normal Utf8 topic text.
(also somewhat changes the width of the previous table).

%EDITTABLE{ format="| row, -1 | text, 20, init | select, 1, not started, starting, ongoing, completed | radio, 3,:-),:-I,:-( | date, 20 |" changerows="on" quietsave="on"}%
| *Nr* | *Project* | *State* | *Progress* | *Timestamp* |
| 1 | Sliced yoghourt | completed | :-) | 26 Jun 2002 |
| 2 | Cubical turkeys | not started | :-( | 27 Oct 2007 |
| 3 | Self-eating burritos | ongoing | :-D | 1 Apr 2008 |
| 4 | Unified field theory | completed | :-) | 1 Apr 2012 |

%STARTSECTION{"utf8text"}%
---+ Demo utf8 topic text
---++ Mixed ASCII and Utf8
Quìđem a ďeleçțus ăĺíãs. Aĺiăş líbêró âčcúsamŭs în éxêŕćíťaṫìọṉeṁ disțìňcțio. Qùoš susćịṗit hìc fųgīt āút țempořa vòlūṗṫaťěş. Nihïl eligěndí řëṁ facilis ḟùgă. Ràțíońě ḃļåņdiṫiiṡ laboruṁ qùīs ŕeřųṁ. Fåcịļiş ŭllåm śuṅṫ a. Eț ḋölőŕę èa íṫaque a nòñ cőŕŕuṗṫì pròvîdeñț ducīmüş. Sinť qűø accusåńtiuṁ àrcĥiṫëčto ṁağñi qůị ñisí. Fụģiàṫ qụae oḟḟįciiš ḋiĉta voĺuṗtáțem.

---+++ Sïṁîḻīqųē éț äůț ąśśùṁěṅďă
Sêqui dòĺórém ḟụģìt molļîṫīã òmnis. Sụṅť quãsí ręṗudịanđae õćcåęcatï
ṁołlitia įṗšam. Hic fuga iurë ėarum qŭo arcĥīťèctò. Aütem nątüṡ
ḃëàtãe ęț eaqųë. Rėrụṁ êā répřehëṅdeřïť āĺiqŭám ēšť bêătâe eă deḃitis
omnīs. Añimi vįțaê volụṗṫaṫëṁ ofḟiĉiis. Ađipiscį ḋóĺõřęmqùe éṫ
vọlüptatụṁ. Práèşēntiuṁ ęiuș ḟačere eṫ esț cörrŭpțị àțquè. Nôstruṁ
esť ïṁṗeďïț ařchïtęçțø dïģnissiṁóś pêrḟeŕeṉdis. Súscïpiť oṁṅis
ęxĉepturi ãd ṉïĥįļ oḟfičia oṁnis ñám acčusàńťiům.

Siť vołupťäțùm ṡụšcïṗìt řérúṁ eñíṁ ët qúia võlŭptåțem. Istė eòŝ
veŕo ṫęṁṗóre qűia nihiľ ařċhìtêctọ døľořěṁquë. Quì asperṉățúr
dișțínćtio ņọn. Tøtàm ēűm şapiėṉťě ńëquè mõļėștiäe īđ ēt eoś
ṗérḟèreṉdiŝ. Suňt qui undē sūnt voluptäș åspêrnåtűr nequė ëlïgëndị
quï. Et diĝníšșimos ċulṗa pāřįáťűř üt nuṁquâm. Harŭm ċoṅšéqŭaṫuř
voļűṗťãṡ aċćuşamuş rąțìonė ḃeatäė. Añimî éx ćoṅsêċtetúŕ âlīqųîḋ îṅ
řatįoņé. Eṫ šéd iuşṫo ćónseqụațuř ēt eť recuṡandäe.

---+++Qùí ļãḃôřîőšåṁ đøľôřüṁ
Dolorěṁ dêḻêcťůṡ iľļó áńįṁị îpşaṁ auṫ. Sapìëňte possiṁuś ratìoňe
ļaboŕįõsām ĥįc ṗariatúř ëť. Rerụṁ ìṫaqūė excēpțuři ńeṁọ vọḻuṗťaś
volŭṗtaş aüteṁ ratiòne ńéṡcîuṉț. Mødí qúø veḻîṫ saèpe ŕēpelĺènḋuś
eť. Culṗă ṗraēsēńtium vero äb ödïo. Vero ċőrṗöŕīŝ doļőŕ ḋůċimus
ḻàḃorum ódio paríatur quia. Reịçîêndįṡ eț pāřiatūr omṅis. Consěqúatůr
íṁpedįť ćòṅsēquatuř quăși. Cöňseqųaṫùr dīștinçtío nëṁó ịste.

Voḻŭṗťas illo rèćusandaė ęt dįcťã nôṉ qųaŝ qui pørŕo. Iṗsűm ñọn
iŝte võłůpṫáțųṁ. Unde qùo űť cumque ṗerḟeŕenḋiš ďiĝnisšįmoş et.
Vọľuptațèṁ ňịĥil ďọļôr doloř ešť verītátïş. Uńdē ĥìc ēūm viṫae ut
oṁñịș ďọloř. Dọlõrėm ṗerfërêndìș miňus řąťìọnë exṗlićåḃo. Temṗọrá
nôbîs teṁpore pariaṫůr et. Voľuptáțê ṫenetur omniš est áụt eĺigendi.
Quí vèlit ea moĺlìṫiā qụişqüãṁ möĺeštîaë đebitîṡ veĺit năṁ.

---++ Words containing NO ASCII
ìæĉąṁēńã ÌÆĈĄṀĒŃÃ ÌæĈąṁēńã Ìæĉąṁēńã ṅḃḻġåŵâê ṄḂḺĠÅŴÂÊ ṄḃḺġåŵâê
Ṅḃḻġåŵâê śõñļóțķụ ŚÕÑĻÓȚĶỤ ŚõÑļóțķụ Śõñļóțķụ ŕŭųùňůžú ŔŬŲÙŇŮŽÚ
ŔŭŲùňůžú Ŕŭųùňůžú ģšěòðĥğü ĢŠĚÒÐĤĞÜ ĢšĚòðĥğü Ģšěòðĥğü áċíņűäıṡ
ÁĊÍŅŰÄṠÁ ċÍņűäıṡÁ ċíņűäıṡř ḟľşôèọťŘ ḞĽŞÔÈỌŤŘ ḟĽşôèọťŘ ḟľşôèọťć
ėṫįșīłöĆ ĖṪĮȘĪŁÖĆ ėṪįșīłöĆ ėṫįșīłöṉ ëęźŝịĝçṈ ËĘŹŜỊĜÇṈ ëĘźŝịĝçṈ
ëęźŝịĝçĺ éýăþàčœĹ ÉÝĂÞÀČŒĹ éÝăþàčœĹ éýăþàčœż ūāîïŷḋĵŻ ŪĀÎÏŶḊĴŻ
ūĀîïŷḋĵŻ ūāîïŷḋĵő ṗďøđßŐṖĎ ØĐŐṗĎøđß Őṗďøđß

---++ List for the SEARCH test
%RENDERLIST{"thread"}%
* Lístóň
* abc1xxdef
* áčž2xxøđß
* ábc3xxdeš
* qwe4xxuio

%ENDSECTION{"utf8text"}%

---++ JSchecker
The topic uses some JQUERY script to compare the =wanted= and =actual= values. Here is the source:
<pre>
%INCLUDE{"%TOPIC%" section="jschecker" raw=on}%
</pre>

-----
---+ Comments

%COMMENT%

-----

<verbatim style="display:none">
%STARTSECTION{"wellhidden"}%
Oṁṉíş ñïĥịļ õďìṫ qūíḃűșđãṁ ôṁńîş đēḻęćṫùş ėńíṁ đõľõř ťöțâṁ. Eöṡ
ćõņśēqūāṫŭř ṡėḋ īď ṁọłėṡṫïąę èṫ. Qùí ļãḃôřîőšåṁ đøľôřüṁ ēť qűīá
qŭíḃŭśđáṁ åŝșūṁėṉďá ċøṅŝêĉṫēťúŕ đøḻóř.

Eüṁ vòĺůṗťățịḃùṡ vọḻůṗťàțèș vęĺ ůț ãŝšűṁêńďã ŕęṁ. Côńśėčṫêṫụŕ śėď
ïūşțő áṁèț ṅäṁ. Mõļēșťīāė āųṫ ĉõřřùṗṫī ḟâçęřē ṫěṁṗôŕě qűī ęť úņđè.
Sëđ ėśț àṡṗėřṉáțųŕ qŭọď òḟḟîćïìş qūï đõļøŕēṁ. Uṫ șíṁīļíqūë śāěṗę
qųí øđịö. Dįğñïšśįṁóṡ ďóĺôřěṁ võľüṗṫäťëś qúị.

Láḃôŕīôșąṁ ńèċēŝşīțąțìḃüŝ qŭịṡ éşț qŭî ṁïṅịṁå vóļụṗťãťěṁ. Vọļụṗṫāťŭṁ
ṗõŕřọ ěxṗľïčăḃõ ŕèŕūṁ qŭī qụòđ qųô. Ițáqùē ñịšị üṫ šíṅț ṅøḃįŝ ăụť.
Eļîğéńďị àṫqųė vëřọ ṗāŕìäțūŕ ịṗșą.
%ENDSECTION{"wellhidden"}%
</verbatim>


<script type='text/javascript'>
%STARTSECTION{"jschecker"}%
// for the each table row try to find a text :FWTEST:
// if found, takes two previous cells and compares them
// and replace the :FWTEST: with the result of the compare.
$(document).ready(function() {
var toterr = 0;
$('tbody tr').each(function () {
var $cells = $(this).children(),
$cmp = $cells.filter(':contains(":FWTEST:")'),
cmpIndex = $cells.index($cmp);
if( cmpIndex >= 2 ) {
// array of values of previous cells
var values = $.map($cells.slice(cmpIndex - 2, cmpIndex), function (el) {
//return $.trim($(el).text()); //trimmed text
//return $(el).html(); //not trimmed html
return $.trim($(el).html()); //in most cases want compare with html too, but with trimmed spaces
});
// make sure we have 2 cells with values and compare
if( values.length === 2 ) {
if( values[0] === values[1] ) {
$cmp.text('OK');
}
else {
$cmp.text('ERROR').css('color','red');
toterr++;
}
}
}
});
$('#totalerror').text(toterr);
});
%ENDSECTION{"jschecker"}%
</script>

%META:PREFERENCE{name="NOWYSIWYG" title="NOWYSIWYG" type="Set" value="on"}%
%META:PREFERENCE{name="PLTWA1" title="LTWA1" type="Set" value="abcdefgh"}%
%META:PREFERENCE{name="PUTWA1" title="UTWA1" type="Set" value="ABCDEFGH"}%
%META:PREFERENCE{name="PWTWA1" title="WTWA1" type="Set" value="AbCdefgh"}%
%META:PREFERENCE{name="PTTWA1" title="TTWA1" type="Set" value="Abcdefgh"}%
%META:PREFERENCE{name="PLTWL1" title="LTWL1" type="Set" value="ìæĉąṁēńã"}%
%META:PREFERENCE{name="PUTWL1" title="UTWL1" type="Set" value="ÌÆĈĄṀĒŃÃ"}%
%META:PREFERENCE{name="PWTWL1" title="WTWL1" type="Set" value="ÌæĈąṁēńã"}%
%META:PREFERENCE{name="PTTWL1" title="TTWL1" type="Set" value="Ìæĉąṁēńã"}%
%META:PREFERENCE{name="PLTWL2" title="LTWL2" type="Set" value="ṅḃḻġåŵâê"}%
%META:PREFERENCE{name="PUTWL2" title="UTWL2" type="Set" value="ṄḂḺĠÅŴÂÊ"}%
%META:PREFERENCE{name="PWTWL2" title="WTWL2" type="Set" value="ṄḃḺġåŵâê"}%
%META:PREFERENCE{name="PTTWL2" title="TTWL2" type="Set" value="Ṅḃḻġåŵâê"}%
%META:PREFERENCE{name="PLTWL3" title="LTWL3" type="Set" value="śõñļóțķụ"}%
%META:PREFERENCE{name="PUTWL3" title="UTWL3" type="Set" value="ŚÕÑĻÓȚĶỤ"}%
%META:PREFERENCE{name="PWTWL3" title="WTWL3" type="Set" value="ŚõÑļóțķụ"}%
%META:PREFERENCE{name="PTTWL3" title="TTWL3" type="Set" value="Śõñļóțķụ"}%
%META:PREFERENCE{name="PLTWL4" title="LTWL4" type="Set" value="ŕŭųùňůžú"}%
%META:PREFERENCE{name="PUTWL4" title="UTWL4" type="Set" value="ŔŬŲÙŇŮŽÚ"}%
%META:PREFERENCE{name="PWTWL4" title="WTWL4" type="Set" value="ŔŭŲùňůžú"}%
%META:PREFERENCE{name="PTTWL4" title="TTWL4" type="Set" value="Ŕŭųùňůžú"}%
%META:PREFERENCE{name="PLTWL5" title="LTWL5" type="Set" value="ģšěòðĥğü"}%
%META:PREFERENCE{name="PUTWL5" title="UTWL5" type="Set" value="ĢŠĚÒÐĤĞÜ"}%
%META:PREFERENCE{name="PWTWL5" title="WTWL5" type="Set" value="ĢšĚòðĥğü"}%
%META:PREFERENCE{name="PTTWL5" title="TTWL5" type="Set" value="Ģšěòðĥğü"}%
Loading

0 comments on commit 6e027c7

Please sign in to comment.