Commit graph

447 commits

Author SHA1 Message Date
jenkins-bot 207af66a10 Merge "Replace some moved Title class uses, now MediaWiki\Title\Title" 2023-08-19 06:14:08 +00:00
gerritbot fd1e7e2a67 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I1c875fcf7456ea03420b316f58fcd18aa748301f
2023-08-19 04:17:34 +00:00
James D. Forrester f08789049b Use namespaced IDatabase class
Bug: T344536
Change-Id: Ia5fdf3242f9510e4f21670f3746d9364ae2935c6
2023-08-19 12:03:02 +08:00
Amir Sarabadani 88a24c402b Fix phpcs error
Change-Id: If047aa9a5cf26def9d1d9935294646f80ef92ffc
2023-08-19 04:51:28 +02:00
Bartosz Dziewoński 8c05a71beb Remove references to VisualEditorFullRestbaseURL
The VisualEditorFullRestbaseURL config variable is no longer used by
VisualEditor and is no longer set in Wikimedia production
configuration.

Bug: T344458
Change-Id: Ifd0b9f919f7a9bdceb8761125588fe72e8d1e50c
2023-08-18 20:17:48 +02:00
Umherirrender fb29f08e74 Use HookHandlers for core hooks
The use of "HookHandlers" attribute in extension.json makes it possible
to inject services into hook handler classes in a future patch.

Bug: T263364
Change-Id: Id8d9d0dcc6bb6ab60c5df3074803d132393415e9
2023-08-16 01:12:17 +00:00
Daimona Eaytoy ffa687bc64 Avoid DB access in non-Database tests
Bug: T155147
Change-Id: I25b627b85179fe0e72386351e53de322c7a9c850
2023-08-05 15:07:40 +00:00
jenkins-bot 2458e0d578 Merge "Avoid using TestUser in non-database tests" 2023-07-18 23:50:37 +00:00
jenkins-bot 7dfddfed75 Merge "Add remaining mhchemtexified macros:" 2023-07-18 20:49:51 +00:00
Moritz Schubotz (physikerwelt) ef145e7b50
Add remaining mhchemtexified macros:
\mkern -> \mkern #1 (fun_ar1)
    \mskip -> \mskip #1 (fun_ar1)
    \smash -> \smash[#1]{#2} (fun_ar1opt)
    \mathchoice -> \\mathchoice #1 #2 #3 #4 (fun_ar4)
    \rlap -> \rlap #1 (fun_ar1)
    \llap -> \llap #1 (fun_ar1)
    \raise -> \raise #2 #2 (fun_ar2)
    \lower -> \lower #1 #2 (fun_ar2)

Bug: T340023
Change-Id: I61f0bdae53a53d5d301645dc9aa099d3377bff1c
2023-07-18 21:08:36 +02:00
Moritz Schubotz (physikerwelt) 88482a5e60
Extend test coverage for TexUtil to 100%
Change-Id: I74226a31f0fd5fb45066215d1075e6f42223f03c
2023-07-18 12:55:52 +02:00
Moritz Schubotz (physikerwelt) 26cfc111f9 Add usemhchemtexified option for mhchem texified output
Add a config option to enable passing special macros needed to
handle the output from the mhchem texify process.

Bug: T340023
Change-Id: I3553931c252184b54e7a13938e030825e5d45e59
2023-07-18 09:34:35 +00:00
jenkins-bot f6832d0235 Merge "Eliminate duplicate file" 2023-07-18 09:17:03 +00:00
Daimona Eaytoy 34d8441bc8 Avoid using TestUser in non-database tests
It needs a database connection to create the user, which is unnecessary
here.

Depends-On: I80723b886b2b5a5d75cbb73571e1b19ea4a09af5
Change-Id: I260b8ca433733b7754616e6e24778935597981a5
2023-07-17 23:36:23 +02:00
jenkins-bot 7af0761091 Merge "Add tex node with 4 arguments" 2023-07-17 12:39:14 +00:00
Moritz Schubotz (physikerwelt) 2d76cc24ac
Eliminate duplicate file
texutil.json exists twice with identical contents in
test and main sections.

Delete the redundant copy in the test section and access
the main file in tests.

Change-Id: Ie1eba9ed599d6826f1efe2d37bf8370f8e9dd036
2023-07-16 10:04:51 +02:00
Daimona Eaytoy a5c334fdbc Mock ExtensionRegistry in MathTest
The test doesn't need to depend on what extensions are
available/installed. Also pass the test config more explicitly to
ServiceOptions.

Needed-by: I0a04c82250582fed7a66c1e10868d9b4f3823a28
Change-Id: Id2587fe7d31fcd652c26e5dd0a8cfcae3161efcc
2023-07-15 19:11:18 +02:00
Moritz Schubotz (physikerwelt) 5677e7992c
Add tex node with 4 arguments
For the mathchoice command we need a syntax tree element that can
store 4 arguments.

Bug: T340023
Change-Id: Ieddd10e54240a4def6bed30cd299d804e8a121f9
2023-07-14 17:31:04 +02:00
Umherirrender 94ec268cb8 tests: Use correct expect message function in MathWikibaseConnectorTest
expectException needs expectExceptionMessage to be useful

Change-Id: Ic0b9d2e9ab05e958d86082886f1cef3f213919ad
2023-07-10 20:41:57 +02:00
Moritz Schubotz (physikerwelt) 16d1fdacf4
Add WAN Cache for native MathML rendering
* Cache results for checked tex and MathML string in one cache.
* Remove access to parsetree
* Introduce run method to speed up service wiring

Note that the indirection table used in previous versions was
abandoned here. texvc does only little unification's of the
input string so that it is not expected that the overall savings
in space and compute time warrant the additional table.

Change-Id: Ib9ce3d2ab02bd9a2a0f9926db6b937435b7e5458
2023-06-19 23:04:08 +02:00
Moritz Schubotz (physikerwelt) fc425b977c
Add MathML interface to LocalChecker
In preparation for caching we store the MathML fragment returned by
local checker. The rational is that the string serialization of the
parse tree is better chachable as the parsetree.

Change-Id: Ice2ef1f4f7b83ed187507d4d067f446603d0d6a5
2023-06-19 17:39:49 +02:00
Daimona Eaytoy d06bd18532 Replace deprecated MWException
Introduce new classes for checked exceptions, and use SPL exceptions
for the unchecked ones.

Bug: T328220
Change-Id: Ic44463e910911afe6395c38fd2f59b9bfa02a4f0
2023-06-09 13:00:46 +02:00
Moritz Schubotz (physikerwelt) 7c7b3324be Remove additional v1 suffix when computing internalRestbaseURL
Remove additional /v1 when computing internalRestbaseURL from
virtualRestConfig as this will be added in getUrl in MathRestbaseInterface.

internalRestbaseURL was introduced in I2fbc441955a1fe417f264f31f3729ce0715f7f16.

Bug: T334842
Bug: T338381
Change-Id: If2719fb9106e1414ce8814a2fbafa5dcedb84e39
2023-06-08 01:10:30 +00:00
jenkins-bot 03b185078b Merge "Create HookRunner class and the hook handler interfaces" 2023-06-07 09:39:56 +00:00
Ed Sanders bf9d8cef1d Always use the strict equality flag when using in_array
Change-Id: I555be3a62ee545304ea1ff7fdcffa3c4fbd25ab1
2023-06-06 13:35:12 +01:00
Umherirrender 28c5a67697 Create HookRunner class and the hook handler interfaces
Bug: T263353
Change-Id: I7ee943a262eba7d2f00fd05925676cc2351b7be9
2023-06-05 22:47:33 +02:00
Umherirrender a967557107 tests: Call TestCase::createMock with $this
createMock is not a static function (like atLeastOnce)
It is easier to spot that this needs a TestCase when using $this

Change-Id: I6b738e31f43fd7ee2ecd608d0bb853a3ebac3121
2023-05-31 23:00:27 +00:00
jenkins-bot a4911d2283 Merge "Introduce MathInternalRestbaseURL setting." 2023-05-31 06:28:39 +00:00
daniel 43dd9c7f63 Introduce MathInternalRestbaseURL setting.
This new MathInternalRestbaseURL setting allows the internal URL of
Mathoid to be configured directly, instead of relying on
VirtualRestConfig.

This patch moves the fallback logic for the internal and external API
URL into an extension registration callback. This way, we can keep the
application logic simple, and we can issue config warnings that will
cause the updater to fail, forcing wiki owners to update their config.

Bug: T334842
Change-Id: I2fbc441955a1fe417f264f31f3729ce0715f7f16
2023-05-30 09:48:03 +00:00
rrana-wmf c601e1d6f2 Add test case for MathRestbaseInterface.php
Add test case for getType() method.

This will improve the code coverage for this method from 0 to 100%.

Add test case for getTex() method.

This will improve the code coverage for this method from 0 to 100%.

Add test case for evaluateRestbaseCheckResponse() method.

This will improve the code coverage for this method from 0 to 100%.
And covers getIdentifiers(), getWarnings(), setErrorMessage(),
methods from 0 to 100%.

Change-Id: I6bdb6919126e5488838d4fba53eb2f74c89ee63d
2023-05-22 09:36:29 +00:00
Umherirrender 7a8d5b9dc4 tests: Make some PHPUnit data providers static
Initally used a new sniff with autofix (T333745)

Bug: T332865
Change-Id: I73d2903fed7523826b71fc452a846dc4c6e85802
2023-05-21 11:00:48 +02:00
rrana-wmf 5926f42b52 Use MultiHttpClient instead of VirtualRESTService.
This fixes the problems with If208753edfdb301 which was reverted
and adds a new test.

Bug: T335347
Co-Authored-By: <rrana-ctr@wikimedia.org>
Change-Id: I7ddb7b294cbccc4dab42e286fc270f438385bee5
2023-05-20 16:57:46 +00:00
Subramanya Sastry de76f99d3d Revert "Revert "Add getMultiHttpClient function to make HTTP requests to Mathoid.""
This reverts commit a38e56c3fc and
reapplies 38c73d9b7a

Bug: T335347
Change-Id: Ib5f82c022d6ff435a807f8f4128a308f3dacc455
2023-05-16 13:07:32 +00:00
Daniel Kinzler a38e56c3fc Revert "Add getMultiHttpClient function to make HTTP requests to Mathoid."
This reverts commit 38c73d9b7a.

Reason for revert: Breaks math on Beta, shouldn't go live.

Change-Id: I62c63e20c94ddc25c5c291ba42afd28e153b34a6
2023-05-12 10:23:31 +00:00
rrana-wmf 38c73d9b7a Add getMultiHttpClient function to make HTTP requests to Mathoid.
This add new function named "getMultiHttpClient" to the
MathRestbaseInterface.
The function creates a MultiHttpClient object using the HTTP
request factory.

This function will be useful for making HTTP requests to Mathoid.

Add test case for getUrl() method.

Bug: T335347
Change-Id: If208753edfdb3017f722c97cea7653170d05f8a5
2023-05-11 17:58:50 +00:00
daniel 3fa7837cee Add test case for MathRestbaseInterface::batchEvaluate
This test case ensures that responses from RESTbase are processed
correctly.

Change-Id: I5fbd45ac5e61a6294817617a6784846ae815fd6e
2023-05-11 19:58:26 +02:00
daniel 38e649c722 Math: test usage of URL in HttpMultiClient
Change-Id: I063319ad1b12d66d2054846e6c3b27c715ca3d31
Co-Authored-By: <rrana-ctr@wikimedia.org>
2023-05-08 18:19:30 +00:00
Stegmujo b1edd31543
Fix issues with DQ
Bug: T315978
Change-Id: I04c9178ce5785f29ab79de6dc82070465efca611
2023-04-20 10:57:04 +02:00
Stegmujo 6e0427c2ba
Fix for attributes in named Operator
Bug: T315978
Change-Id: I7277d03bae031ffcb2995c097f92c795cc2637dd
2023-04-06 13:44:58 +02:00
Stegmujo c9cf3814ac
Fix for carriage return
Bug: T315978
Change-Id: I06728d45daa060655e655bb07717f23eef61a955
2023-04-06 11:40:54 +02:00
jenkins-bot df0fbc7ebd Merge "Fix style tag imbalance" 2023-04-06 07:10:30 +00:00
Stegmujo fa1a5a4b3f
Fix style tag imbalance
* sometimes there have been more start-tags than end style tags

Bug: T315978
Change-Id: I6b20d45d7561b084376a54f4d6273a2ff5ed7bb4
2023-04-05 15:48:03 +02:00
Stegmujo 08b16c99df
Fix preceding subscript
* example: "{}_1^2\!\Omega_3^4"
* MMLFullcoverageTest cases: 119, 381
* Add isEmpty method to TexNode
* Add empty mrow for prescripts

Bug: T327391
Change-Id: If60e5211bf43e50465072c049d8c432e621832b8
2023-04-05 13:00:06 +02:00
Moritz Schubotz (physikerwelt) 8c6eeae82e
Remove images from native MathML
In native MathML we only display MathML, also get
rid of enclosing <div / <span container.

Bug: T182041
Change-Id: I26bc4ea88d360d53cc7a34a89bef78812b84b2ea
2023-03-31 08:57:55 +02:00
Stegmujo 5de6683c05
Fix colors
* some tests for checking colors

Bug: T327391
Change-Id: I437f8d72834f3cca7c21f97841ee4da2f1f36ed5
2023-03-27 14:42:27 +02:00
Stegmujo 030143cf14
Fix texstyle when rendering limits
* case index in FullCoverageTest: 144

Bug: T332183
Change-Id: I4bc427c00ffc83d53a91b094c7bde05a816f0f98
2023-03-24 16:15:45 +01:00
Stegmujo 0df4e38547
Fix derivatives
* indices in FullCoverageTest: 114, 124

Bug: T331998
Change-Id: I99724427b77e14044070d330758fb38a55032a10
2023-03-24 11:42:29 +01:00
Stegmujo 426a67fbd7
Fix P rendered as pilcrow
* contains a minor fix for spacings, so that they are rendered by spacer
* and some minor fixes for section sign
* MMLFullCoverageTest cases: 216

Bug: T327391
Change-Id: I124e7aec5552dec98a8292e5bdb9449a3009560a
2023-03-22 14:28:57 +01:00
jenkins-bot 6e0181335f Merge "Fix spaces not rendering if within mtext" 2023-03-21 18:46:03 +00:00
Stegmujo 5f9ca781d1
Fix spaces not rendering if within mtext
* MMLFullCoverageTest case: 260

Bug: T327391
Change-Id: Ifd858216b646efd53c401ac9bcddfc7fb1c1a933
2023-03-21 14:57:55 +01:00
Stegmujo ad2a6b7fef
Fix spaces and commas differentiation
* escaped semicolon/commas get rendered as spaces, non escaped get
  rendered as text
* MMLFullCoverageTest cases: 4,5,66

Bug: T327391
Change-Id: Icfa557fc43a8ac87fbf856795cb9c26d0fb2c456
2023-03-21 13:56:22 +01:00
Stegmujo 1fa5ad3217
Fix preceding not
* indices in FullCoverageTest: 58,59
* fix a minor issue with less and greater signs to escape case 58
correctly

Bug: T331998
Change-Id: I29265f7954552423924dfc898fd36ec1b387e198
2023-03-16 11:46:53 +01:00
Moritz Schubotz (physikerwelt) c560ff0cd8
Remove MathPlayer
* MathPlayer stopped working around IE8

Bug: T298971
Change-Id: I759a5dc61eaf27a99d952366cf9c4380748f8e82
2023-03-15 10:20:13 +01:00
Stegmujo b843a09e92
Fix for limits
* example: "\lim\limits_{x \to 2}"
* case 4 phabricator: "limits-case"
* index: 411

Bug: T327391
Change-Id: I9a91e4cf49c9df89fb610057484165069f5c7e50
2023-03-14 11:10:31 +01:00
jenkins-bot ad668a6e69 Merge "Fix for sideset case" 2023-03-13 15:57:52 +00:00
Stegmujo b7d909e0a2 Fix for sideset case
* example "\sideset{_1^2}{_3^4}\sum"
* case 3 phabricator "sideset"
* index: 90
* since result has multiscripts which is not generated by mathoid, there is an explicit test in MMLRenderTest and the previous test is in MMLTexVCUtilTest is skipped
* in MMLGenerationTexUtilTest test for sideset is deactivated
* adds a case from FullCoverageTest for sideset with FQ
* fixes an issue which occured during Phan checks for merging that genFrac throws an error

Bug : T327391

Change-Id: I4c5a5f5a901dbc906f5a1b168d3a8d04f25b9290
2023-03-13 15:38:04 +00:00
libraryupgrader dcce2100d0 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 39.0.0 → 41.0.0

npm:
* cookiejar: 2.1.3 → 2.1.4
  * https://github.com/advisories/GHSA-h452-7996-h45h
* http-cache-semantics: 4.1.0 → 4.1.1
  * https://github.com/advisories/GHSA-rc47-6667-2j5j
* ua-parser-js: 1.0.2 → 1.0.34
  * https://github.com/advisories/GHSA-fhg7-m89q-25r3

Change-Id: I4198e1cbdc115d27c9fe5b8d0ce813b514524796
2023-03-12 05:44:17 +00:00
Moritz Schubotz (physikerwelt) 88a4c8bc1d
Add minimal native MML mode
* Add minimal POC for native MathML rendering.
* (minor) convert string-based reference to MathConfig to proper access
  method.

Missing:
 *  Error handling
 *  Image fallbacks

Bug: T331047

Change-Id: I7e644c4688cca7fc9af0d54bdc260268c1f6b9df
2023-03-02 20:50:29 +01:00
Stegmujo 8101c8f136
Fix for tex-statement definecolor
* example "\definecolor{ultramarine}{RGB}{0,32,96} a {b \color{ultramarine} c} d"
* case 2 phabricator: "colors"
* index: 22
* some test for parsing color statements

Bug: T327391
Change-Id: I98fdf011a2089dad4e7cb5a7a6aa8433fafe4a94
2023-03-02 11:35:27 +01:00
Stegmujo 8f81eabc83 Add more detailed testcases for Color, Pagecolor and Definecolor
* case 2: "colors"
* in MMLGenerationTexUtilTest.php
* Updated the keyfiles etc

Bug: T327391
Change-Id: Id3232f21dea9813ec5adcacca58e912cf116ab72
2023-03-01 15:25:50 +00:00
jenkins-bot 64c3f6893a Merge "Add native MathML rendering mode to MathConfig" 2023-03-01 14:25:05 +00:00
Moritz Schubotz (physikerwelt) 642e54c51b Add native MathML rendering mode to MathConfig
Add a new rendering mode option.

Change-Id: I36e2cc542ae89bff03f779a71ddceb77dfac99a9
2023-03-01 13:39:35 +00:00
Moritz Schubotz (physikerwelt) 9340b09c03
Expose parsetree in local checker
In perparation to the PHP only native MathML rendering mode, we expose
the parsetree of the checker.

Change-Id: I8da8d0e236c2b001e664ce707c7469ebe8a91eb8
2023-03-01 08:30:46 +01:00
Stegmujo ef2f59eed5
Fix exceptions thrown by LocalChecker
* for more consistency with the other Checker initialisations in
InputCheckFactory

Bug: T327098
Change-Id: Ia85775dea6a7dda5fcf42d66a161da49515ba0aa
2023-02-27 17:52:28 +01:00
Stegmujo 6ffaed440c
Remove additional mi for Hbox cases in TexUtilTest
* fix results for tests
* testindices 53 to 58
* formerly this contained a comparator fix (rolled back)

Bug: T327392
Change-Id: I1af65d5d8a4625d164630254da285830f4c9e0a3
2023-02-16 20:25:48 +01:00
Stegmujo 14c38c8f46
Fix vline in Matrix in TexUtilTest
* case index 654

Bug: T327392
Change-Id: I3f7d22ff501a30eef79baf82236406d8f5e450ae
2023-02-16 17:16:19 +01:00
jenkins-bot d6de86cba3 Merge "Allow \circ command in bonds in TexVCPHP" 2023-02-16 09:03:23 +00:00
Stegmujo bcc066de21 Fix GenerationParserTest for texvctreebugs check
* fix the testfile so it can be read correctly for texvctreebugs category
* fix the test that category can be selected dynamically

Bug: T327391

Change-Id: I51508bddb83ba925c739962df41c04f1ccfd311b
2023-02-15 14:07:05 +00:00
Stegmujo 65b3114e5b
Allow \circ command in bonds in TexVCPHP
Add \circ to mhchem macros to allow them in bonds.

Bug: T328833
Change-Id: I3100033904e28a181a2e674da388832678eb0db3
2023-02-15 14:25:30 +01:00
Stegmujo 1865fbf31b Fix low scores for oint statements
Bug: T327392

Change-Id: Ia4afc6d6674793ee5d120b20d1ce6f60a12d5e4a
2023-02-13 15:11:54 +00:00
Stegmujo 39c400a431 Fix Parsing of Mod elements with and without params
* some adaptions to test and comparator
* minor fix in mappings for ncong
* introduce a LaTeXML Fallback for the tex-cases:
** "\ce{\ca}"
** "\mod"

Bug: T327392

Change-Id: Ie2efa392bd517a28fe8b6e8d0cecdba64cd1c415
2023-02-13 12:23:44 +00:00
Stegmujo dbf15a72c6 Fix parsing functions for MMLGenerationTexVCUtilTest
* for "oint","ointctrclockwise", "varointclockwise."
* some ignored attributes added to similarity algorithm

Bug: T327392
Change-Id: Id4cf720bb2d2c8aeb524c2303bdf0d4be3547404
2023-02-08 14:30:46 +00:00
Stegmujo 5eba9b74a0
Optimize Test Parametrization
* For MMLGenTexVCUtilTest and the MMLComparator
* Also skip some inputs which are not supported

Bug: T327392
Change-Id: Ifac913e2b8e4c70c7222f769c0e7cf93e65de5b8
2023-02-06 17:13:38 +01:00
Stegmujo be8725c1d2
Add New TexUtil-Reference which also has Chem
* Update maintanance script with Chem-Fallback
* delete obsolete MML Lookup (was from mathjax-full)
* TexUtil-Ref is created without chem fallback

Bug: T327388
Change-Id: Id603d66feccf3716828c2aac57acac7d23131ddf
2023-02-06 16:30:25 +01:00
Stegmujo 17d9ade3f2 Insert MathML-Comparator features in MathML-Tests
Bug: T327393
Change-Id: I1d781587cf62d034493a06a4a9640d0dd14c8386
2023-02-03 14:58:52 +00:00
Stegmujo a1cddd7e0d Add MathML-Comparator algorithm for the automated tests
* Compares two MathML trees
* Calculates F-Score and Diffs

Bug: T885309
Change-Id: Iabdb5b12054e4c1ce6e2c756643bafd371da6fb0
2023-02-03 10:24:17 +00:00
Stegmujo 8d522c4022 New lookups for tests enabling reference MathML
* For the existing MMLGeneration...Tests, reference MathML has been generated
for mathoid and latexml within reference files in json.
* The creation of json files was done with JsonToMathML script
* The test-classes have been adapted a bit, so they can read the new reference files.
* MMLGenerationTexUtil test has export function for input
for maintenance-script for

Bug: T327388
Change-Id: I05a8c7bb5e37cf75faf09ec43e9ce2acc7bf2040
2023-01-27 20:52:10 +00:00
Stegmujo ada1d6e3db
Add Full-Coverage Test TexVC-MMLGeneration for Mathoid-LateXML
* Implemented multiple-column generation for the HTML-Generator
* Items can be skipped in test by defining index

Bug: T327386
Change-Id: I13148d58246ddcc1f2e6dcd14fa5b4255a1fb8e7
2023-01-26 13:12:19 +01:00
jenkins-bot 347dcbd3fe Merge "Fix significant typo in grammar" 2023-01-03 16:02:27 +00:00
jenkins-bot 6153004078 Merge "Improve security of MathML output" 2023-01-03 15:28:24 +00:00
Moritz Schubotz (physikerwelt) 7b425a5500
Improve security of MathML output
Avoid that user input is passed to the HTML output directly by using
HTML methods for tag generation. This also enables additional phan checks.

Change-Id: Iff584ac829c190e413a36331c53d6835a86bc0d5
2023-01-03 15:47:54 +01:00
Moritz Schubotz (physikerwelt) 0aecf2ab10
Expand texvcjs comparison test
* Currently the regression test only tests if all formulae that passed the test before still pass the test

* This change also compares the output

Change-Id: Ib667de2e7e512cf7d045e28a19c6a5f7d994dfc6
2022-12-30 19:53:31 +01:00
Moritz Schubotz (physikerwelt) 81fa5b0c97
Fix significant typo in grammar
* Uq and Dq was mixed
* Simplify regeneration of grammar for node developers
* Speed up npm test by ignoring local test json files

Change-Id: Iec273dcc967be46d3df52260fc56f1969667e497
2022-12-30 16:58:39 +01:00
Moritz Schubotz (physikerwelt) e4affc08ec
Fix HTML testtable generation
* Do not generate a new table for every case

Change-Id: I0352a30e66fc7c43ac18e5a09b5794bc50a9b98c
2022-12-29 11:03:29 +01:00
jenkins-bot 5ad3a47d0d Merge "Improve test coverage for nodes" 2022-12-28 20:45:52 +00:00
jenkins-bot 98aeec1201 Merge "Add tests for more TeX statements" 2022-12-28 19:40:11 +00:00
Moritz Schubotz (physikerwelt) b9e297c4ec Improve test coverage for nodes
* Use merror instead of plain strings for not implemented functions

Change-Id: If20559e05f3b0c8921a28c623102b8f4788a3c94
2022-12-28 19:18:21 +00:00
Moritz Schubotz (physikerwelt) 469c698e47
Improve checking performance
* Report only on used packages if requested

Change-Id: I5b4fc6d7e571206f5b5d41d3bf268251ed1a8677
2022-12-28 13:34:23 +01:00
Stegmujo 6581889158
Add tests for more TeX statements
* These can be used for development purposes

Bug: T302628
Change-Id: I620b0a44b30b88a68f8f806b9c20ddabfe227573
2022-12-28 11:34:45 +01:00
jenkins-bot 00e7d44ec6 Merge "Use named data sets in AllTest" 2022-12-28 09:30:57 +00:00
Moritz Schubotz (physikerwelt) b0cacbc1a6
Use named data sets in AllTest
Change-Id: Ia8ceb06f2d2ec5a4f5935fb0d4b6e95e466ce002
2022-12-28 09:46:19 +01:00
Moritz Schubotz (physikerwelt) 70acbd7ea4
Fix missing curlies in chem nodes
* the php implementation had fewer curlies compared to the
  js implmenetation

* remove unused function name (could be replace get_class)

* Add testcase for declh

Change-Id: I8132604a659d7ddf98e1f73686b40ff0591229f3
2022-12-28 00:56:47 +01:00
Stegmujo 783797bb9a
Add test for basic MML Methods
Bug: T302628
Change-Id: Ib3d781a516e53392fb09a2c70b322805dcb43fcf
2022-12-23 22:46:59 +01:00
Umherirrender 6e424c2e4a Replace comment about deprecated Http::post
Bug: T305813
Change-Id: I1975fd473c8d57ab7e43a47ea4da3d4f33fac68c
2022-12-11 15:04:59 +01:00
Moritz Schubotz (physikerwelt) cbd67195f5
Update positive regression tests
Adapt test running structure to the new structure for good tests
coming from texvcjs.

Change-Id: I330bb3f8f0c6f379d624986827f96946af1d4c12
2022-12-06 10:59:39 +01:00
thiemowmde 566944c42d Fix broken/incomplete regex patterns in TexNode::texContainsFunc
I compared with
6c6988c4f6/lib/astutil.js
and found two mistakes:
* Missing space at the end of the color regex.
* Not enough backslash escaping in the last regex.

Note how the code in lines #116 and #130 is now identical.

Change-Id: I13b75ad4a1e4da0766c0d73b8786b21865945697
2022-12-01 17:05:30 +01:00
thiemowmde f09ce3134b Add many more testcases for TexNode::texContainsFunc()
Positive as well as negative tests. This patch intentionally doesn't
touch the implementation but simply documents how the code currently
behaves.

Change-Id: Ib670ad680087e520f4a99e932e5a2a9fd2d115de
2022-12-01 16:57:28 +01:00
thiemowmde f459b0b305 Rewrite TexNodeTest to use @dataProviders
Personally I find this easier to read. It allows to maintain a compact
list of input values with the expected output.

Change-Id: Ifeb532e2b94c674b512b3c40f101977939b83cd5
2022-12-01 16:34:40 +01:00
jenkins-bot 99b1b231c5 Merge "Fix assert functions in En-MediaWiki-Testcase" 2022-11-29 20:12:52 +00:00
jenkins-bot 04c839d680 Merge "Skip tests that are known to fail" 2022-11-29 19:38:44 +00:00
Stegmujo d4418049c8
Fix assert functions in En-MediaWiki-Testcase
Change-Id: I9355d86e9a482fa2f86aac19a2018a6ad149ef20
2022-11-29 20:29:11 +01:00
thiemowmde f4ed725712 Fix and add test for "0" special case in TexNode
We fixed this in I47b6d5b but broke it again in Ie8d8106. Let's
finally add a test for this edge-case.

Change-Id: I9a43518f9edf0fab05e76bbb02a30fefd039b77d
2022-11-29 12:11:15 +01:00
jenkins-bot a58d9c39d3 Merge "Various code cleanups, more compact syntax and such" 2022-11-29 10:21:02 +00:00
Moritz Schubotz (physikerwelt) 7ecce2a104
Skip tests that are known to fail
* don't return on skipped tests
* add some additional non math test cases

Change-Id: Ia389141693a2e2ed6dea4294549674402e109d64
2022-11-27 15:08:56 +01:00
Thiemo Kreuz 7dbc300a5f Various code cleanups, more compact syntax and such
Some notes:
* Note that array_column() strips array keys. I checked and this is
  fine here.
* Html::element() will skip attributes that are set to null or false.
  Perfect fit here.
* I routinely remove comments that do notjing but repeat what the
  code already says.

Change-Id: Ie7797b78f1af5d8404c9e97b333fac8c6b3ac85e
2022-11-23 15:36:22 +01:00
Moritz Schubotz (physikerwelt) b3e57cbfc2 Make code using the Math.CheckerFactory service discoverable
Otherwise IDEs and other tools don't know what's going on.
...->getService() returns mixed.

Change-Id: If0429485941c19eb0e88896cb1ada66a5320bafe
2022-11-23 12:10:32 +00:00
jenkins-bot e0f6e21ac7 Merge "Remove PNG rendering mode" 2022-11-22 19:07:20 +00:00
thiemowmde 67906845ff Make use of ?: and ?? shortcut syntax where it makes sense
I hope this makes the code more readable.

Change-Id: Ie458551d26cd8c8cd6e1cc18789d93176230f0d4
2022-11-22 12:29:44 +01:00
Moritz Schubotz (physikerwelt) 110656335f Remove PNG rendering mode
Removes functionality to
* select PNG rendering mode
* automated fallback to PNG images for SVG rendering
* PNG mode related class and tests

However, PNG images received from mathoid / restbase are still stored.

Bug: T311620
Change-Id: I595926027433182cc0396570bc3f1ce0cd2cafb3
2022-11-21 18:57:27 +00:00
jenkins-bot 4b6137bed4 Merge "Avoid try…catch where if…else will do when using LanguageFactory" 2022-11-21 08:57:13 +00:00
Bartosz Dziewoński 1b7a46ff4f Avoid try…catch where if…else will do when using LanguageFactory
Needed for I869af06896b9757af18488b916211c5a41a8c563, where I am
trying to change LanguageFactory in MediaWiki core not to use
MWException.

I truly feel mocked after working with this code. See if you can find
the two lines in this diff where the meaningful changes are.

Change-Id: Ifcb31dbb7113ce57526f06558cde2abedee317d7
2022-11-18 21:08:24 +01:00
Reedy 6081e9b01a DeclhTest: Fix string interpolation
Bug: T314096
Change-Id: I1c2a11c1481ca7d8e91e9c0468600ace9038e333
2022-11-04 18:08:02 -06:00
jenkins-bot 3dcdbbd95b Merge "Fix Perfomance Issues of TexUtil" 2022-10-25 18:10:09 +00:00
jenkins-bot ded8f70772 Merge "Activate chem and inline-tex type input in LocalChecker" 2022-10-25 17:50:31 +00:00
Stegmujo b5d3bca4b4 Fix Perfomance Issues of TexUtil
TexUtil gets instanciated and loads a json for each node in Literal and Fun1. This is not necessary since it takes much RAM and time to load the corresponding JSON from files.

Bug: T321599

Change-Id: I91855ebc4437f075302ae13d367ca4902cc0f3ba
2022-10-25 17:44:02 +00:00
Stegmujo c74ced3716
Activate chem and inline-tex type input in LocalChecker
Bug: T321262

Change-Id: Ib8e55290cc77cdc07274e7f1dbd27d20db0f3227
2022-10-25 18:35:54 +02:00
Stegmujo d2bd2f4554
Add Tests and Downloader for Chem Input Types
Bug: T321262

Change-Id: I4e0af8ab0eaa02829dffb7ff5fccc4564ed5c1ba
2022-10-25 16:55:58 +02:00
Stegmujo caf3a1e26b
Add All Wikipedia Tests and Fixes
These tests are skipped in CI, but are ran locally.
Contains also preliminary fixes to make the assertions not crash
locally and a shellscript for downloading the json-file with tests locally.

Bug: T315223

Change-Id: If5da7e2a29d9179eabecbb4707ed244f5d445d39
2022-10-25 15:32:53 +02:00
Stegmujo c27f7edef9 Add Integration for the TexVC-PHP check to Math
Bug: T312528

Change-Id: I0eda7d4213a5f703ab7ae7887aa364af9e576dbe
2022-10-20 16:39:19 +00:00
Stegmujo 8333e2541a Create Tests for Parser and TexVC
Parser.php is excluded from linting steps.

Bug: T312528

Change-Id: I372832bb9ea212f9bc06947d0ef192f270dc54c2
2022-10-19 17:25:20 +00:00
Stegmujo ba47c32e1d
Add Node and Util fixes for Parser.php
For development history of this changeset see:
Id96a4b1b55e3959aab81f4ba436c5ac125f2a1bb

Bug: T312528

Change-Id: I61cfdbd63f8d50b072ada05927a134686fdd53d3
2022-10-19 16:33:15 +02:00
Stegmujo 2ae8f50348
Add final nodes
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: I01b99430d510c0df452d1faba340e2595ae50a33
2022-09-06 14:42:37 +02:00
Stegmujo d940161a3e
Add further nodes
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: I8bd30bc45d2c23214b317ca0c04aa8e7d6a2da33
2022-09-02 19:34:07 +02:00
jenkins-bot bfcb547e63 Merge "Minor: MathDatabaseTest cleaning" 2022-08-26 17:15:36 +00:00
jenkins-bot 008f6a6739 Merge "Add some basic nodes and texUtil" 2022-08-26 17:06:28 +00:00
jenkins-bot 1d3bbf8fe7 Merge "tests: Skip schema test for sqlite/postgres" 2022-08-26 16:45:54 +00:00
Moritz Schubotz (physikerwelt) 7cae2517e5
Minor: MathDatabaseTest cleaning
* Remove unused constants
* Refactor deprecated wfGetDB

Change-Id: I926fbe59fd2fef9617da9870b8b9c2a6662f22df
2022-08-26 18:23:50 +02:00
Stegmujo 6be5724740 Add some basic nodes and texUtil
Texutil related functionalities and tests will come in other changeset.
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: Iead338a31403348603442b43ae802270f6b1d675
2022-08-26 15:41:38 +00:00
Stegmujo 4901388cfc
Add TexNode
This is corresponding to 6c6988c4f6/lib/nodes/texnode.js

Bug: T312528
Change-Id: Idfd6826e6d15c0e70848e879dd23fc5e4cf113b5
2022-08-23 08:43:01 +02:00
AndreG-P 951dec1fab
REST API endpoint for popups
Implement a rest API endpoint that displays the popup that is currently
only shown on a special page.

Code was revived from Idd22057a88312bf1a1cb5546d0a6edca5678d80d

Bug: T288076
Bug: T233099
Change-Id: I65fcbf25ac5818f6c649daf494c719921247e8f5
2022-08-05 17:47:44 +09:00
AndreG-P 14c4df1336
Support new properties 'Symbol Represents' and 'In Defining Formula'
Add support for the new properties 'P9758' (symbol represents) and
'P2534' (in defining formula) for the special page that shows
in depth information about tagged formulae.

Bug: T312893
Change-Id: I39551e04487f77cca60c89e8c95293032fd5bd6a
2022-07-27 22:30:54 +09:00
Moritz Schubotz (physikerwelt) 480d241f97
Make dependency to Wikibase client config optional
The MathEntitySelector gets its config from wbRepo which caused a hard
dependency on the Wikibase client.
If the Wikibase client config is not available a default value (wikidata)
is used to determine the URL of the foreign repo.
As the dropdown will never do write operations, we restrict the repo
access to anonymous read only.

Bug: T313143
Change-Id: Iba33dfd32a78f4ad7c2e99a1f56218458ab884b4
2022-07-25 09:51:47 +02:00
jenkins-bot 12ca486684 Merge "Replace MathWikibaseConfig with ServiceOptions" 2022-07-25 07:10:18 +00:00
jenkins-bot 53a2ea9909 Merge "Provide static Factory Class for Math related services" 2022-07-25 05:52:32 +00:00
Moritz Schubotz (physikerwelt) 882c49599b
Replace MathWikibaseConfig with ServiceOptions
MathWikibaseConfig introduced additional complexity by passing through
some services to MathWikibaseConnector.
The remaining options were just a list of properties that could also be defined as ServiceOptions.

Bug: T313646
Change-Id: Ib9083c0cb62f6d972befc7f5dc3ed47f55cf92a5
2022-07-23 11:37:30 +02:00
Moritz Schubotz (physikerwelt) 73c41b4626
Provide static Factory Class for Math related services
Initially we provide one service. More services will come in
the future.

Change-Id: I98a0f5f181f729e123a063dabf3597b5effa55b8
2022-07-22 18:59:11 +02:00
Moritz Schubotz (physikerwelt) 0bec9dc904 Remove deprecated method hasSite
The method always returns true and has no obvious benefit.

Change-Id: I77727d37c16e6234cf13e0ccf5d8fe94142ddd2a
2022-07-22 12:51:21 +00:00
Moritz Schubotz (physikerwelt) a274beae78
Transform MathWikibaseConfig into a service
* add some basic tests
* migrate MathWikibaseConnectorTest to a unit test

Bug: T313331
Depends-On: Ic3b8d4f685d5cf648a02696284b6ee499502a12a
Change-Id: I38d6425eb5e2c52ae4362c4b8656223a8d9d90a5
2022-07-21 15:22:47 +02:00
Moritz Schubotz (physikerwelt) a8052d564b
Transform MathWikibaseConnector into a service
* add some basic tests
* MathWikibaseConfig should also be transformed into a service in a follow
up to allow for better testing

Bug: T313331
Change-Id: Iec7446a06d9a117cdeba9d26616f4fdf8e8540ca
2022-07-21 08:34:25 +02:00
Umherirrender e176ed68c3 tests: Skip schema test for sqlite/postgres
Running the updater twice (in test setup and in tests) confused posgres
-> Error 42P07: ERROR:  relation "mathoid" already exists

Change-Id: I1113888a38a49ee79b94d83c305eb99baa75f802
2022-07-19 21:06:45 +02:00
Stegmujo c60565c790 Remove some unused methods.
Bug: T310350
Change-Id: I0629b9a963bf57b1368ffc61f7c3b631b19f5260
2022-06-27 18:20:06 +00:00
russ-rogovetz 894c22989b
Replace getNativeData to getText for Math
Replace Content::getNativeData() calls with TextContent::getText() in Math extension.

Bug: T283679
Change-Id: Iaf3b7f82f14069374de8ede7b519d822f8d6010f
2022-05-30 21:04:39 +02:00
osamaahmed17 099e327cc6 selenium: Refactor WebdriverIO tests from sync to async mode
WebdriverIO has dropped support of sync mode due to breaking changes in Chromium, hence all tests have been changed to async.

Update npm packages: @wdio/*, wdio-mediawiki and webdriverio because async mode needs at least webdriverio v7.9.

Remove npm package: @wdio/sync.

Bug: T293076
Change-Id: I35b3b29c09e80306d14a12c5194efeead22a9804
2022-02-01 01:24:19 +11:00
Umherirrender e2e4f1cb6b Use ParserOptions::newFromAnon instead of ParserOptions::newCanonical
ParserOptions::newCanonical is deprecated.

Change-Id: I8e709cd4e1b2dbf86f10176a3bbc5854d463ede0
2021-12-18 20:10:48 +01:00
Alexander Vorwerk ee2867db2d MediaWikiTestCase -> MediaWikiIntegrationTestCase
MediaWikiTestCase has been renamed to MediaWikiIntegrationTestCase in 1.34.

Bug: T293043
Change-Id: Icef9bbb1c515b775ccdcf6bc692c8c2cab4ae503
2021-10-12 00:51:10 +02:00
Reedy df89742072 Remove global namespace class aliases
Depends-On: I7e8e7f5ec0ac2f995489a559e88fc55ab877e06e
Change-Id: Ie3f5d5880363777eda4608fe8753a69e7ff3c5f9
2021-10-01 16:30:09 +00:00
Petr Pchelko cfc2f4f319 Register 'math' parser option
Instead of modifying a page rendering hash,
use the proper mechanism of parser option
registration. The cache is still split on parser
option value. The 'math' option is lazy, since
not all pages contain 'math' tag and we want to
avoid an user preference lookup for every parse.

WARNING: this will invalidate ParserCache for
all pages that contain <math> tags, but according
to Moritz, this is about 1% of all pages, so we
should be fine.

Setting up the test is still rather hard and weird
due to very hacky rendering mode to user option
converter, and math renderer interaction with the DB.
This will be cleaned up later.

Depends-On: I92b3e18fabef4eecac2ec2a4844f1be2716e5d89
Change-Id: I3bce04684070ad306685dabbc51267def25773cd
2021-09-30 06:55:54 -07:00
Petr Pchelko b458303fed Move rendering modes name resolution to MathConfig
Change-Id: Ie1926f1da02f6ab585d3efbc71abe1716dac66e5
2021-09-30 06:29:36 -07:00
Petr Pchelko a3306b24df Clean up handling of user preferences
Change-Id: I3e8f0a0be16d92a411de796b8e25df3a7760099f
2021-09-29 10:28:03 -07:00
Petr Pchelko 9b7205599c Move math configuration methods into a service
This is doing a bulk of the job of creating a service
for working with math modes configuration. There's
still things to do, like moving math mode names,
and perhaps depending on default user options to
provide a bit more convenience, but that will be the
next step.

Change-Id: I1259a93651920f44104f2f5135e3e620c858be8d
2021-09-28 13:31:08 -07:00