# A simple manual testbench

wxplot_size:[600,400]$

This testbench allows to test writing and reading of files, to test if rendering works, if the communication with maxima works (Cell/Evaluate all cells) and if the export commands work right.

Limitations:
 * We need more test cases.
 * It isn't an automatic test.

## Completely manual tests

There are a few tests that cannot be run automatically by 
this test bench:
 * If no text is selected the F1 key should start up the help system with help on wxMaxima
 * If a maxima command is selected F1 should start up the help system with help on Maxima instead.

## All cell types

### A text cell

This is a text cell.
It spans over two lines.

Line wrapping in extremely long cells: abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz

An extremely long word: abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
TEst

Two extremely long words: abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
TEst

Two subsequent spaces between words: abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  abcdef  

 A space in front of a long line: abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef  

A text cell that begins and that ends with a newline.

### A subsubsection cell

### Simple input and output cells

Simple input cells without output cell

x(n):=sum(x[i],i,1,n)$

y(n):=sum(y[i],i,1,n)$
z(n):=sum(z[i],i,1,n)$

A input cell with output cell

x;

A simple input cell containing a line break

x+
y;

What happens if the output is multiple lines long?

x(1)=1;x(10)=1;x(100)=1;

### All ways to express a multiplication in TeX

Variable letters that are longer than one character are distinguished by multiplications of single-letter variable names by using \mathit{}.
This means that in this case wxMaxima will have to do the spacing shown in the following output cell by hand.

a*b;
aa*b;
a*bb;
a_1*b;
a_1*bb;
a*b_1;
aa*b_1;

### abs

abs(x(1));
abs(x(10));
abs(x(100));

### diff

'diff(x(1),t);
'diff(x(10),t);
'diff(x(100),t);

### at

x(1)@10;
x(10)@a;
x(100)@t33;

### A conjugate cell

declare(
    [
 c00,c01,c02,c03,c04,c05,c06,c07,c08,c09,
        c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,
        c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,
        c30,c31,c32,c33,c34,c35,c36,c37,c38,c39,
        c40,c41,c42,c43,c44,c45,c46,c47,c48,c49,
        c50,c51,c52,c53,c54,c55,c56,c57,c58,c59,
        c60,c61,c62,c63,c64,c65,c66,c67,c68,c69,
        c70,c71,c72,c73,c74,c75,c76,c77,c78,c79,
        c80,c81,c82,c83,c84,c85,c86,c87,c88,c89,
        c90,c91,c92,c93,c94,c95,c96,c97,c98,c99,
        c100
    ], complex)$
depends(
    [
        c00,c01,c02,c03,c04,c05,c06,c07,c08,c09,
        c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,
    c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,
        c30,c31,c32,c33,c34,c35,c36,c37,c38,c39,
        c40,c41,c42,c43,c44,c45,c46,c47,c48,c49,
c50,c51,c52,c53,c54,c55,c56,c57,c58,c59,
        c60,c61,c62,c63,c64,c65,c66,c67,c68,c69,
        c70,c71,c72,c73,c74,c75,c76,c77,c78,c79,
        c80,c81,c82,c83,c84,c85,c86,c87,c88,c89,
        c90,c91,c92,c93,c94,c95,c96,c97,c98,c99,
        c100
    ], t)$
c_1:  c00$
c_10: c00+c01+c02+c03+c04+c05+c06+c07+c08+c09$
c_100:c00+c01+c02+c03+c04+c05+c06+c07+c08+c09+
      c10+c11+c12+c13+c14+c15+c16+c17+c18+c19+
      c20+c21+c22+c23+c24+c25+c26+c27+c28+c29+
      c30+c31+c32+c33+c34+c35+c36+c37+c38+c39+
      c40+c41+c42+c43+c44+c45+c46+c47+c48+c49+
      c50+c51+c52+c53+c54+c55+c56+c57+c58+c59+
      c60+c61+c62+c63+c64+c65+c66+c67+c68+c69+
      c70+c71+c72+c73+c74+c75+c76+c77+c78+c79+
 c80+c81+c82+c83+c84+c85+c86+c87+c88+c89+
      c90+c91+c92+c93+c94+c95+c96+c97+c98+c99+
      c100$

conjugate(c_1);
conjugate(c_10);
conjugate(c_100);

### ExptCells

exp(sum(x[i],i,1,1));
exp(sum(x[i],i,1,3));
exp(sum(x[i],i,1,100));

### Frac cells

Here we test 
 - if a minus in front of and following the fraction is displayed right,
 - If fractions still work if the denominator is bigger than the numerator
   or vice versa
 - if extremely long fractions are broken into a separate lines

x(1)/y(1);
x(1)/y(10);
x(1)/y(100);x(10)/y(1);x(100)/y(1);

### Function cells

f(x):=3;
f12345689(x):=3;
f12345689012345689012345689012345689012345689012345689012345689012345689012345689012345689(x):=3;

### Image cells

wxdraw2d(
    color=red,line_type=solid,key="solid red",explicit(x,x,-10,10),
    color=black,line_type=dots,key="dotted black",explicit(x+5,x,-10,10)
);

