Fix build of evoral tests

Fix compile errors in libs/evoral/test/, by explicitly calling
Evoral::MusicalTime::to_double() wherever a double value is required of a
MusicalTime.

Some of the double variables should probably really be made into MusicalTime
ones instead, but I don't want to mess with this too much.

takeFiveTest still fails for me after this, but a failing test is probably
more informative in the long run than a test that won't even compile.
This commit is contained in:
Colin Fletcher 2014-11-24 15:10:50 +00:00
parent 1f58f81aa6
commit 3a6c9e3bb9
2 changed files with 12 additions and 12 deletions

View file

@ -24,19 +24,19 @@ FramewalkToBeatsTest::singleTempoTest ()
map.add_tempo (tempo, BBT_Time (1, 1, 0));
/* Walk 1 beats-worth of frames from beat 3 */
double r = map.framewalk_to_beats (frames_per_beat * 2, frames_per_beat * 1);
double r = map.framewalk_to_beats (frames_per_beat * 2, frames_per_beat * 1).to_double();
CPPUNIT_ASSERT_EQUAL (1.0, r);
/* Walk 6 beats-worth of frames from beat 4 */
r = map.framewalk_to_beats (frames_per_beat * 3, frames_per_beat * 6);
r = map.framewalk_to_beats (frames_per_beat * 3, frames_per_beat * 6).to_double();
CPPUNIT_ASSERT_EQUAL (6.0, r);
/* Walk 1.5 beats-worth of frames from beat 3 */
r = map.framewalk_to_beats (frames_per_beat * 2, frames_per_beat * 1.5);
r = map.framewalk_to_beats (frames_per_beat * 2, frames_per_beat * 1.5).to_double();
CPPUNIT_ASSERT_EQUAL (1.5, r);
/* Walk 1.5 beats-worth of frames from beat 2.5 */
r = map.framewalk_to_beats (frames_per_beat * 2.5, frames_per_beat * 1.5);
r = map.framewalk_to_beats (frames_per_beat * 2.5, frames_per_beat * 1.5).to_double();
CPPUNIT_ASSERT_EQUAL (1.5, r);
}
@ -77,22 +77,22 @@ FramewalkToBeatsTest::doubleTempoTest ()
/* Now some tests */
/* Walk 1 beat from 1|2 */
double r = map.framewalk_to_beats (24e3, 24e3);
double r = map.framewalk_to_beats (24e3, 24e3).to_double();
CPPUNIT_ASSERT_EQUAL (1.0, r);
/* Walk 2 beats from 3|3 to 4|1 (over the tempo change) */
r = map.framewalk_to_beats (240e3, (24e3 + 24e3));
r = map.framewalk_to_beats (240e3, (24e3 + 24e3)).to_double();
CPPUNIT_ASSERT_EQUAL (2.0, r);
/* Walk 2.5 beats from 3|3.5 to 4.2 (over the tempo change) */
r = map.framewalk_to_beats (264e3 - 12e3, (24e3 + 12e3 + 12e3));
r = map.framewalk_to_beats (264e3 - 12e3, (24e3 + 12e3 + 12e3)).to_double();
CPPUNIT_ASSERT_EQUAL (2.5, r);
/* Walk 3 beats from 3|4.5 to 4|3.5 (over the tempo change) */
r = map.framewalk_to_beats (264e3 - 12e3, (24e3 + 12e3 + 12e3 + 6e3));
r = map.framewalk_to_beats (264e3 - 12e3, (24e3 + 12e3 + 12e3 + 6e3)).to_double();
CPPUNIT_ASSERT_EQUAL (3.0, r);
/* Walk 3.5 beats from 3|4.5 to 4.4 (over the tempo change) */
r = map.framewalk_to_beats (264e3 - 12e3, (24e3 + 12e3 + 12e3 + 12e3));
r = map.framewalk_to_beats (264e3 - 12e3, (24e3 + 12e3 + 12e3 + 12e3)).to_double();
CPPUNIT_ASSERT_EQUAL (3.5, r);
}
@ -132,6 +132,6 @@ FramewalkToBeatsTest::tripleTempoTest ()
map.add_tempo (tempoC, BBT_Time (3, 1, 0));
/* Walk from 1|3 to 4|1 */
double r = map.framewalk_to_beats (2 * 24e3, (2 * 24e3) + (4 * 12e3) + (4 * 18e3));
double r = map.framewalk_to_beats (2 * 24e3, (2 * 24e3) + (4 * 12e3) + (4 * 18e3)).to_double();
CPPUNIT_ASSERT_EQUAL (10.0, r);
}

View file

@ -30,8 +30,8 @@ SequenceTest::preserveEventOrderingTest ()
);
event->buffer()[0] = MIDI_CMD_CONTROL;
event->buffer()[1] = event->time() / 1000;
event->buffer()[2] = event->time() / 1000;
event->buffer()[1] = event->time().to_double() / 1000;
event->buffer()[2] = event->time().to_double() / 1000;
boost::shared_ptr<Event<Time> > event_ptr(event);