Commit Graph

10419 Commits

Author SHA1 Message Date
Léa Saviot
8a0e5403ae [poincare/test] Add unit conversion tests 2020-02-12 15:13:24 +01:00
Ruben Dashyan
657ae5ff63 [poincare/unit] Fix shallowBeautify
Expressions with Units inside an Opposite were beautifed as Undefined
2020-02-12 15:13:24 +01:00
Ruben Dashyan
22e22b8123 [poincare/tree_handle] Make sure B has the same parent as A after A.replaceWithInPlace(B)
Even when A has no parent, B should be detached from its old parent.
2020-02-12 15:13:24 +01:00
Léa Saviot
4651f7ef0d [poincare/expression] Fix simplifyAndApproximate with convertUnit 2020-02-12 15:13:24 +01:00
Émilie Feral
1484dbc5d4 [poincare] Multiplication::shallowReduce: simplify implementation!
(recursivelyMatches all children is equivalent to recursivelyMatches on
the current node)
2020-02-12 15:13:24 +01:00
Émilie Feral
ff438cbea8 [poincare] Multiplication::shallowReduce: don't apply 0*a --> 0 when a
involves unit or infinity
2020-02-12 15:13:24 +01:00
Émilie Feral
ee1224dd95 [poincare] Multiplication::shallowBeautify: Keep the unit when the value
is 0 or undefined, add tests
2020-02-12 15:13:24 +01:00
Émilie Feral
879843ce2b [escher] LayoutField: reset selection when the field should finish
editing

This fixes the following bug: in solver, input Matrix(Matrix()) and select the
inner Matrix. When handling "OK" event, the "=0" is inserted at a wrong
position leading to a crash !
2020-02-12 15:13:24 +01:00
Ruben Dashyan
2ae435a628 [apps/calculation/calculation] Remove redundancy
When each Calculation had its own text buffer, the Expression of an
overflowing output text was Undefined. Hence that Expression could have
been Undefined without the corresponding text being 'undef'. That situation
may not happen anymore since Calculation are stored in a shared buffer.
2020-02-12 15:13:24 +01:00
Léa Saviot
cb119b796a [poincare/symbol] Use flag RplceAllSymbolsWithUndefAndDoNotRplceUnits 2020-02-12 15:13:24 +01:00
Léa Saviot
c543985094 [poincare] Unit conversion 2020-02-12 15:13:24 +01:00
Ruben Dashyan
1393e5e973 [apps/calculation/calculation] Rearrange the conditions forcing DisplayOutput::ApproximateOnly 2020-02-12 15:13:24 +01:00
Ruben Dashyan
46a5a7cf5c [apps/calculation/calculation] Force DisplayOutput::ApproximateOnly when there is Unit
The most common case where only the approximate output is displayed
happens when the exact and the approximate outputs are equal, more
precisely when the exact output is equal to the approximate output with
the number of significant digits taken from user settings. That
clarification matters for the Poincare::Integers which have more digits than
the number of significant digits set by the user.

Besides, an Expression containing Units is simplified as
Multiplication(Float, Unit...) recorded identically into the exact and
the approximate outputs (except perhaps the number of significant
digits). Generally, the case where the number of digits in the output is
smaller or equal to the user setting would be matched by the condition,
stated above, that exact and approximate output are equal. But that
should also be the case whatever the number of significant digits. That
is why the presence of Units is matched specifically.
2020-02-12 15:13:24 +01:00
Émilie Feral
4bcb3283c2 [escher] TextField: handleEventWithText: don't move the cursor position
if the text could not be inserted
2020-02-12 15:13:24 +01:00
Émilie Feral
0ffcf34eb7 [escher] TextField: make the handleEventWithText behaviour consistent:
when a text cannot be inserted because it overflows the buffer, don't
add anything

