Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix #397 #403

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions AudioCuesheetEditor.Tests/Model/AudioCuesheet/CuesheetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -638,5 +638,35 @@ public void ValidateTest()
cuesheet.Title = "Testtitle";
Assert.AreEqual(ValidationStatus.Success, cuesheet.Validate(x => x.Title).Status);
}

[TestMethod()]
public void IsLinkedToPreviousTrack_ChangedLastTrackBegin_SetsTrackProperties()
{
//Arrange
var applicationOptions = new ApplicationOptions()
{
LinkTracksWithPreviousOne = false
};
var cuesheet = new Cuesheet();
var track1 = new Track()
{
Artist = "Track1 Artist",
Title = "Track1 Title"
};
var track2 = new Track()
{
Artist = "Track2 Artist",
Title = "Track2 Title",
End = new TimeSpan(0, 9, 12)
};
cuesheet.AddTrack(track1, applicationOptions);
cuesheet.AddTrack(track2, applicationOptions);
track2.Begin = new TimeSpan(0, 4, 23);
//Act
track2.IsLinkedToPreviousTrack = true;
//Assert
Assert.AreEqual((uint)2, track2.Position);
Assert.AreEqual(track2.Begin, track1.End);
}
}
}
4 changes: 4 additions & 0 deletions AudioCuesheetEditor/Model/AudioCuesheet/Cuesheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,10 @@ private void Track_IsLinkedToPreviousTrackChanged(object? sender, EventArgs e)
{
trackRaisedEvent.Begin = previousTrack.End;
}
if ((previousTrack.End.HasValue == false) && (trackRaisedEvent.Begin.HasValue))
{
previousTrack.End = trackRaisedEvent.Begin;
}
}
}
}
Expand Down
Loading