mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-09-07 20:20:39 +00:00
fix(misc): tune wheel beta timing
This commit is contained in:
@@ -254,15 +254,25 @@ func TestWheelOfNamesBeta_RenderGIFTiming(t *testing.T) {
|
||||
t.Fatalf("frames = %d, want %d", len(decoded.Image), wheelBetaSpinFrames+1)
|
||||
}
|
||||
totalDelay := 0
|
||||
spinDelay := 0
|
||||
for i, delay := range decoded.Delay {
|
||||
totalDelay += delay
|
||||
if i < wheelBetaSpinFrames && delay != wheelBetaSpinDelay {
|
||||
t.Fatalf("spin delay[%d] = %d, want %d", i, delay, wheelBetaSpinDelay)
|
||||
}
|
||||
if i < wheelBetaSpinFrames {
|
||||
spinDelay += delay
|
||||
}
|
||||
}
|
||||
if spinDelay != wheelBetaSpinDuration*100 {
|
||||
t.Fatalf("spin delay total = %dcs, want %dcs", spinDelay, wheelBetaSpinDuration*100)
|
||||
}
|
||||
if got := decoded.Delay[len(decoded.Delay)-1]; got != wheelBetaHoldDelay {
|
||||
t.Fatalf("hold delay = %d, want %d", got, wheelBetaHoldDelay)
|
||||
}
|
||||
if got := decoded.Delay[len(decoded.Delay)-1]; got != wheelBetaHoldDuration*100 {
|
||||
t.Fatalf("hold delay total = %dcs, want %dcs", got, wheelBetaHoldDuration*100)
|
||||
}
|
||||
if totalDelay != wheelBetaDuration*100 {
|
||||
t.Fatalf("total delay = %dcs, want %dcs", totalDelay, wheelBetaDuration*100)
|
||||
}
|
||||
@@ -294,8 +304,8 @@ func TestWheelOfNamesBeta_SendsAnimationWithoutSpoilingCaption(t *testing.T) {
|
||||
if strings.Contains(call.Form["caption"], "Alice") {
|
||||
t.Fatalf("caption spoils winner: %q", call.Form["caption"])
|
||||
}
|
||||
if got := call.Form["duration"]; got != "7" {
|
||||
t.Fatalf("duration = %q, want 7", got)
|
||||
if got := call.Form["duration"]; got != "10" {
|
||||
t.Fatalf("duration = %q, want 10", got)
|
||||
}
|
||||
if got := call.Form["width"]; got != "320" {
|
||||
t.Fatalf("width = %q, want 320", got)
|
||||
|
||||
@@ -16,12 +16,14 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
wheelBetaSize = 320
|
||||
wheelBetaRadius = 118
|
||||
wheelBetaSpinFrames = 30
|
||||
wheelBetaSpinDelay = 20
|
||||
wheelBetaHoldDelay = 100
|
||||
wheelBetaDuration = 7
|
||||
wheelBetaSize = 320
|
||||
wheelBetaRadius = 118
|
||||
wheelBetaSpinDuration = 7
|
||||
wheelBetaHoldDuration = 3
|
||||
wheelBetaSpinDelay = 20
|
||||
wheelBetaSpinFrames = wheelBetaSpinDuration * 100 / wheelBetaSpinDelay
|
||||
wheelBetaHoldDelay = wheelBetaHoldDuration * 100
|
||||
wheelBetaDuration = wheelBetaSpinDuration + wheelBetaHoldDuration
|
||||
)
|
||||
|
||||
var wheelBetaPalette = color.Palette{
|
||||
|
||||
Reference in New Issue
Block a user