diff options
author | Shashank | 2017-05-29 12:40:26 +0530 |
---|---|---|
committer | Shashank | 2017-05-29 12:40:26 +0530 |
commit | 0345245e860375a32c9a437c4a9d9cae807134e9 (patch) | |
tree | ad51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/localization/tests | |
download | scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2 scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip |
CMSCOPE changed
Diffstat (limited to 'modules/localization/tests')
46 files changed, 1185 insertions, 0 deletions
diff --git a/modules/localization/tests/nonreg_tests/bug_10654.dia.ref b/modules/localization/tests/nonreg_tests/bug_10654.dia.ref new file mode 100755 index 000000000..8f017016b --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_10654.dia.ref @@ -0,0 +1,16 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 10654 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=10654 +// +// <-- Short Description --> +// dgettext with "scilab" domain did not return same result than gettext +A = dgettext('scilab', '%s: No more memory.\n'); +B = gettext("%s: No more memory.\n"); +assert_checkequal(A, B); diff --git a/modules/localization/tests/nonreg_tests/bug_10654.tst b/modules/localization/tests/nonreg_tests/bug_10654.tst new file mode 100755 index 000000000..a6d4f68f6 --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_10654.tst @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 10654 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=10654 +// +// <-- Short Description --> +// dgettext with "scilab" domain did not return same result than gettext + +A = dgettext('scilab', '%s: No more memory.\n'); +B = gettext("%s: No more memory.\n"); +assert_checkequal(A, B); diff --git a/modules/localization/tests/nonreg_tests/bug_2670.dia.ref b/modules/localization/tests/nonreg_tests/bug_2670.dia.ref new file mode 100755 index 000000000..44bd97044 --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_2670.dia.ref @@ -0,0 +1,13 @@ +// <-- Non-regression test for bug 2670 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=2670 +// +// <-- Short Description --> +// getlanguage() returns an empty string (occurs both under Linux and Windows). +// +// Copyright INRIA +// Scilab Project - Pierre MARECHAL +// Copyright INRIA 2007 +// Date : 28 Jan 2007 +if length(getlanguage()) <> 5 then bugmes();quit;end diff --git a/modules/localization/tests/nonreg_tests/bug_2670.tst b/modules/localization/tests/nonreg_tests/bug_2670.tst new file mode 100755 index 000000000..70b3d0b7c --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_2670.tst @@ -0,0 +1,17 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 2670 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=2670 +// +// <-- Short Description --> +// getlanguage() returns an empty string (occurs both under Linux and Windows). +// + +if length(getlanguage()) <> 5 then pause,end diff --git a/modules/localization/tests/nonreg_tests/bug_2705.dia.ref b/modules/localization/tests/nonreg_tests/bug_2705.dia.ref new file mode 100755 index 000000000..dc4aef01a --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_2705.dia.ref @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 2705 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=2705 +// +// <-- Short Description --> +// getlanguage(), under Windows, returns "Frenc" or "Engli" instead of fr_FR or en_US. +// +LANG = getlanguage(); +if length(LANG) <> 5 then bugmes();quit;end +TOK = tokens(LANG,'_'); +if size(TOK,'*') <> 2 then bugmes();quit;end +if length(TOK(1)) <> 2 then bugmes();quit;end +if length(TOK(2)) <> 2 then bugmes();quit;end +if (LANG == "Frenc") | (LANG == "Engli") then bugmes();quit;end diff --git a/modules/localization/tests/nonreg_tests/bug_2705.tst b/modules/localization/tests/nonreg_tests/bug_2705.tst new file mode 100755 index 000000000..2b44d883b --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_2705.tst @@ -0,0 +1,27 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 2705 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=2705 +// +// <-- Short Description --> +// getlanguage(), under Windows, returns "Frenc" or "Engli" instead of fr_FR or en_US. +// +LANG = getlanguage(); +if length(LANG) <> 5 then pause,end + +TOK = tokens(LANG,'_'); +if size(TOK,'*') <> 2 then pause,end + +if length(TOK(1)) <> 2 then pause,end + +if length(TOK(2)) <> 2 then pause,end + +if (LANG == "Frenc") | (LANG == "Engli") then pause,end + diff --git a/modules/localization/tests/nonreg_tests/bug_3069.dia.ref b/modules/localization/tests/nonreg_tests/bug_3069.dia.ref new file mode 100755 index 000000000..1d8f59d61 --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_3069.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010-2010 - DIGITEO - Sylvestre LEDRU +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 3069 --> +// +// <-- ENGLISH IMPOSED -->" +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3069 +// +// <-- Short Description --> +// bug 3069 fixed - In some cases, the function gettext was returning \" +// +str = gettext("%s: Wrong input argument #%d: ""%s"" or ""%s"" expected.\n"); +if grep(str,"\""") then bugmes();quit;end diff --git a/modules/localization/tests/nonreg_tests/bug_3069.tst b/modules/localization/tests/nonreg_tests/bug_3069.tst new file mode 100755 index 000000000..8fd3fb325 --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_3069.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010-2010 - DIGITEO - Sylvestre LEDRU +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 3069 --> +// +// <-- ENGLISH IMPOSED -->" +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3069 +// +// <-- Short Description --> +// bug 3069 fixed - In some cases, the function gettext was returning \" +// + +str = gettext("%s: Wrong input argument #%d: ""%s"" or ""%s"" expected.\n"); +if grep(str,"\""") then pause, end diff --git a/modules/localization/tests/nonreg_tests/bug_3784.dia.ref b/modules/localization/tests/nonreg_tests/bug_3784.dia.ref new file mode 100755 index 000000000..95148fbbe --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_3784.dia.ref @@ -0,0 +1,16 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 3784 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3784 +// +// <-- Short Description --> +// When Scilab is launched in French, bad read of the values +// <-- FRENCH IMPOSED --> +a=read(SCI+"/modules/graphics/demos/anim/anim6/yt.wrt",20,201); +if (a(1,2) == - 7.) then bugmes();quit;end diff --git a/modules/localization/tests/nonreg_tests/bug_3784.tst b/modules/localization/tests/nonreg_tests/bug_3784.tst new file mode 100755 index 000000000..17fb731ab --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_3784.tst @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 3784 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3784 +// +// <-- Short Description --> +// When Scilab is launched in French, bad read of the values +// <-- FRENCH IMPOSED --> + +a=read(SCI+"/modules/graphics/demos/anim/anim6/yt.wrt",20,201); +if (a(1,2) == - 7.) then pause, end diff --git a/modules/localization/tests/nonreg_tests/bug_3802.dia.ref b/modules/localization/tests/nonreg_tests/bug_3802.dia.ref new file mode 100755 index 000000000..5c920c83f --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_3802.dia.ref @@ -0,0 +1,19 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 3802 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3802 +// +// <-- Short Description --> +// When Scilab is launched in French, Tcl creates error (when it is working +// in english) +// <-- FRENCH IMPOSED --> +if getos() <> "Darwin" then + TclCMD="TCL_EvalStr(""destroy .t;pack [text .t];set ts [expr 12/[tk scaling]];.t conf -tabs $ts;.t cget -tabs"")"; + if execstr(TclCMD, "errcatch")<>0 then bugmes();quit;end +end diff --git a/modules/localization/tests/nonreg_tests/bug_3802.tst b/modules/localization/tests/nonreg_tests/bug_3802.tst new file mode 100755 index 000000000..02bc16dd6 --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_3802.tst @@ -0,0 +1,22 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 3802 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3802 +// +// <-- Short Description --> +// When Scilab is launched in French, Tcl creates error (when it is working +// in english) +// <-- FRENCH IMPOSED --> + +if getos() <> "Darwin" then + TclCMD="TCL_EvalStr(""destroy .t;pack [text .t];set ts [expr 12/[tk scaling]];.t conf -tabs $ts;.t cget -tabs"")"; + if execstr(TclCMD, "errcatch")<>0 then pause; end + end +
\ No newline at end of file diff --git a/modules/localization/tests/nonreg_tests/bug_3832.tst b/modules/localization/tests/nonreg_tests/bug_3832.tst new file mode 100755 index 000000000..f1a1d9897 --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_3832.tst @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 3832 --> +// <-- INTERACTIVE TEST --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3832 +// +// <-- Short Description --> +// setdefaultlanguage does nothing when preceded by setlanguage + +if setlanguage('en_US') <> %t then pause,end +if setdefaultlanguage('en_US') <> %t then pause,end + +if setlanguage('fr_FR') <> %t then pause,end +if setdefaultlanguage('fr_FR') <> %t then pause,end + +// quit scilab and relaunch +// please verify that scilab language is french
\ No newline at end of file diff --git a/modules/localization/tests/nonreg_tests/bug_4393.tst b/modules/localization/tests/nonreg_tests/bug_4393.tst new file mode 100755 index 000000000..2dab5053b --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_4393.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO - Vincent COUVERT +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 4393 --> +// <-- INTERACTIVE TEST --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=4393 +// +// <-- Short Description --> +// When launching Scilab from the puffin icon, it does not detect my Locale and switch to english. + +// Launch Scilab from the puffin icon +// Launch Scilab from a Terminal + +// Check that Scilab uses the same locale diff --git a/modules/localization/tests/nonreg_tests/bug_7220.tst b/modules/localization/tests/nonreg_tests/bug_7220.tst new file mode 100755 index 000000000..d339dd209 --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_7220.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 7220 --> +// <-- INTERACTIVE TEST --> +// <-- WINDOWS ONLY --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=7220 +// +// <-- Short Description --> +// On Windows, when you start Scilab with "WScilex -l ru_RU", some menus were disabled. + +// launch scilab by this line: +// WScilex -l ru_RU +// check that menus are not grayed diff --git a/modules/localization/tests/nonreg_tests/bug_8399.dia.ref b/modules/localization/tests/nonreg_tests/bug_8399.dia.ref new file mode 100755 index 000000000..75098ce62 --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_8399.dia.ref @@ -0,0 +1,15 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SQcilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 8399 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/8399 +// +// <-- Short Description --> +// setlanguage didn't work when only fr_FR.UTF-8 was available. +assert_checkequal(setlanguage("fr_FR"), %t); +assert_checkequal(getlanguage(), "fr_FR"); diff --git a/modules/localization/tests/nonreg_tests/bug_8399.tst b/modules/localization/tests/nonreg_tests/bug_8399.tst new file mode 100755 index 000000000..96f8033aa --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_8399.tst @@ -0,0 +1,17 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - SQcilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 8399 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/8399 +// +// <-- Short Description --> +// setlanguage didn't work when only fr_FR.UTF-8 was available. + +assert_checkequal(setlanguage("fr_FR"), %t); +assert_checkequal(getlanguage(), "fr_FR"); diff --git a/modules/localization/tests/nonreg_tests/bug_9424.dia.ref b/modules/localization/tests/nonreg_tests/bug_9424.dia.ref new file mode 100755 index 000000000..87d8726d3 --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_9424.dia.ref @@ -0,0 +1,16 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 9424 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=9424 +// +// <-- Short Description --> +// gettext("") did not return "" +assert_checkequal(gettext(""), ""); +assert_checkequal(dgettext("scilab", ""), ""); +assert_checkequal(dgettext("mydomain", ""), ""); diff --git a/modules/localization/tests/nonreg_tests/bug_9424.tst b/modules/localization/tests/nonreg_tests/bug_9424.tst new file mode 100755 index 000000000..6bf02e09a --- /dev/null +++ b/modules/localization/tests/nonreg_tests/bug_9424.tst @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 9424 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=9424 +// +// <-- Short Description --> +// gettext("") did not return "" + +assert_checkequal(gettext(""), ""); +assert_checkequal(dgettext("scilab", ""), ""); +assert_checkequal(dgettext("mydomain", ""), "");
\ No newline at end of file diff --git a/modules/localization/tests/unit_tests/CreateDir.sce b/modules/localization/tests/unit_tests/CreateDir.sce new file mode 100755 index 000000000..b77c58ebb --- /dev/null +++ b/modules/localization/tests/unit_tests/CreateDir.sce @@ -0,0 +1,39 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +function CreateDir_test() + + TST_LANG = ["Simplified Chinese" , "世界您好"; .. + "Cyrillic" , "азеазея"; .. + "amharique" , "ድቅስድቅስግ"; .. + "Japanese" , "ハロー・ワールド"; .. + "Thai" , "เฮลโลเวิลด์"; .. + "Arabish" , "حريات وحقوق"; .. + "Korean" , "프로그램"; .. + "Vietanmien" , "프로그램"; .. + "Malien" , "ഹലോ വേള്ഡ"; .. + "Hebreu" , "תוכנית"]; + + for i = 1:size(TST_LANG,"r") + DIR_TST = TMPDIR + "/dir_" + TST_LANG(i, 2); + mkdir(DIR_TST); + if ~isdir(DIR_TST) then + error(999, "directory did not create"); + end + FILENAME_TST = DIR_TST + "/" + "file_" + TST_LANG(i, 2); + STR_TST = "str_" + TST_LANG(i, 2) + " : " + TST_LANG(i, 1); + fd = mopen(FILENAME_TST, "wt"); + mfprintf(fd, "%s", STR_TST); + mclose(fd); + if ~isfile(FILENAME_TST) then + error(999, "file did not create"); + end + end +endfunction + +CreateDir_test(); +clear CreateDir_test; diff --git a/modules/localization/tests/unit_tests/addlocalizationdomain.dia.ref b/modules/localization/tests/unit_tests/addlocalizationdomain.dia.ref new file mode 100755 index 000000000..51d5691a3 --- /dev/null +++ b/modules/localization/tests/unit_tests/addlocalizationdomain.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +//=============================== +// unit tests addlocalizationdomain +//=============================== +//error messages +if execstr('addlocalizationdomain()','errcatch')==0 then bugmes();quit;end +if execstr('addlocalizationdomain(""foo"")','errcatch')==0 then bugmes();quit;end +addlocalizationdomain("tbx", "SCI/modules/localization/tests/unit_tests/locale"); +setlanguage("fr_FR"); +assert_checkequal(gettext("%s: No more memory.\n"), "%s : Plus de mémoire disponible.\n"); +assert_checkequal(gettext("tbx", "%s: No more memory.\n"), "%s : Overwrite Scilab translation.\n"); +assert_checkequal(gettext("%s: something not in Scilab.\n"), "%s: something not in Scilab.\n"); +assert_checkequal(gettext("tbx", "%s: something not in Scilab.\n"), "%s : it is true, that is not in Scilab.\n"); diff --git a/modules/localization/tests/unit_tests/addlocalizationdomain.tst b/modules/localization/tests/unit_tests/addlocalizationdomain.tst new file mode 100755 index 000000000..edab24128 --- /dev/null +++ b/modules/localization/tests/unit_tests/addlocalizationdomain.tst @@ -0,0 +1,22 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +//=============================== +// unit tests addlocalizationdomain +//=============================== + + +//error messages +if execstr('addlocalizationdomain()','errcatch')==0 then pause,end +if execstr('addlocalizationdomain(""foo"")','errcatch')==0 then pause,end + +addlocalizationdomain("tbx", "SCI/modules/localization/tests/unit_tests/locale"); +setlanguage("fr_FR"); +assert_checkequal(gettext("%s: No more memory.\n"), "%s : Plus de mémoire disponible.\n"); +assert_checkequal(gettext("tbx", "%s: No more memory.\n"), "%s : Overwrite Scilab translation.\n"); +assert_checkequal(gettext("%s: something not in Scilab.\n"), "%s: something not in Scilab.\n"); +assert_checkequal(gettext("tbx", "%s: something not in Scilab.\n"), "%s : it is true, that is not in Scilab.\n"); diff --git a/modules/localization/tests/unit_tests/dgettext.dia.ref b/modules/localization/tests/unit_tests/dgettext.dia.ref new file mode 100755 index 000000000..f530b2fa9 --- /dev/null +++ b/modules/localization/tests/unit_tests/dgettext.dia.ref @@ -0,0 +1,37 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +//=============================== +// unit tests dgettext +//=============================== +// Void call +if execstr('dgettext()','errcatch')==0 then bugmes();quit;end +// one input argument +str1="plop"; if execstr('dgettext(str1)','errcatch')<>0 then bugmes();quit;end +// three input argument +str1="plop"; str2="plip"; str3="plup"; if execstr('dgettext(str1, str2, str3)','errcatch')==0 then bugmes();quit;end +// Try to translate from en_US to en_US to domain/string which doesn't exist +lang="en_US"; setlanguage(lang); domain="fake_domain"; msg="Localization does not exist"; if dgettext(domain,msg) <> msg then bugmes();quit;end +// Try to translate from en_US to fr_FR to a domain/string which doesn't exist +lang="fr_FR"; setlanguage(lang); domain="fake_domain"; msg="Localization does not exist"; if dgettext(domain,msg) <> msg then bugmes();quit;end +// Check if it is working with a good domain & good msgid +lang="fr_FR"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> "Initialisation :" then bugmes();quit;end +// Check if it is working with a bad domain & good msgid +lang="fr_FR"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) == "Initialisation :" then bugmes();quit;end +// Check if it is working with a good domain & good msgid and alias +lang="fr"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> "Initialisation :" then bugmes();quit;end +// Check if it is working with a bad domain & good msgid and alias +lang="fr"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) == "Initialisation :" then bugmes();quit;end +// Check if it is working with a good domain & good msgid +lang="en_US"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then bugmes();quit;end +// Check if it is working with a bad domain & good msgid +lang="en_US"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then bugmes();quit;end +// Check if it is working with a good domain & good msgid and alias +lang="en"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then bugmes();quit;end +// Check if it is working with a bad domain & good msgid and alias +lang="en"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then bugmes();quit;end +// @TODO : +// Add test to use other domain which are working (ie not fake_domain) diff --git a/modules/localization/tests/unit_tests/dgettext.tst b/modules/localization/tests/unit_tests/dgettext.tst new file mode 100755 index 000000000..cc92fbf69 --- /dev/null +++ b/modules/localization/tests/unit_tests/dgettext.tst @@ -0,0 +1,54 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +//=============================== +// unit tests dgettext +//=============================== + +// Void call +if execstr('dgettext()','errcatch')==0 then pause,end + +// one input argument +str1="plop"; if execstr('dgettext(str1)','errcatch')<>0 then pause,end + +// three input argument +str1="plop"; str2="plip"; str3="plup"; if execstr('dgettext(str1, str2, str3)','errcatch')==0 then pause,end + +// Try to translate from en_US to en_US to domain/string which doesn't exist +lang="en_US"; setlanguage(lang); domain="fake_domain"; msg="Localization does not exist"; if dgettext(domain,msg) <> msg then pause, end + +// Try to translate from en_US to fr_FR to a domain/string which doesn't exist +lang="fr_FR"; setlanguage(lang); domain="fake_domain"; msg="Localization does not exist"; if dgettext(domain,msg) <> msg then pause, end + + +// Check if it is working with a good domain & good msgid +lang="fr_FR"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> "Initialisation :" then pause, end + +// Check if it is working with a bad domain & good msgid +lang="fr_FR"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) == "Initialisation :" then pause, end + +// Check if it is working with a good domain & good msgid and alias +lang="fr"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> "Initialisation :" then pause, end + +// Check if it is working with a bad domain & good msgid and alias +lang="fr"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) == "Initialisation :" then pause, end + + +// Check if it is working with a good domain & good msgid +lang="en_US"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then pause, end + +// Check if it is working with a bad domain & good msgid +lang="en_US"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then pause, end + +// Check if it is working with a good domain & good msgid and alias +lang="en"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then pause, end + +// Check if it is working with a bad domain & good msgid and alias +lang="en"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then pause, end + +// @TODO : +// Add test to use other domain which are working (ie not fake_domain) diff --git a/modules/localization/tests/unit_tests/getdefaultlanguage.dia.ref b/modules/localization/tests/unit_tests/getdefaultlanguage.dia.ref new file mode 100755 index 000000000..e5bbde32d --- /dev/null +++ b/modules/localization/tests/unit_tests/getdefaultlanguage.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ +//=============================== +// unit tests getdefaultlanguage +//=============================== +warning("off") +// check that the default language is really english + if getdefaultlanguage() <> "en_US" then bugmes();quit;end +// Switch to french with small code and check if the default language has not changed +lang="fr"; setlanguage(lang); if getdefaultlanguage() <> "en_US" then bugmes();quit;end +// Switch to english with small code +lang="en"; setlanguage(lang); if getdefaultlanguage() <> "en_US" then bugmes();quit;end +// Switch to english with full code +lang="en_US"; setlanguage(lang); if getdefaultlanguage() <> "en_US" then bugmes();quit;end diff --git a/modules/localization/tests/unit_tests/getdefaultlanguage.tst b/modules/localization/tests/unit_tests/getdefaultlanguage.tst new file mode 100755 index 000000000..cc1299b76 --- /dev/null +++ b/modules/localization/tests/unit_tests/getdefaultlanguage.tst @@ -0,0 +1,23 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ + +//=============================== +// unit tests getdefaultlanguage +//=============================== +warning("off") +// check that the default language is really english + if getdefaultlanguage() <> "en_US" then pause, end + +// Switch to french with small code and check if the default language has not changed +lang="fr"; setlanguage(lang); if getdefaultlanguage() <> "en_US" then pause, end + +// Switch to english with small code +lang="en"; setlanguage(lang); if getdefaultlanguage() <> "en_US" then pause, end + +// Switch to english with full code +lang="en_US"; setlanguage(lang); if getdefaultlanguage() <> "en_US" then pause, end + diff --git a/modules/localization/tests/unit_tests/getlanguage.dia.ref b/modules/localization/tests/unit_tests/getlanguage.dia.ref new file mode 100755 index 000000000..ec75f7dfb --- /dev/null +++ b/modules/localization/tests/unit_tests/getlanguage.dia.ref @@ -0,0 +1,17 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +//=============================== +// unit tests getlanguage +//=============================== +// Switch to french with small code +lang="fr"; setlanguage(lang); if getlanguage() <> "fr_FR" then bugmes();quit;end +// Switch to english with small code +lang="en"; setlanguage(lang); if getlanguage() <> "en_US" then bugmes();quit;end +// Switch to english with full code +lang="en_US"; setlanguage(lang); if getlanguage() <> "en_US" then bugmes();quit;end +// Switch to french with full code +lang="fr_FR"; setlanguage(lang); if getlanguage() <> "fr_FR" then bugmes();quit;end diff --git a/modules/localization/tests/unit_tests/getlanguage.tst b/modules/localization/tests/unit_tests/getlanguage.tst new file mode 100755 index 000000000..c39eb453d --- /dev/null +++ b/modules/localization/tests/unit_tests/getlanguage.tst @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +//=============================== +// unit tests getlanguage +//=============================== + +// Switch to french with small code +lang="fr"; setlanguage(lang); if getlanguage() <> "fr_FR" then pause, end + +// Switch to english with small code +lang="en"; setlanguage(lang); if getlanguage() <> "en_US" then pause, end + +// Switch to english with full code +lang="en_US"; setlanguage(lang); if getlanguage() <> "en_US" then pause, end + +// Switch to french with full code +lang="fr_FR"; setlanguage(lang); if getlanguage() <> "fr_FR" then pause, end + diff --git a/modules/localization/tests/unit_tests/gettext.dia.ref b/modules/localization/tests/unit_tests/gettext.dia.ref new file mode 100755 index 000000000..230821995 --- /dev/null +++ b/modules/localization/tests/unit_tests/gettext.dia.ref @@ -0,0 +1,27 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +//=============================== +// unit tests gettext +//=============================== +// Void call +if execstr('gettext()','errcatch')==0 then bugmes();quit;end +// three inputs arguments +str1="plop"; str2="plip"; str3="plup"; if execstr('gettext(str1, str2, str3)','errcatch')==0 then bugmes();quit;end +// Try to translate from en_US to en_US to a string which doesn't exist +lang="en_US"; setlanguage(lang); msg="Localization does not exist"; if gettext(msg) <> msg then bugmes();quit;end +// Try to translate from en_US to fr_FR to a string which doesn't exist +lang="fr_FR"; setlanguage(lang); msg="Localization does not exist"; if gettext(msg) <> msg then bugmes();quit;end +lang="fr_FR"; setlanguage(lang); msg="Startup execution:"; if gettext(msg) <> "Initialisation :" then bugmes();quit;end +lang="fr"; setlanguage(lang); msg="Startup execution:"; if gettext(msg) <> "Initialisation :" then bugmes();quit;end +lang="en"; setlanguage(lang); msg="Startup execution:"; if gettext(msg) <> msg then bugmes();quit;end +lang="en_US"; setlanguage(lang); msg="Startup execution:"; if gettext(msg) <> msg then bugmes();quit;end +addlocalizationdomain("tbx", "SCI/modules/localization/tests/unit_tests/locale"); +setlanguage("fr_FR"); +assert_checkequal(gettext("%s: No more memory.\n"), "%s : Plus de mémoire disponible.\n"); +assert_checkequal(gettext("tbx", "%s: No more memory.\n"), "%s : Overwrite Scilab translation.\n"); +assert_checkequal(gettext("%s: something not in Scilab.\n"), "%s: something not in Scilab.\n"); +assert_checkequal(gettext("tbx", "%s: something not in Scilab.\n"), "%s : it is true, that is not in Scilab.\n"); diff --git a/modules/localization/tests/unit_tests/gettext.tst b/modules/localization/tests/unit_tests/gettext.tst new file mode 100755 index 000000000..387348fe2 --- /dev/null +++ b/modules/localization/tests/unit_tests/gettext.tst @@ -0,0 +1,38 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +//=============================== +// unit tests gettext +//=============================== + +// Void call +if execstr('gettext()','errcatch')==0 then pause,end + +// three inputs arguments +str1="plop"; str2="plip"; str3="plup"; if execstr('gettext(str1, str2, str3)','errcatch')==0 then pause,end + +// Try to translate from en_US to en_US to a string which doesn't exist +lang="en_US"; setlanguage(lang); msg="Localization does not exist"; if gettext(msg) <> msg then pause, end + +// Try to translate from en_US to fr_FR to a string which doesn't exist +lang="fr_FR"; setlanguage(lang); msg="Localization does not exist"; if gettext(msg) <> msg then pause, end + +lang="fr_FR"; setlanguage(lang); msg="Startup execution:"; if gettext(msg) <> "Initialisation :" then pause, end + +lang="fr"; setlanguage(lang); msg="Startup execution:"; if gettext(msg) <> "Initialisation :" then pause, end + +lang="en"; setlanguage(lang); msg="Startup execution:"; if gettext(msg) <> msg then pause, end + +lang="en_US"; setlanguage(lang); msg="Startup execution:"; if gettext(msg) <> msg then pause, end + +addlocalizationdomain("tbx", "SCI/modules/localization/tests/unit_tests/locale"); +setlanguage("fr_FR"); +assert_checkequal(gettext("%s: No more memory.\n"), "%s : Plus de mémoire disponible.\n"); +assert_checkequal(gettext("tbx", "%s: No more memory.\n"), "%s : Overwrite Scilab translation.\n"); +assert_checkequal(gettext("%s: something not in Scilab.\n"), "%s: something not in Scilab.\n"); +assert_checkequal(gettext("tbx", "%s: something not in Scilab.\n"), "%s : it is true, that is not in Scilab.\n"); + diff --git a/modules/localization/tests/unit_tests/io_encoding.dia.ref b/modules/localization/tests/unit_tests/io_encoding.dia.ref new file mode 100755 index 000000000..058e89a9c --- /dev/null +++ b/modules/localization/tests/unit_tests/io_encoding.dia.ref @@ -0,0 +1,10 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.org> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ +// Create all needed directories +//============================== +chdir(TMPDIR); +exec(SCI+"/modules/localization/tests/unit_tests/CreateDir.sce", -1); diff --git a/modules/localization/tests/unit_tests/io_encoding.tst b/modules/localization/tests/unit_tests/io_encoding.tst new file mode 100755 index 000000000..c567e44e8 --- /dev/null +++ b/modules/localization/tests/unit_tests/io_encoding.tst @@ -0,0 +1,14 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.org> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ + +// Create all needed directories +//============================== + + +chdir(TMPDIR); + +exec(SCI+"/modules/localization/tests/unit_tests/CreateDir.sce", -1); diff --git a/modules/localization/tests/unit_tests/locale/en_US/LC_MESSAGES/tbx.mo b/modules/localization/tests/unit_tests/locale/en_US/LC_MESSAGES/tbx.mo Binary files differnew file mode 100755 index 000000000..0e866a731 --- /dev/null +++ b/modules/localization/tests/unit_tests/locale/en_US/LC_MESSAGES/tbx.mo diff --git a/modules/localization/tests/unit_tests/locale/en_US/LC_MESSAGES/tbx.po b/modules/localization/tests/unit_tests/locale/en_US/LC_MESSAGES/tbx.po new file mode 100755 index 000000000..fda24379a --- /dev/null +++ b/modules/localization/tests/unit_tests/locale/en_US/LC_MESSAGES/tbx.po @@ -0,0 +1,27 @@ +# Localization of the module core +# Please see in SCI/tools/localization for localization management +# Copyright (C) 2007 - INRIA / Scilab +# This file is distributed under the same license as the Scilab package. +# Sylvestre Ledru <sylvestre.ledru@inria.fr>, 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: Scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2013-06-17 20:20+0000\n" +"Last-Translator: jojolebestof <Unknown>\n" +"Language-Team: Scilab Localization <localization@scilab.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 16681)\n" +"Language: \n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "" + +#, c-format +msgid "%s: something not in Scilab.\n" +msgstr "" diff --git a/modules/localization/tests/unit_tests/locale/fr_FR/LC_MESSAGES/tbx.mo b/modules/localization/tests/unit_tests/locale/fr_FR/LC_MESSAGES/tbx.mo Binary files differnew file mode 100755 index 000000000..55892f327 --- /dev/null +++ b/modules/localization/tests/unit_tests/locale/fr_FR/LC_MESSAGES/tbx.mo diff --git a/modules/localization/tests/unit_tests/locale/fr_FR/LC_MESSAGES/tbx.po b/modules/localization/tests/unit_tests/locale/fr_FR/LC_MESSAGES/tbx.po new file mode 100755 index 000000000..7dfc86c55 --- /dev/null +++ b/modules/localization/tests/unit_tests/locale/fr_FR/LC_MESSAGES/tbx.po @@ -0,0 +1,27 @@ +# Localization of the module core +# Please see in SCI/tools/localization for localization management +# Copyright (C) 2007 - INRIA / Scilab +# This file is distributed under the same license as the Scilab package. +# Sylvestre Ledru <sylvestre.ledru@inria.fr>, 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: Scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2013-06-17 20:20+0000\n" +"Last-Translator: jojolebestof <Unknown>\n" +"Language-Team: Scilab Localization <localization@scilab.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 16681)\n" +"Language: \n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s : Overwrite Scilab translation.\n" + +#, c-format +msgid "%s: something not in Scilab.\n" +msgstr "%s : it is true, that is not in Scilab.\n" diff --git a/modules/localization/tests/unit_tests/setdefaultlanguage.tst b/modules/localization/tests/unit_tests/setdefaultlanguage.tst new file mode 100755 index 000000000..e29b9574a --- /dev/null +++ b/modules/localization/tests/unit_tests/setdefaultlanguage.tst @@ -0,0 +1,50 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ + +// setdefaultlanguage only on Windows +// returns false in others case + +if getos() == 'Windows' then + ierr = execstr('setdefaultlanguage()','errcatch'); + if ierr <> 77 then pause,end + + ierr = execstr('setdefaultlanguage(1)','errcatch'); + if ierr <> 999 then pause,end + + warning('off'); + + if setdefaultlanguage('toto') <> %f then pause,end + + if setdefaultlanguage('en') <> %t then pause,end + if getlanguage() <> 'en_US' then pause,end + + if setdefaultlanguage('fr') <> %t then pause,end + if getlanguage() <> 'fr_FR' then pause,end + + if setdefaultlanguage('en_US') <> %t then pause,end + if getlanguage() <> 'en_US' then pause,end + + if setdefaultlanguage('fr_FR') <> %t then pause,end + if getlanguage() <> 'fr_FR' then pause,end + + if setdefaultlanguage('ru_RU') <> %t then pause,end + if getlanguage() <> 'ru_RU' then pause,end + + if setdefaultlanguage('zh_CN') <> %t then pause,end + if getlanguage() <> 'zh_CN' then pause,end + + if setdefaultlanguage('zh_TW') <> %t then pause,end + if getlanguage() <> 'zh_TW' then pause,end + + if setdefaultlanguage('C') <> %t then pause,end + if getlanguage() <> getdefaultlanguage() then pause,end + + if setdefaultlanguage('') <> %t then pause,end + + warning('on'); + +end diff --git a/modules/localization/tests/unit_tests/setdefaultlanguage.unix.dia.ref b/modules/localization/tests/unit_tests/setdefaultlanguage.unix.dia.ref new file mode 100755 index 000000000..1f23cefac --- /dev/null +++ b/modules/localization/tests/unit_tests/setdefaultlanguage.unix.dia.ref @@ -0,0 +1,34 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ +// setdefaultlanguage only on Windows +// returns false in others case +if getos() == 'Windows' then + ierr = execstr('setdefaultlanguage()','errcatch'); + if ierr <> 77 then bugmes();quit;end + ierr = execstr('setdefaultlanguage(1)','errcatch'); + if ierr <> 999 then bugmes();quit;end + warning('off'); + if setdefaultlanguage('toto') <> %f then bugmes();quit;end + if setdefaultlanguage('en') <> %t then bugmes();quit;end + if getlanguage() <> 'en_US' then bugmes();quit;end + if setdefaultlanguage('fr') <> %t then bugmes();quit;end + if getlanguage() <> 'fr_FR' then bugmes();quit;end + if setdefaultlanguage('en_US') <> %t then bugmes();quit;end + if getlanguage() <> 'en_US' then bugmes();quit;end + if setdefaultlanguage('fr_FR') <> %t then bugmes();quit;end + if getlanguage() <> 'fr_FR' then bugmes();quit;end + if setdefaultlanguage('ru_RU') <> %t then bugmes();quit;end + if getlanguage() <> 'ru_RU' then bugmes();quit;end + if setdefaultlanguage('zh_CN') <> %t then bugmes();quit;end + if getlanguage() <> 'zh_CN' then bugmes();quit;end + if setdefaultlanguage('zh_TW') <> %t then bugmes();quit;end + if getlanguage() <> 'zh_TW' then bugmes();quit;end + if setdefaultlanguage('C') <> %t then bugmes();quit;end + if getlanguage() <> getdefaultlanguage() then bugmes();quit;end + if setdefaultlanguage('') <> %t then bugmes();quit;end + warning('on'); +end diff --git a/modules/localization/tests/unit_tests/setdefaultlanguage.win.dia.ref b/modules/localization/tests/unit_tests/setdefaultlanguage.win.dia.ref new file mode 100755 index 000000000..1f23cefac --- /dev/null +++ b/modules/localization/tests/unit_tests/setdefaultlanguage.win.dia.ref @@ -0,0 +1,34 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ +// setdefaultlanguage only on Windows +// returns false in others case +if getos() == 'Windows' then + ierr = execstr('setdefaultlanguage()','errcatch'); + if ierr <> 77 then bugmes();quit;end + ierr = execstr('setdefaultlanguage(1)','errcatch'); + if ierr <> 999 then bugmes();quit;end + warning('off'); + if setdefaultlanguage('toto') <> %f then bugmes();quit;end + if setdefaultlanguage('en') <> %t then bugmes();quit;end + if getlanguage() <> 'en_US' then bugmes();quit;end + if setdefaultlanguage('fr') <> %t then bugmes();quit;end + if getlanguage() <> 'fr_FR' then bugmes();quit;end + if setdefaultlanguage('en_US') <> %t then bugmes();quit;end + if getlanguage() <> 'en_US' then bugmes();quit;end + if setdefaultlanguage('fr_FR') <> %t then bugmes();quit;end + if getlanguage() <> 'fr_FR' then bugmes();quit;end + if setdefaultlanguage('ru_RU') <> %t then bugmes();quit;end + if getlanguage() <> 'ru_RU' then bugmes();quit;end + if setdefaultlanguage('zh_CN') <> %t then bugmes();quit;end + if getlanguage() <> 'zh_CN' then bugmes();quit;end + if setdefaultlanguage('zh_TW') <> %t then bugmes();quit;end + if getlanguage() <> 'zh_TW' then bugmes();quit;end + if setdefaultlanguage('C') <> %t then bugmes();quit;end + if getlanguage() <> getdefaultlanguage() then bugmes();quit;end + if setdefaultlanguage('') <> %t then bugmes();quit;end + warning('on'); +end diff --git a/modules/localization/tests/unit_tests/setlanguage.dia.ref b/modules/localization/tests/unit_tests/setlanguage.dia.ref new file mode 100755 index 000000000..78ce24e82 --- /dev/null +++ b/modules/localization/tests/unit_tests/setlanguage.dia.ref @@ -0,0 +1,55 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ +//=============================== +// unit tests setlanguage +//=============================== +// Void call +if execstr('setlanguage()','errcatch')==0 then bugmes();quit;end +// Double call +lang="fr_FR"; lang2="en_US"; if execstr('setlanguage(lang, lang2)','errcatch')==0 then bugmes();quit;end +// Empty call +lang=getdefaultlanguage(); if setlanguage(lang) <> %T then bugmes();quit;end +// Switch to english +lang="en_US"; if setlanguage(lang) <> %T then bugmes();quit;end +getlanguage() + ans = + + en_US +// Switch to english with small code +lang="en"; if setlanguage(lang) <> %T then bugmes();quit;end +getlanguage() + ans = + + en_US +// Switch to french with small code +lang="fr"; if setlanguage(lang) <> %T then bugmes();quit;end +getlanguage() + ans = + + fr_FR +// Switch to russian with full code +lang="ru_RU"; if setlanguage(lang) <> %T then bugmes();quit;end +getlanguage() + ans = + + ru_RU +// Switch to a wrong code +lang="f"; if setlanguage(lang) <> %F then bugmes();quit;end +setlanguage: Язык «f» не поддерживается. +getlanguage() + ans = + + ru_RU +// Switch to a wrong code +lang="ff"; if setlanguage(lang) <> %F then bugmes();quit;end +setlanguage: Язык «ff» не поддерживается. +// Switch to a wrong code +lang="fff"; if setlanguage(lang) <> %F then bugmes();quit;end +setlanguage: Язык «fff» не поддерживается. +// Switch to a wrong code +lang="ffff"; if setlanguage(lang) <> %F then bugmes();quit;end +setlanguage: Язык «ffff» не поддерживается. diff --git a/modules/localization/tests/unit_tests/setlanguage.tst b/modules/localization/tests/unit_tests/setlanguage.tst new file mode 100755 index 000000000..deec5ef0e --- /dev/null +++ b/modules/localization/tests/unit_tests/setlanguage.tst @@ -0,0 +1,48 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ + +//=============================== +// unit tests setlanguage +//=============================== + +// Void call +if execstr('setlanguage()','errcatch')==0 then pause,end + +// Double call +lang="fr_FR"; lang2="en_US"; if execstr('setlanguage(lang, lang2)','errcatch')==0 then pause,end + +// Empty call +lang=getdefaultlanguage(); if setlanguage(lang) <> %T then pause,end + +// Switch to english +lang="en_US"; if setlanguage(lang) <> %T then pause, end +getlanguage() + +// Switch to english with small code +lang="en"; if setlanguage(lang) <> %T then pause, end +getlanguage() + +// Switch to french with small code +lang="fr"; if setlanguage(lang) <> %T then pause, end +getlanguage() + +// Switch to russian with full code +lang="ru_RU"; if setlanguage(lang) <> %T then pause, end +getlanguage() + +// Switch to a wrong code +lang="f"; if setlanguage(lang) <> %F then pause, end +getlanguage() + +// Switch to a wrong code +lang="ff"; if setlanguage(lang) <> %F then pause, end + +// Switch to a wrong code +lang="fff"; if setlanguage(lang) <> %F then pause, end + +// Switch to a wrong code +lang="ffff"; if setlanguage(lang) <> %F then pause, end diff --git a/modules/localization/tests/unit_tests/unicode_charset.dia.ref b/modules/localization/tests/unit_tests/unicode_charset.dia.ref new file mode 100755 index 000000000..1cfc75675 --- /dev/null +++ b/modules/localization/tests/unit_tests/unicode_charset.dia.ref @@ -0,0 +1,10 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ +lang="zh_TW"; setlanguage(lang); msg="%s: Type %s is not implemented.\n"; if gettext(msg) <> "%s: 型態 %s 未實作.\n" then bugmes();quit;end +lang="zh_TW"; setlanguage(lang); msg="%s: function not available in NWNI mode.\n"; if gettext(msg) <> "%s: 此函數在 NWNI 模式中不存在.\n" then bugmes();quit;end +lang="ru_RU"; setlanguage(lang); msg="%s: Type %s is not implemented.\n"; if gettext(msg) <> "%s: Тип %s не реализован.\n" then bugmes();quit;end +lang="ru_RU"; setlanguage(lang); msg="%s: function not available in NWNI mode.\n"; if gettext(msg) <> "%s: функция недоступна в режиме NWNI.\n" then bugmes();quit;end diff --git a/modules/localization/tests/unit_tests/unicode_charset.tst b/modules/localization/tests/unit_tests/unicode_charset.tst new file mode 100755 index 000000000..86f9d7f7f --- /dev/null +++ b/modules/localization/tests/unit_tests/unicode_charset.tst @@ -0,0 +1,15 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ + +lang="zh_TW"; setlanguage(lang); msg="%s: Type %s is not implemented.\n"; if gettext(msg) <> "%s: 型態 %s 未實作.\n" then pause, end + +lang="zh_TW"; setlanguage(lang); msg="%s: function not available in NWNI mode.\n"; if gettext(msg) <> "%s: 此函數在 NWNI 模式中不存在.\n" then pause, end + +lang="ru_RU"; setlanguage(lang); msg="%s: Type %s is not implemented.\n"; if gettext(msg) <> "%s: Тип %s не реализован.\n" then pause, end + +lang="ru_RU"; setlanguage(lang); msg="%s: function not available in NWNI mode.\n"; if gettext(msg) <> "%s: функция недоступна в режиме NWNI.\n" then pause, end + diff --git a/modules/localization/tests/unit_tests/unicode_io.dia.ref b/modules/localization/tests/unit_tests/unicode_io.dia.ref new file mode 100755 index 000000000..e582589a0 --- /dev/null +++ b/modules/localization/tests/unit_tests/unicode_io.dia.ref @@ -0,0 +1,59 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yung-Jang Lee <yjlee123@gmail.com> +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ +lines(0); +// zh_TW / Cyrillic / amharique / Japanese / Chinese / Thai / Corean +text=[ "中文測試", "азеазеясдвклгхклмвцмзер" .. + "ድቅስድቅስግጅክልውሽችክልዝ" .. +"すべての人間は、生まれながらにして自由であり、かつ、尊厳と権利と について平等である。人間は、理性と良心とを授けられており、互いに同 胞の精神をもって行動しなければならない。" .. +"人 人 生 而 自 由, 在 尊 严 和 权 利 上 一 律 平 等。 他 们 赋 有 理 性 和 良 心, 并 应 以 兄 弟 关 系 的 精 神 相 对 待。" .. +"ราทุกคนเกิดมาอย่างอิสระ เราทุกคนมีความคิดและความเข้าใจเป็นของเราเอง เราทุกคนควรได้รับการปฏิบัติในทางเดียวกัน." .. +"모든 인간은 태어날 때부터 자유로우며 그 존엄과 권리에 있어 동등하다. 인간은 천부적으로 이성과 양심을 부여받았으며 서로 형제애의 정신으로 행동하여야 한다." .. +"لد جميع الناس أحرارًا متساوين في الكرامة والحقوق. وقد وهبوا عقلاً وضميرًا وعليهم أن يعامل بعضهم بعضًا بروح الإخاء".. +"כל בני האדם נולדו בני חורין ושווים בערכם ובזכיותיהם. כולם חוננו בתבונה ובמצפון, לפיכך חובה עליהם לנהג איש ברעהו ברוח של אחוה" +]; +for i=1:size(text,"*") +if msprintf(text(i)) <> text(i) then bugmes();quit;end +// Fortran-Style output<------- no yet fixed in this patch +//u=file('open','resultsA','unknown') //<--------Test 2 file encoding for Fortran Style output +//write(u,text(i),'(a)') // encoding wrong, not in system locale +//file('close',u) +// C style output +myFile="resultsA"; +u=mopen(TMPDIR+"/"+myFile,'w'); +mfprintf(u,text(i)+" plus %s",text(i)); +mclose(u); +if mgetl(TMPDIR+"/"+myFile,1) <> text(i) + " plus "+text(i) then bugmes();quit;end +myStr=" with another %s"; +myStr2=" with another "; +if msprintf(text(i)+myStr,text(i)) <> text(i)+myStr2+text(i) then bugmes();quit;end +// Classic display +disp(text(i)); +end + + 中文測試 + + азеазеясдвклгхклмвцмзер + + ድቅስድቅስግጅክልውሽችክልዝ + + の精神をもって行動しなければならない。 + + + ราทุกคนเกิดมาอย่างอิสระ + + 모든 인간은 태어날 때부터 자유로우며 그 존엄과 권 + + لد جميع الناس أحرارًا متساوين في الكرا + مة والحقوق. وقد وهبوا عقلاً وضميرًا + ונה ובמצפון, לפיכך חובה עליהם לנהג א + יש ברעהו ברוח של אחוה +//title('title test'+text); t=0:0.1:2*%pi; //<------Test 7 text drawing test +//plot2d(t,[sin(t'),cos(t')],[-1,2]); +//legends(['legends test'+text ;'text B '+text],[-1,2], opt=3 ); +// ScilabVersion/OS/LANG/CONSOLE = EncodingPatch/WindowsXp/zh_TW.CP950/Dos Console +//about(); //<------Test 8 Scilab gettext Test diff --git a/modules/localization/tests/unit_tests/unicode_io.tst b/modules/localization/tests/unit_tests/unicode_io.tst new file mode 100755 index 000000000..f20c5a074 --- /dev/null +++ b/modules/localization/tests/unit_tests/unicode_io.tst @@ -0,0 +1,56 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yung-Jang Lee <yjlee123@gmail.com> +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ + +lines(0); + +// zh_TW / Cyrillic / amharique / Japanese / Chinese / Thai / Corean +text=[ "中文測試", "азеазеясдвклгхклмвцмзер" .. + "ድቅስድቅስግጅክልውሽችክልዝ" .. +"すべての人間は、生まれながらにして自由であり、かつ、尊厳と権利と について平等である。人間は、理性と良心とを授けられており、互いに同 胞の精神をもって行動しなければならない。" .. +"人 人 生 而 自 由, 在 尊 严 和 权 利 上 一 律 平 等。 他 们 赋 有 理 性 和 良 心, 并 应 以 兄 弟 关 系 的 精 神 相 对 待。" .. +"ราทุกคนเกิดมาอย่างอิสระ เราทุกคนมีความคิดและความเข้าใจเป็นของเราเอง เราทุกคนควรได้รับการปฏิบัติในทางเดียวกัน." .. +"모든 인간은 태어날 때부터 자유로우며 그 존엄과 권리에 있어 동등하다. 인간은 천부적으로 이성과 양심을 부여받았으며 서로 형제애의 정신으로 행동하여야 한다." .. +"لد جميع الناس أحرارًا متساوين في الكرامة والحقوق. وقد وهبوا عقلاً وضميرًا وعليهم أن يعامل بعضهم بعضًا بروح الإخاء".. +"כל בני האדם נולדו בני חורין ושווים בערכם ובזכיותיהם. כולם חוננו בתבונה ובמצפון, לפיכך חובה עליהם לנהג איש ברעהו ברוח של אחוה" +]; + +for i=1:size(text,"*") + +if msprintf(text(i)) <> text(i) then pause, end + +// Fortran-Style output<------- no yet fixed in this patch +//u=file('open','resultsA','unknown') //<--------Test 2 file encoding for Fortran Style output +//write(u,text(i),'(a)') // encoding wrong, not in system locale +//file('close',u) +// C style output + +myFile="resultsA"; +u=mopen(TMPDIR+"/"+myFile,'w'); +mfprintf(u,text(i)+" plus %s",text(i)); +mclose(u); + +if mgetl(TMPDIR+"/"+myFile,1) <> text(i) + " plus "+text(i) then pause, end + + +myStr=" with another %s"; +myStr2=" with another "; +if msprintf(text(i)+myStr,text(i)) <> text(i)+myStr2+text(i) then pause, end + +// Classic display +disp(text(i)); + +end + + +//title('title test'+text); t=0:0.1:2*%pi; //<------Test 7 text drawing test +//plot2d(t,[sin(t'),cos(t')],[-1,2]); +//legends(['legends test'+text ;'text B '+text],[-1,2], opt=3 ); +// ScilabVersion/OS/LANG/CONSOLE = EncodingPatch/WindowsXp/zh_TW.CP950/Dos Console +//about(); //<------Test 8 Scilab gettext Test + + diff --git a/modules/localization/tests/unit_tests/unicode_io.win.dia.ref b/modules/localization/tests/unit_tests/unicode_io.win.dia.ref new file mode 100755 index 000000000..7508d1bf8 --- /dev/null +++ b/modules/localization/tests/unit_tests/unicode_io.win.dia.ref @@ -0,0 +1,75 @@ +// ============================================================================ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yung-Jang Lee <yjlee123@gmail.com> +// Copyright (C) 2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================ +lines(0); +// zh_TW / Cyrillic / amharique / Japanese / Chinese / Thai / Corean +text=[ "中文測試", "азеазеясдвклгхклмвцмзер" .. + "ድቅስድቅስግጅክልውሽችክልዝ" .. +"すべての人間は、生まれながらにして自由であり、かつ、尊厳と権利と について平等である。人間は、理性と良心とを授けられており、互いに同 胞の精神をもって行動しなければならない。" .. +"人 人 生 而 自 由, 在 尊 严 和 权 利 上 一 律 平 等。 他 们 赋 有 理 性 和 良 心, 并 应 以 兄 弟 关 系 的 精 神 相 对 待。" .. +"ราทุกคนเกิดมาอย่างอิสระ เราทุกคนมีความคิดและความเข้าใจเป็นของเราเอง เราทุกคนควรได้รับการปฏิบัติในทางเดียวกัน." .. +"모든 인간은 태어날 때부터 자유로우며 그 존엄과 권리에 있어 동등하다. 인간은 천부적으로 이성과 양심을 부여받았으며 서로 형제애의 정신으로 행동하여야 한다." .. +"لد جميع الناس أحرارًا متساوين في الكرامة والحقوق. وقد وهبوا عقلاً وضميرًا وعليهم أن يعامل بعضهم بعضًا بروح الإخاء".. +"כל בני האדם נולדו בני חורין ושווים בערכם ובזכיותיהם. כולם חוננו בתבונה ובמצפון, לפיכך חובה עליהם לנהג איש ברעהו ברוח של אחוה" +]; +for i=1:size(text,"*") +if msprintf(text(i)) <> text(i) then bugmes();quit;end +// Fortran-Style output<------- no yet fixed in this patch +//u=file('open','resultsA','unknown') //<--------Test 2 file encoding for Fortran Style output +//write(u,text(i),'(a)') // encoding wrong, not in system locale +//file('close',u) +// C style output +myFile="resultsA"; +u=mopen(TMPDIR+"/"+myFile,'w'); +mfprintf(u,text(i)+" plus %s",text(i)); +mclose(u); +if mgetl(TMPDIR+"/"+myFile,1) <> text(i) + " plus "+text(i) then bugmes();quit;end +myStr=" with another %s"; +myStr2=" with another "; +if msprintf(text(i)+myStr,text(i)) <> text(i)+myStr2+text(i) then bugmes();quit;end +// Classic display +disp(text(i)); +end + + 中文測試 + + азеазеясдвклгхклмвцмзер + + ድቅስድቅስግጅክልውሽችክልዝ + + すべての人間は、生まれながらにして自由であり、� + ��つ、尊厳と権利と について平等である。人間� + �、理性と良心とを授けられており、互いに同 胞 + の精神をもって行動しなければならない。 + + 人 人 生 而 自 由, 在 尊 严 和 权 利 上 一 律 平 等� + � 他 们 赋 有 理 性 和 良 心, 并 应 以 兄 弟 关 � + � 的 精 神 相 对 待。 + + ราทุกคนเกิดมาอย่างอิสระ + เราทุกคนมีความคิดและค� + �ามเข้าใจเป็นของเราเอง + เราทุกคนควรได้รับการป� + �ิบัติในทางเดียวกัน. + + 모든 인간은 태어날 때부터 자유로우며 그 존엄과 권 + 리에 있어 동등하다. 인간은 천부적으로 이성과 � + ��심을 부여받았으며 서로 형제애의 정신으로 행� + ��하여야 한다. + + لد جميع الناس أحرارًا متساوين في الكرا + مة والحقوق. وقد وهبوا عقلاً وضميرًا + وعليهم أن يعامل بعضهم بعضًا بروح ال� + �خاء"כל בני האדם נולדו בני חורין ושו� + �ים בערכם ובזכיותיהם. כולם חוננו בתב + ונה ובמצפון, לפיכך חובה עליהם לנהג א + יש ברעהו ברוח של אחוה +//title('title test'+text); t=0:0.1:2*%pi; //<------Test 7 text drawing test +//plot2d(t,[sin(t'),cos(t')],[-1,2]); +//legends(['legends test'+text ;'text B '+text],[-1,2], opt=3 ); +// ScilabVersion/OS/LANG/CONSOLE = EncodingPatch/WindowsXp/zh_TW.CP950/Dos Console +//about(); //<------Test 8 Scilab gettext Test |