chore: release v0.26.3
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package cat
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNeedRecentre(t *testing.T) {
|
||||
pan := panView{centre: 14.100, width: 0.200}
|
||||
// A spot the display is already showing comfortably: leave the window alone,
|
||||
// which is the whole point of the option being off.
|
||||
if needRecentre(pan, 14.110, 0.200, false) {
|
||||
t.Fatal("moved a display that was already on the spot")
|
||||
}
|
||||
// Narrowing for a CW spot 40 kHz away: 25 kHz around the old centre would not
|
||||
// reach it, so the centre must follow.
|
||||
if !needRecentre(pan, 14.060, 0.025, false) {
|
||||
t.Fatal("spot would have been left outside the new window")
|
||||
}
|
||||
// Near the very edge of the new window — visible in the arithmetic, useless
|
||||
// in practice.
|
||||
if !needRecentre(pan, 14.199, 0.200, false) {
|
||||
t.Fatal("spot pinned to the edge counts as outside")
|
||||
}
|
||||
// The operator asked for it.
|
||||
if !needRecentre(pan, 14.110, 0.200, true) {
|
||||
t.Fatal("forced centring ignored")
|
||||
}
|
||||
// No pan status yet: assume the display is elsewhere.
|
||||
if !needRecentre(panView{}, 14.110, 0.200, false) {
|
||||
t.Fatal("unknown centre must re-centre")
|
||||
}
|
||||
// Nothing to centre on.
|
||||
if needRecentre(pan, 0, 0.200, true) {
|
||||
t.Fatal("centred on nothing")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user