Blame view

epsilon-master/poincare/test/parentheses_layout.cpp 1.05 KB
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  #include <quiz.h>
  #include <ion.h>
  #include <poincare_layouts.h>
  #include <assert.h>
  #include "helper.h"
  
  using namespace Poincare;
  
  QUIZ_CASE(poincare_parenthesis_layout_size) {
    /*      3
     * (2+(---)6)1
     *      4
     * Assert that the first and last parentheses have the same size.
     */
    HorizontalLayout * layout = new HorizontalLayout();
    LeftParenthesisLayout leftPar = new LeftParenthesisLayout();
    RightParenthesisLayout rightPar = new RightParenthesisLayout();
    layout->addChildAtIndex(leftPar, 0);
    layout->addChildAtIndex(new CharLayout('2'), 1);
    layout->addChildAtIndex(new CharLayout('+'), 2);
    layout->addChildAtIndex(new LeftParenthesisLayout(), 3);
    layout->addChildAtIndex(new FractionLayout(
          new CharLayout('3'),
          new CharLayout('4')),
        4);
    layout->addChildAtIndex(new RightParenthesisLayout(), 3);
    layout->addChildAtIndex(new CharLayout('6'), 5);
    layout->addChildAtIndex(rightPar, 7);
    layout->addChildAtIndex(new CharLayout('1'), 8);
    assert(leftPar->size().height() == rightPar->size().height());
    delete layout;
  }