Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/plugins/views/reports/core/tests/querytable-test.cpp
Show First 20 Lines • Show All 969 Lines • ▼ Show 20 Line(s) | 952 | try { | |||
---|---|---|---|---|---|
970 | QList<ListTable::TableRow> rows = qtbl_3.rows(); | 970 | QList<ListTable::TableRow> rows = qtbl_3.rows(); | ||
971 | 971 | | |||
972 | QString html = qtbl_3.renderHTML(); | 972 | QString html = qtbl_3.renderHTML(); | ||
973 | QVERIFY(rows.count() == 5); | 973 | QVERIFY(rows.count() == 5); | ||
974 | } catch (const MyMoneyException &e) { | 974 | } catch (const MyMoneyException &e) { | ||
975 | QFAIL(e.what()); | 975 | QFAIL(e.what()); | ||
976 | } | 976 | } | ||
977 | } | 977 | } | ||
978 | | ||||
979 | class QueryTableProtectedTester : QueryTable { | ||||
980 | public: | ||||
981 | QueryTableProtectedTester(): QueryTable(MyMoneyReport(eMyMoney::Report::RowType::Account, | ||||
982 | static_cast<unsigned>(eMyMoney::Report::ColumnType::Months), | ||||
983 | eMyMoney::TransactionFilter::Date::YearToDate, | ||||
984 | eMyMoney::Report::DetailLevel::Top, | ||||
985 | "Yearly Budgeted vs. Actual", "Default Report")) {} | ||||
986 | | ||||
987 | void testHelperROI() { | ||||
988 | // (10 + 50 - 110 + 60 + 70) / (110 - 10) | ||||
989 | QString result1 = helperROI(MyMoneyMoney(10), MyMoneyMoney(50), MyMoneyMoney(110), MyMoneyMoney(60), MyMoneyMoney(70)); | ||||
990 | QVERIFY(MyMoneyMoney(result1) == MyMoneyMoney(80, 100)); | ||||
991 | | ||||
992 | // (110 + 50 - 110 + 60 + 70) / (110 - 110) | ||||
993 | QString result2 = helperROI(MyMoneyMoney(110), MyMoneyMoney(50), MyMoneyMoney(110), MyMoneyMoney(60), MyMoneyMoney(70)); | ||||
994 | QVERIFY(result2 == ""); | ||||
995 | } | ||||
996 | }; | ||||
997 | | ||||
998 | void QueryTableTest::testProtectedMethods() | ||||
999 | { | ||||
1000 | try { | ||||
1001 | QueryTableProtectedTester().testHelperROI(); | ||||
1002 | } catch (const MyMoneyException &e) { | ||||
1003 | QFAIL(e.what()); | ||||
1004 | } | ||||
1005 | } |