Poldino the guinea pig

An image cell in the middle of the output.

x=1;
wxdraw2d(
    color=red,line_type=solid,key="solid red",explicit(x,x,-10,10),
    color=black,line_type=dots,key="dotted black",explicit(x+5,x,-10,10)
);
x=2;

The following plot contains all linestyles the system might support if 
the configuration option to use cairo was selected.
Support for linestyles greatly depends on the gnuplot used, though.

wxdraw2d(
    color=black,
    line_type=solid,key="solid",explicit(-x,x,0,10),
    line_type=dashes,key="dashes",explicit(-x+1,x,0,10),
    line_type=short_dashes,key="short dashes",explicit(-x+2,x,0,10),
    line_type=short_long_dashes,key="short long dashes",explicit(-x+3,x,0,10),
    line_type=short_short_long_dashes,key="short short long dashes",explicit(-x+4,x,0,10),
    line_type=short_long_dashes,key="short long dashes",explicit(-x+5,x,0,10),
    line_type=dot_dash,key="dot dash",explicit(-x+6,x,0,10),
    line_type=dots,key="dots",explicit(-x+7,x,0,10)
);

### Integral cells

f(n):=sum(f[i](t),i,1,n)$

integrate(f(1),t);
integrate(f(10),t);
integrate(f(100),t);

integrate(f(1),t,0,T);
integrate(f(10),t,0,T);
integrate(f(100),t,0,T);

### Limit cells

'limit(f(  1),t,0);
'limit(f(  1),t,inf);
'limit(f(  1),t,-inf);

'limit(f( 10),t,0);
'limit(f( 10),t,inf);
'limit(f( 10),t,-inf);

'limit(f(100),t,0);
'limit(f(100),t,inf);
'limit(f(100),t,-inf);

### Matrix cells

funmake('matrix,  
    [makelist(i,i,1,10)]
);
funmake('matrix,  
    makelist([i],i,1,10)
);
funmake('matrix,  
    makelist(
        makelist(o+10*i-10,o,1,10)
    ,i,1,10
)
);

### Parenthesis cells

There are three types of parenthesi in wxMaxima:
 * Ordinary Parenthesis
 * Big parenthesis created using a special letter
 * And parenthesis that are assembled of an upper half, an lower half and vertical lines
   inbetween

(x(1  )/10+1)*2;
(x(10 )/10+1)*2;
(x(100)/10+1)*2;
sin((((a/b+1)/c+1)/d+1)/e);

Test the vertical alignment

sin(x/a+sin(x/a+sin(x/a+sin(x/a+sin(x/a+sin(x/a+sin(x/a+sin(x/a+sin(x/a+sin(x/a))))))))));

Test if the vertical size is correct if big parenthesis are broken into lines.

a;sin(a/(b+c/(d+e/f))+qdqwldwqkldkqwlk+wqwqlwqlkdkdlcs+wqqdlqqwlk+wdwqdqwqwlklwqkl+qwfwqflwfqkqwlkwqföl+wqldkwqwlkö+aklsalcakclksa+sqlkqklwqxxqwlxwklq+aslasxklxksxlö);b;

### Slide show cells

with_slider_draw(
    f,makelist(f,f,1,10),
    explicit(sin(2*%pi*f*t),t,0,1),
    grid=true
);

### sqrt cells

sqrt(x(1));
sqrt(x(10));
sqrt(x(100));

### Sub cells

x[x(1)];
x[x(10)];
x[x(100)];

x[x[x[x[1]]]];

### SubSupcells

x[x(1)]^x(1)+1;
x[x(1)]^x(10)+1;
x[x(10)]^x(1)+1;

x[x(100)]^x(100)+1;

x[x[x[x[1]]]]^y^z^a^b;

### SumCells

f(3);

'sum(f(1),t,1,1);
'sum(f(10),t,1,1);
'sum(f(100),t,1,1);
'prod(f(1),t,1,1);
'prod(f(10),t,1,1);
'prod(f(100),t,1,1);

### Pagebreak Cells

## Other features

### Was GnuPlot packaged with a charset that supports greek characters?

wxdraw2d(title="Greek characters: {/Symbol awWl}",
    explicit(sin(x),x,1,10),
    xtics=false,ytics=false
),wxplot_size=[300,150]$

### Highlighting and Boxes

1+box(x(1))+z;

1+box(x(10))+z;

1+box(x(100))+z;

### Item lists

 * Level 1
   Level 1 (continued)
Level 1 (continued again)
 * Level 1
   * Level 2
     Level 2 (continued)
     Level 2 (continued again)
     * Level 3
 * Level 1

Ordinary text 
  * Bullet list item #1
  * Bullet list item #2 is long enough that it is broken into at least two lines. The second line is still indented: Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test 
    After this line break we continue the second item with a long piece of text: Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Ordinary text

### Block quotes

Ordinary text
> quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote 
> quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote
> quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote
Ordinary text

This is ordinary text
 > This is a block quoote. It is long enough that it should be broken into at least two lines. Still every line begins with a quotation marker: Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test 

### Special symbols the export functions recognize

 * A double right arrow (=>)
 * A double dual-headed arrow (<=>)
 * A single right arrow (->)
 * A long right arrow -->
 * A single left arrow (<-)
 * A single double-headed arrow (<->)
 * A equal or less than sign (<=)
 * A equal or greater than sign (>=)
 * A plus/minus-sign (+/-)

Many unicode characters:
αβγδεζηθικλμνξοπρστυφχψωΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ½²³√ⅈⅇℏ∈∃∄⇒∞∅▶▸⋀⋁⊻⊼⊽⇔±¬⋃⋂⊆⊂⊄ħĦ∂∫≅∝≠≤≥≪≫≣∑∏∥⟂↝→⟶∎

### How does the lisp maxima is working with handle special characters?

There once has been a case where maxima interpreted special characters like
an µ correctly - but output them in a way that resulted in a broken xml file
on saving as .wxmx. If after executing the following line the .wxmx file can
be saved and opened again this bug is not present in the currently running
maxima/lisp combination.

wxdraw2d(title="Test of the µ character",
    explicit(sin(x),x,1,10),
    xtics=false,ytics=false
),wxplot_size=[300,150];

print("µ")$

### Uncode characters in general

wrΩαβwf

ö=3;

### wxbuild_info()

wxbuild_info();

### Text that isn't transferred from maxima to wxMaxima using XML

### Test with lines ending in a $

printf(true,"Ordinary text")$

(
    disp("XML Text"),
    printf(true,"Text enclosed by equations"),
    disp("XML Text")
);

printf(true,"Text followed by equations")$
x=2;

(
    printf(true,"Text followed by equations"),
    disp("XML Text")
);

(
    disp("XML Text"),
    printf(true,"Text following equations")
);

### Test with lines ending in a ;

printf(true,"Ordinary text");

(
    disp("XML Text"),
    printf(true,"Text enclosed by equations"),
    disp("XML Text")
);

printf(true,"Text followed by equations")$
x=2;

(
    printf(true,"Text followed by equations"),
    disp("XML Text")
);

(
    disp("XML Text"),
    printf(true,"Text following equations")
)$

### Lisp code

testval:1;

:lisp (defvar $testval2 $testval)

if testval2 # testval then error("The execution of lisp code wasn't successful.")$

## Miscellaneous things that did get wrong at least once

### Leading spaces in front of characters that in XML need to be quoted

One o the following signs should be indented.

print(" <=>")$
print("<=>")$

The contents of this list should still be indented after a load/save cycle.

[
    "test",
    "test2"
]$

### The graphics system

Maxima's INSTALL.win32 does request to test the following commands:

    wxplot2d(sin(x),[x,0,10]);
    wxplot2d(sin(x),[x,0,10],[plot_format,xmaxima]);
    wxplot3d(x*y,[x,-1,1],[y,-1,1]);
scene(cone);
    plotdf([-y,x],[trajectory_at,5,0]);
    load(draw)$
    wxdraw3d(xu_grid = 30, yv_grid = 60, surface_hide = true,
          parametric_surface(cos(phi) * sin(theta),
             sin(phi) * sin(theta),
              cos(theta),
                       theta, 0, %pi, phi, 0, 2 * %pi))$

The new python-vtk interface should create an interactive graphics out of this:

draw_renderer: 'vtk $
draw3d(
  color = blue,
  triangle([0,0,0], [2,0,0], [3,1,2]),

  color = yellow,
  triangle([0,0,0], [2,2,0], [3,1,2]),

  color = gray,
  triangle([2,0,0], [2,2,0], [3,1,2])  ) $

### Former crashes

The following cells at least once crashed wxMaxima on windows and are therefore
included into the testbench:

a: (x+y)^2;

α=1;

α:1;
kill(α);

Bauteilwerte:[
    α=1
];

### Constructs that doesn't make sense but still can be displayed

(makelist(c01,i,1,2)+c01);
%(1);

{0,1}(1);

### A weird windows parenthesis issue

The following equation had a weird parenthesis issue on windows once while it worked fine
on linux.

f(x,y):=x^2*(1-exp((y-sqrt(3*G)*x)^2*(L^2/x^2-0.5)*((R+y)/(R(R-K+y)))/G) )/(R+y)^2;

### Cells we don't want to send to maxima

Some of the following cells would make maxima wait indefinitively
if we actually evaluated them.

(;

[;

{;

);

];

};

(];

(};

[};

/*;

[,];

(,);

{,};

[);

(];

(};

";

### Special cases for the TeX export

Function names should be exported as upright text:

function(x):=10;

For equations LaTeX uses a font that uses spacing that makes clear that ab means "a*b". We therefore
need to make sure that a variable named "ab" isn't displayed in this way.

ab≠a*b;

What makes this more complicated is that the auto-subscript mechanism adds more corner cases here:

a_b*c;
a*b_c;
a_b*c;
aa*b_c;
a*bb_c;
aa*bb_c;
aa_c*b;
a_c*bb;
aa_c*bb;