Skip to content

Commit

Permalink
Bugfix #397
Browse files Browse the repository at this point in the history
- setting begin when setting link to previous track
  • Loading branch information
NeoCoderMatrix86 committed Dec 13, 2024
1 parent a0f7cbe commit 53af612
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
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

0 comments on commit 53af612

Please sign in to comment.