insertTextAtLocation already behaves like this but handleEventWithText
used to cap the inserted text which sometimes leads to a different
behaviour - it would insert a truncated text
2020-02-12 15:13:24 +01:00
Émilie Feral
0c55ea4531 [ion] unicode: UTF8Helper::CopyAndRemoveCodePoints returns a boolean
which is true if the whole source was copied
2020-02-12 15:13:24 +01:00
Ruben Dashyan
0a61e0f7bc [apps/shared/round_cursor_view] Add warning about getPixels 2020-02-12 15:13:24 +01:00
Ruben Dashyan
8d3f86c77f [kandinsky/context] getPixel only if in the clipping rect
Fixes the redrawing of RoundCursorView when its frame overlaps the
clipping rect.
2020-02-12 15:13:24 +01:00
Ruben Dashyan
7b8f7007c4 [kandinsky/context] Inline in header file 2020-02-12 15:13:24 +01:00
Ruben Dashyan
63424fb98b [apps/*/function_graph_controller] Factor selectFunctionWithCursor 2020-02-12 15:13:24 +01:00
Ruben Dashyan
246a9aa7a4 [apps/shared/function_graph_controller] Clarify function selection in initCursorParameters 2020-02-12 15:13:24 +01:00
Ruben Dashyan
1cdd61ea47 [apps/shared/function_graph_controller] Do not compute the numberOfActiveFunctions repeatedly 2020-02-12 15:13:24 +01:00
Ruben Dashyan
503a9ed128 [apps/shared/round_cursor_view] Fix GRAPH_CURSOR_SPEEDUP macro usage 2020-02-12 15:13:24 +01:00
Émilie Feral
9d1a5ea0a8 [escher] LayoutField: fix putCursorRightOfLayout to update matrix
layouts if necessary
2020-02-12 15:13:24 +01:00
Émilie Feral
18b4514412 [python] port: add a comment abouth how we use setjmp 2020-02-12 15:13:24 +01:00
Léa Saviot
2318019d7b [apps/solver] Center used/ignored variables messages 2020-02-12 15:13:24 +01:00
Léa Saviot
9200e6062d [aps/solver] Reset the solution selection when leaving the view
Solve an equation that has solutions, select a solution, then go back
and change the equation. WHen you go to the solutions, the previous
solution is still selected, which is a little weird
2020-02-12 15:13:24 +01:00
Émilie Feral
fdb1417a02 [buil] emscripten toolchain: fix build with emmc version >= 1.39.5 2020-02-12 15:13:24 +01:00
Léa Saviot
bb2e8ad3c5 [apps/settings] Fix selection
Scenario: Got to About menu, press 6 on FCC ID then cancel, there are
two selected rows
This reverts 41e41b8d4 with a better fix
2020-02-12 15:13:24 +01:00
Léa Saviot
963edd5c35 [apps/solver] Fix addition of "=0" to equations
ShiftRight no longer puts the cursor at the end of the text/layout.
2020-02-12 15:13:24 +01:00
Léa Saviot
c5315189ac [apps/solver] Fix SolutionsController::k_maxNumberOfVisibleCells 2020-02-12 15:13:24 +01:00
Émilie Feral
de74aa7e59 [python] Enable PYSTACK for emscripten platform: this "fixes" bug
probably due to gc_collect (we suspect that transpiled C does not have
access to javascript variables preventing it from collecting all
required roots and leading to deleting objects prematuraly). Enabling
PyStack reduces the use of the heap and fixes the bug.
2020-02-12 15:13:24 +01:00
Émilie Feral
58acedfd34 [python] Test: inline code to avoid changing runCode behaviour 2020-02-12 15:13:24 +01:00
Léa Saviot
f7892d887f [poincare/tokenizer] Fix popToken with greek code points 2020-02-12 15:13:24 +01:00
Ruben Dashyan
a13ce5df49 [poincare/test/simplification] Test simplification of units 2020-02-12 15:13:24 +01:00
Léa Saviot
ae3fa46191 [escher/text_field] Fix handling of \n
The buffer length did not take into account the \n removal. In fact, we
could just remove the \n while also removing the empty code points,
which is what we do now.
2020-02-12 15:13:24 +01:00
Léa Saviot
4b996b333b [poincare/empty_context] Add missing file 2020-02-12 15:13:24 +01:00
Émilie Feral
0348db5d2e [escher] TextArea: fix drawStringAt action with negative length 2020-02-12 15:13:24 +01:00
Léa Saviot
eff0a26835 [apps/probability] Clean distribution_controller
Cleaner .cpp and fix the number of cells
2020-02-12 15:13:24 +01:00
Léa Saviot
96df307833 [poincare/test] Clean arguments of ProcessExpression 2020-02-12 15:13:24 +01:00
Léa Saviot
3b80b747b2 [test/solver] Add more tests 2020-02-12 15:13:24 +01:00
Léa Saviot
9102ba1381 [poincare/function] Fix shallowReduce to take into account symbComp 2020-02-12 15:13:24 +01:00
Léa Saviot
6a57b46f8d [poincare.test] Add tests on symbolic computation 2020-02-12 15:13:24 +01:00
Léa Saviot
c4beb5ec63 [apps/solver] Fix x10 display in approximate solutions
Scenario: Solve the equation cos(x) = 10 between -1000 and 1000, the x10
solution was badly displayed.
2020-02-12 15:13:24 +01:00
Léa Saviot
25ef10a0c5 [tests/solver] Add test on solver + user defined symbols 2020-02-12 15:13:24 +01:00
Léa Saviot
470b713226 [test] Fix tests for new SymbolicComputation parameter 2020-02-12 15:13:24 +01:00
Léa Saviot
72259f359c [apps/solver] Fix rowHeight for approximated solutions
User variables rows were too small
2020-02-12 15:13:24 +01:00
Léa Saviot
248e875192 [apps/solver] Always display used variables
Scenario: 3->x, 4->y, equation x+y+c=0 would not display the values of x
and y
2020-02-12 15:13:24 +01:00
Léa Saviot
424ee9fa15 [poincare] Add SymbolicComputation parameter to the reduction context
This way, in solver, we can reduce expression without expanding symbols
2020-02-12 15:13:24 +01:00
Léa Saviot
016a68d469 [apps/solver] Do not select "User variables used" row 2020-02-12 15:13:23 +01:00