The menu tree comes from N1MM's EntryWindow.Designer.cs: File, Edit, View, Tools, Config, Window, with the items under the names N1MM gives them. The window list moved out of View into Window; the call history file moved from Config into File > Import. Ctrl+W, Ctrl+L and Ctrl+M now work, so the keys printed in the menu are real. Two commands that had no menu item before: the CW and SSB function key definitions, and the QTC setup area. The rest of the Edit menu: - Ctrl+N asks for a note and puts it in the comment of the contact in the boxes, or of the last logged contact when nothing is typed. - Edit Current Contact opens the Edit Contact form over what is typed but not logged. Update hands the values back to the entry boxes. - Ctrl+Q and Ctrl+A load a logged contact into the boxes and paint them pale yellow. Enter writes the change back, Esc puts back what was being typed, and stepping forward past the newest contact leaves quick edit. - Ctrl+U raises the received serial, or a numeric exchange box when the contest has no serial. - Ctrl+F shows the call being typed in the log window, then the next contact with that call. RadioPosition is now OperatingPosition: it is the operator at one radio, not a place on a band. Looked at under Xvfb on a 3775-contact log: quick edit back and forward, Esc, the note dialog, find, and Edit Current Contact putting a zone back into the entry boxes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
90 lines
3.1 KiB
C#
90 lines
3.1 KiB
C#
using Nonemm.Contests;
|
|
using Nonemm.Contests.Rules;
|
|
using Nonemm.Core;
|
|
using Nonemm.Core.Calls;
|
|
using Nonemm.Core.Country;
|
|
using Nonemm.Storage;
|
|
|
|
namespace Nonemm.Session.Tests;
|
|
|
|
public class StationPathTests
|
|
{
|
|
private static readonly DateTime Now = new(2026, 8, 28, 12, 0, 0, DateTimeKind.Utc);
|
|
|
|
/// Two entities far enough apart to check a heading against a map.
|
|
private static readonly CountryFile Countries = CountryFile.Parse(
|
|
"""
|
|
Slovak Republic: 15: 28: EU: 48.67: -19.50: -1.0: OM:
|
|
OM;
|
|
Japan: 25: 45: AS: 36.40: -138.38: -9.0: JA:
|
|
JA;
|
|
""");
|
|
|
|
private static OperatingPosition Session(string myGrid = "", CallHistory? history = null)
|
|
{
|
|
FakeLogStore store = new();
|
|
ContestInstance instance = store.AddContest(new ContestInstance
|
|
{
|
|
ContestNumber = 0,
|
|
ContestName = "CQWW",
|
|
SentExchange = "15",
|
|
});
|
|
return new OperatingPosition(new ContestSession(
|
|
store,
|
|
new CqWorldWide(ModeCategory.Cw),
|
|
instance,
|
|
new StationInfo { Callsign = "OM5M", CqZone = 15, GridSquare = myGrid },
|
|
Countries,
|
|
history));
|
|
}
|
|
|
|
[Fact]
|
|
public void WithNothingInTheCallsignBoxThereIsNoPath() =>
|
|
Assert.Null(StationPath.For(Session(), Now));
|
|
|
|
[Fact]
|
|
public void TheCountryFilePlacesAStationWhoseGridIsNotKnown()
|
|
{
|
|
OperatingPosition session = Session();
|
|
session.Entry.Call = "JA1XYZ";
|
|
|
|
StationPath path = Assert.IsType<StationPath>(StationPath.For(session, Now));
|
|
|
|
// Slovakia to Japan is a little north of east, about nine thousand km
|
|
Assert.InRange(path.Heading, 40, 60);
|
|
Assert.InRange(path.DistanceKm, 8_500, 9_500);
|
|
Assert.Equal((path.Heading + 180) % 360, path.LongPath);
|
|
}
|
|
|
|
[Fact]
|
|
public void AGridFromTheCallHistoryBeatsTheCountryFile()
|
|
{
|
|
OperatingPosition known = Session(
|
|
myGrid: "JN88",
|
|
history: CallHistory.Parse("!!Order!!,Call,LOC1\nJA1XYZ,PM95"));
|
|
known.Entry.Call = "JA1XYZ";
|
|
OperatingPosition unknown = Session(myGrid: "JN88");
|
|
unknown.Entry.Call = "JA1XYZ";
|
|
|
|
StationPath fromGrid = Assert.IsType<StationPath>(StationPath.For(known, Now));
|
|
StationPath fromCountry = Assert.IsType<StationPath>(StationPath.For(unknown, Now));
|
|
|
|
Assert.NotEqual(Math.Round(fromGrid.DistanceKm), Math.Round(fromCountry.DistanceKm));
|
|
Assert.InRange(fromGrid.DistanceKm, 9_000, 9_600);
|
|
}
|
|
|
|
[Fact]
|
|
public void TheSunTimesAreTheOtherStationsOwn()
|
|
{
|
|
OperatingPosition session = Session();
|
|
session.Entry.Call = "JA1XYZ";
|
|
|
|
StationPath path = Assert.IsType<StationPath>(StationPath.For(session, Now));
|
|
|
|
// Japan is nine hours ahead, so the sun rises there late the evening
|
|
// before, in UTC, and sets in the morning
|
|
Assert.Equal(20, Assert.IsType<DateTime>(path.Sunrise).Hour);
|
|
Assert.Equal(9, Assert.IsType<DateTime>(path.Sunset).Hour);
|
|
}
|
|
}
|