Commit 124bc160 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

FIX bug in composited² power values.

Attempted to FIX usability bug on graph 2D (people don't know where to write the new function)

svn path=/trunk/KDE/kdeedu/kalgebra/; revision=744624
parent b5fa7372
......@@ -401,7 +401,7 @@ void KAlgebra::tabChanged(int n)
b_dock_funcs->raise();
if(b_funcs->topLevelItemCount()==0)
b_tools->setCurrentIndex(1); //We set te Add tab
b_tools->setCurrentIndex(1); //We set the Add tab
// b_add->setFocus();
break;
#ifdef HAVE_OPENGL
......
......@@ -57,8 +57,8 @@ QString opr2str(int in)
void printPilaOpr(QStack<int> opr) //debug only
{
qDebug() << "0." << opr2str(opr[0]);
qDebug() << "1." << opr2str(opr[1]);
// qDebug() << "0." << opr2str(opr[0]);
// qDebug() << "1." << opr2str(opr[1]);
while(!opr.isEmpty()) {
qDebug() << ": " << opr2str(opr.pop());
}
......@@ -110,6 +110,8 @@ TOKEN Exp::getToken(QString &a, int &l, tokEnum prevtok)
TOKEN ret;
ret.type = tMaxOp;
qDebug() << "loooool" << a.length() << a;
if(a.isEmpty())
ret.type = tEof;
else if(a[0].decompositionTag()==QChar::Super) {
......@@ -117,6 +119,7 @@ TOKEN Exp::getToken(QString &a, int &l, tokEnum prevtok)
ret.type = tPow;
a[i]=a[i].decomposition()[0];
}
a.prepend(' ');
} else if(a[0].isDigit() || (a[0]=='.' && a[1].isDigit())) {
int coma=0, base=10;
if(a[0]=='.') {
......@@ -374,8 +377,8 @@ int Exp::parse()
if(shift()) return 1;
break;
case A:
// printPilaOpr(opr);
// printPilaVal(val);
/* printPilaOpr(opr);
printPilaVal(val);*/
if(val.count()==1)
mml = QString("<math>%1</math>").arg(val.pop());
else if(val.count()>1)
......
......@@ -274,7 +274,7 @@ bool Graph3D::create()
}
}
qDebug() << "Elapsed time" << t.elapsed();
// qDebug() << "Elapsed time" << t.elapsed();
qDeleteAll(threads);
return ret;
......
......@@ -47,8 +47,12 @@ void ExpTest::testExp_data()
QString fourX="<math><apply><plus /><ci>x</ci><ci>x</ci><ci>x</ci><ci>x</ci></apply></math>";
QTest::newRow("simple expression") << "x+x+x+x" << fourX;
QTest::newRow("composed expression") << QString::fromUtf8("2²")
<< "<math><apply><power /><cn>2</cn><cn>2</cn></apply></math>";
QTest::newRow("plus operator in plus() form") << "plus(x,x,x,x)" << fourX;
QTest::newRow("sum") << "x*sum(x->1..10, x)" << "<math><apply><times /><ci>x</ci><apply><sum /><bvar><ci>x</ci></bvar><uplimit><cn>10</cn></uplimit><downlimit><cn>1</cn></downlimit><ci>x</ci></apply></apply></math>";
QTest::newRow("sum") << "x*sum(x->1..10, x)" << "<math><apply><times /><ci>x</ci>"
"<apply><sum /><bvar><ci>x</ci></bvar><uplimit><cn>10</cn></uplimit><downlimit>"
"<cn>1</cn></downlimit><ci>x</ci></apply></apply></math>";
}
......@@ -59,6 +63,8 @@ void ExpTest::testExp()
Exp e(input);
e.parse();
if(!e.error().isEmpty())
qDebug() << "errors:" << e.error();
QVERIFY(e.error().isEmpty());
QCOMPARE(e.mathML(), output);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment