mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 08:38:45 +00:00
* Changed the UI of CPPage to inline-editing of all values in all tables * Added a sports-specific selector for the model (cp2, cp3, ext, manual) * Allowed to create new ranges either manually or based on the estimated values of the model * Added option to reset each ranges values to those of the selected model * Added message to create a new range if todays estimate differs from those of the currently active one * Refined semi automatic power zones * Added a dialog to inspect and accept only some values while adoption * Added info messages * when the model does not provide FTP or PMAX * that AeTP is only a very rough estimate * Added a tolerance in comparison before proposing new values * Using the following order for defaults when adding a new manual range * selected row * last row * predefined defaults * Zones-Tab: To prevent crashes, a message is shown instead of the real interface if a metric refresh is ongoing * Changed Pace- and HR-Tabs to use inline editing * Moved the unittests into the same structure as the sourcecode * Added a simple (incomplete) unittest for kphToPace * Improved setting the column width * En-/Disabling the action buttons (add, delete, ...) based on the contents state * Changed the layout to prevent jumping widgets when showing / hiding buttons * Fixed compiler warnings from Visual-C++ * Adopt dialog: Refined layout * Fixed the unit of "From BPM" on HR-Page * Set the default mode to manual Fixes #1381
57 lines
1.7 KiB
C++
57 lines
1.7 KiB
C++
#include "Core/Units.h"
|
|
|
|
#include <QTest>
|
|
|
|
|
|
class TestUnits: public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private slots:
|
|
void kphToPaceTimeRunTrash() {
|
|
QCOMPARE(kphToPaceTime(0.01, true), QTime(0, 0, 0));
|
|
QCOMPARE(kphToPaceTime(100, true), QTime());
|
|
QCOMPARE(kphToPaceTime(0.01, false), QTime(0, 0, 0));
|
|
QCOMPARE(kphToPaceTime(160, false), QTime());
|
|
}
|
|
|
|
void kphToPaceTimeRunMetric() {
|
|
QCOMPARE(kphToPaceTime(30, true), QTime(0, 2, 0));
|
|
QCOMPARE(kphToPaceTime(24, true), QTime(0, 2, 30));
|
|
QCOMPARE(kphToPaceTime(15, true), QTime(0, 4, 0));
|
|
QCOMPARE(kphToPaceTime(13.8, true), QTime(0, 4, 21));
|
|
}
|
|
|
|
void kphToPaceTimeRunImperial() {
|
|
QCOMPARE(kphToPaceTime(30, false), QTime(0, 3, 13));
|
|
QCOMPARE(kphToPaceTime(24, false), QTime(0, 4, 1));
|
|
QCOMPARE(kphToPaceTime(15, false), QTime(0, 6, 26));
|
|
QCOMPARE(kphToPaceTime(13.8, false), QTime(0, 7, 0));
|
|
}
|
|
|
|
void kphToPaceStringRunTrash() {
|
|
QCOMPARE(kphToPace(0.01, true), "00:00");
|
|
QCOMPARE(kphToPace(100, true), "xx:xx");
|
|
QCOMPARE(kphToPace(0.01, false), "00:00");
|
|
QCOMPARE(kphToPace(160, false), "xx:xx");
|
|
}
|
|
|
|
void kphToPaceStringRunMetric() {
|
|
QCOMPARE(kphToPace(30, true), "02:00");
|
|
QCOMPARE(kphToPace(24, true), "02:30");
|
|
QCOMPARE(kphToPace(15, true), "04:00");
|
|
QCOMPARE(kphToPace(13.8, true), "04:21");
|
|
}
|
|
|
|
void kphToPaceStringRunImperial() {
|
|
QCOMPARE(kphToPace(30, false), "03:13");
|
|
QCOMPARE(kphToPace(24, false), "04:01");
|
|
QCOMPARE(kphToPace(15, false), "06:26");
|
|
QCOMPARE(kphToPace(13.8, false), "07:00");
|
|
}
|
|
};
|
|
|
|
|
|
QTEST_MAIN(TestUnits)
|
|
#include "testUnits.moc"
|