@@ -456,9 +456,9 @@ public void TestMatrix(string env, string left, string right, string leftOutput,
456456 [ InlineData ( @"\color{red}{{\left( \begin{matrix}1&2\\ 3&4\end{matrix}\right) }}" ) ]
457457 public void TestRedMatrix ( string input ) {
458458 var list = ParseLaTeX ( input ) ;
459- Assert . Collection ( list , CheckAtom < Color > ( "" , color => {
460- Assert . Equal ( new Structures . Color ( 255 , 0 , 0 ) , color . Colour ) ;
461- Assert . Collection ( color . InnerList ,
459+ Assert . Collection ( list , CheckAtom < Colored > ( "" , colored => {
460+ Assert . Equal ( System . Drawing . Color . FromArgb ( 255 , 0 , 0 ) , colored . Color ) ;
461+ Assert . Collection ( colored . InnerList ,
462462 CheckAtom < Inner > ( "" , inner => {
463463 Assert . Equal ( new Boundary ( "(" ) , inner . LeftBoundary ) ;
464464 Assert . Equal ( new Boundary ( ")" ) , inner . RightBoundary ) ;
@@ -1091,43 +1091,43 @@ public void TestNoLimits(string input, string output, bool? limits) {
10911091
10921092 // Sync with CSharpMath.Rendering.Text.Tests TextLaTeXParserTests
10931093 [ Theory ]
1094- [ InlineData ( "0xFFF " , "white" , 0xFF , 0xFF , 0xFF ) ]
1095- [ InlineData ( "#ff0 " , "yellow" , 0xFF , 0xFF , 0x00 ) ]
1096- [ InlineData ( "0xf00f " , "blue" , 0x00 , 0x00 , 0xFF ) ]
1097- [ InlineData ( "#F0F0 " , "lime" , 0x00 , 0xFF , 0x00 ) ]
1098- [ InlineData ( "0x008000 " , "green" , 0x00 , 0x80 , 0x00 ) ]
1094+ [ InlineData ( "#FFFFFF " , "white" , 0xFF , 0xFF , 0xFF ) ]
1095+ [ InlineData ( "#ffff00 " , "yellow" , 0xFF , 0xFF , 0x00 ) ]
1096+ [ InlineData ( "#ff0000ff " , "blue" , 0x00 , 0x00 , 0xFF ) ]
1097+ [ InlineData ( "#FF00FF00 " , "lime" , 0x00 , 0xFF , 0x00 ) ]
1098+ [ InlineData ( "#008000 " , "green" , 0x00 , 0x80 , 0x00 ) ]
10991099 [ InlineData ( "#d3D3d3" , "lightgray" , 0xD3 , 0xD3 , 0xD3 ) ]
1100- [ InlineData ( "0xFf000000 " , "black" , 0x00 , 0x00 , 0x00 ) ]
1100+ [ InlineData ( "#Ff000000 " , "black" , 0x00 , 0x00 , 0x00 ) ]
11011101 [ InlineData ( "#fFa9A9a9" , "gray" , 0xA9 , 0xA9 , 0xA9 ) ]
11021102 [ InlineData ( "cyan" , "cyan" , 0x00 , 0xFF , 0xFF ) ]
11031103 [ InlineData ( "BROWN" , "brown" , 0x96 , 0x4B , 0x00 ) ]
11041104 [ InlineData ( "oLIve" , "olive" , 0x80 , 0x80 , 0x00 ) ]
1105- [ InlineData ( "0x12345678 " , "#12345678" , 0x34 , 0x56 , 0x78 , 0x12 ) ]
1105+ [ InlineData ( "#12345678 " , "#12345678" , 0x34 , 0x56 , 0x78 , 0x12 ) ]
11061106 [ InlineData ( "#fedcba98" , "#FEDCBA98" , 0xDC , 0xBA , 0x98 , 0xFE ) ]
11071107 public void TestColor ( string inColor , string outColor , byte r , byte g , byte b , byte a = 0xFF ) {
11081108 var list = ParseLaTeX ( $@ "\color{{{inColor}}}ab") ;
11091109 Assert . Collection ( list ,
1110- CheckAtom < Color > ( "" , color => {
1111- Assert . Equal ( r , color . Colour . R ) ;
1112- Assert . Equal ( g , color . Colour . G ) ;
1113- Assert . Equal ( b , color . Colour . B ) ;
1114- Assert . Equal ( a , color . Colour . A ) ;
1115- Assert . False ( color . ScriptsAllowed ) ;
1116- Assert . Collection ( color . InnerList , CheckAtom < Variable > ( "a" ) ) ;
1110+ CheckAtom < Colored > ( "" , colored => {
1111+ Assert . Equal ( r , colored . Color . R ) ;
1112+ Assert . Equal ( g , colored . Color . G ) ;
1113+ Assert . Equal ( b , colored . Color . B ) ;
1114+ Assert . Equal ( a , colored . Color . A ) ;
1115+ Assert . False ( colored . ScriptsAllowed ) ;
1116+ Assert . Collection ( colored . InnerList , CheckAtom < Variable > ( "a" ) ) ;
11171117 } ) ,
11181118 CheckAtom < Variable > ( "b" )
11191119 ) ;
11201120 Assert . Equal ( $@ "\color{{{outColor}}}{{a}}b", LaTeXParser . MathListToLaTeX ( list ) . ToString ( ) ) ;
11211121
11221122 list = ParseLaTeX ( $@ "\colorbox{{{inColor}}}ab") ;
11231123 Assert . Collection ( list ,
1124- CheckAtom < ColorBox > ( "" , color => {
1125- Assert . Equal ( r , color . Colour . R ) ;
1126- Assert . Equal ( g , color . Colour . G ) ;
1127- Assert . Equal ( b , color . Colour . B ) ;
1128- Assert . Equal ( a , color . Colour . A ) ;
1129- Assert . False ( color . ScriptsAllowed ) ;
1130- Assert . Collection ( color . InnerList , CheckAtom < Variable > ( "a" ) ) ;
1124+ CheckAtom < ColorBox > ( "" , colorBox => {
1125+ Assert . Equal ( r , colorBox . Color . R ) ;
1126+ Assert . Equal ( g , colorBox . Color . G ) ;
1127+ Assert . Equal ( b , colorBox . Color . B ) ;
1128+ Assert . Equal ( a , colorBox . Color . A ) ;
1129+ Assert . False ( colorBox . ScriptsAllowed ) ;
1130+ Assert . Collection ( colorBox . InnerList , CheckAtom < Variable > ( "a" ) ) ;
11311131 } ) ,
11321132 CheckAtom < Variable > ( "b" )
11331133 ) ;
@@ -1138,18 +1138,18 @@ public void TestColor(string inColor, string outColor, byte r, byte g, byte b, b
11381138 public void TestColorScripts ( ) {
11391139 var list = ParseLaTeX ( @"\color{red}1\colorbox{blue}2" ) ;
11401140 Assert . Collection ( list ,
1141- CheckAtom < Color > ( "" , color => {
1142- Assert . Equal ( "red" , color . Colour . ToString ( ) ) ;
1143- Assert . Empty ( color . Superscript ) ;
1144- Assert . Throws < InvalidOperationException > ( ( ) => color . Superscript . Add ( new Variable ( "a" ) ) ) ;
1145- Assert . Throws < InvalidOperationException > ( ( ) => color . Superscript . Append ( new MathList ( new Variable ( "a" ) ) ) ) ;
1146- Assert . Empty ( color . Subscript ) ;
1147- Assert . Throws < InvalidOperationException > ( ( ) => color . Subscript . Add ( new Variable ( "b" ) ) ) ;
1148- Assert . Throws < InvalidOperationException > ( ( ) => color . Subscript . Append ( new MathList ( new Variable ( "b" ) ) ) ) ;
1149- Assert . Collection ( color . InnerList , CheckAtom < Number > ( "1" ) ) ;
1141+ CheckAtom < Colored > ( "" , colored => {
1142+ Assert . Equal ( "red" , LaTeXSettings . ColorToString ( colored . Color , new StringBuilder ( ) ) . ToString ( ) ) ;
1143+ Assert . Empty ( colored . Superscript ) ;
1144+ Assert . Throws < InvalidOperationException > ( ( ) => colored . Superscript . Add ( new Variable ( "a" ) ) ) ;
1145+ Assert . Throws < InvalidOperationException > ( ( ) => colored . Superscript . Append ( new MathList ( new Variable ( "a" ) ) ) ) ;
1146+ Assert . Empty ( colored . Subscript ) ;
1147+ Assert . Throws < InvalidOperationException > ( ( ) => colored . Subscript . Add ( new Variable ( "b" ) ) ) ;
1148+ Assert . Throws < InvalidOperationException > ( ( ) => colored . Subscript . Append ( new MathList ( new Variable ( "b" ) ) ) ) ;
1149+ Assert . Collection ( colored . InnerList , CheckAtom < Number > ( "1" ) ) ;
11501150 } ) ,
11511151 CheckAtom < ColorBox > ( "" , colorBox => {
1152- Assert . Equal ( "blue" , colorBox . Colour . ToString ( ) ) ;
1152+ Assert . Equal ( "blue" , LaTeXSettings . ColorToString ( colorBox . Color , new StringBuilder ( ) ) . ToString ( ) ) ;
11531153 Assert . Empty ( colorBox . Superscript ) ;
11541154 Assert . Throws < InvalidOperationException > ( ( ) => colorBox . Superscript . Add ( new Variable ( "a" ) ) ) ;
11551155 Assert . Throws < InvalidOperationException > ( ( ) => colorBox . Superscript . Append ( new MathList ( new Variable ( "a" ) ) ) ) ;
0 commit comments