diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-01 20:11:41 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-01 20:11:41 +0100 |
| commit | e920b20fafe375eec15b24eb8cde4b1455dd01af (patch) | |
| tree | 308d2f7999177a753528779f6ec7926f3fa50818 /tests | |
| parent | v4.1.0: add the egui workspace member and the roulette style spike (diff) | |
| download | zagan-bet-e920b20fafe375eec15b24eb8cde4b1455dd01af.tar.gz zagan-bet-e920b20fafe375eec15b24eb8cde4b1455dd01af.zip | |
v4.1.1: pointer-first betting and visible payouts in the GUI
The felt snaps the hover to the shared fine lattice: inner half of a cell is a straight, an edge a split, a crossing a corner. A translucent chip previews the target and the covered cells tint. Left click adds the selected chip, right or middle click takes one back through the new Bets::reduce; C or CLEAR empties the slip, and SPIN stays disabled with no chips.
The result now pays out: the wheel leaves the winning pocket under the pointer, the winning cell and pocket get a gold outline, and the sidebar reports the amount returned and the net for the round (NO WIN on a loss). Placing a chip after a result starts the next round without losing the wheel position.
The column row now spans the full width like a real table instead of hugging the left edge. Adds tests for lattice snapping, target naming and taking chips back.
Diffstat (limited to '')
| -rw-r--r-- | tests/roulette.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/roulette.rs b/tests/roulette.rs index 0c5e195..970ab6a 100644 --- a/tests/roulette.rs +++ b/tests/roulette.rs | |||
| @@ -396,3 +396,23 @@ fn rejects_bad_roulette_results() { | |||
| 396 | assert!(parse_roulette_response("ROULETTE_RESULT s 1 1 1 17 black nope").is_err()); | 396 | assert!(parse_roulette_response("ROULETTE_RESULT s 1 1 1 17 black nope").is_err()); |
| 397 | assert!(parse_roulette_response("").is_err()); | 397 | assert!(parse_roulette_response("").is_err()); |
| 398 | } | 398 | } |
| 399 | |||
| 400 | #[test] | ||
| 401 | fn chips_can_be_taken_back_one_at_a_time() { | ||
| 402 | let mut bets = Bets::default(); | ||
| 403 | bets.add(BetTarget::Straight { number: 17 }, 50); | ||
| 404 | bets.add(BetTarget::Outside { kind: Outside::Red }, 10); | ||
| 405 | |||
| 406 | bets.reduce(&BetTarget::Straight { number: 17 }, 25); | ||
| 407 | assert_eq!(bets.amount_on(&BetTarget::Straight { number: 17 }), 25); | ||
| 408 | assert_eq!(bets.total(), 35); | ||
| 409 | |||
| 410 | // Reducing past zero drops the chip instead of going negative. | ||
| 411 | bets.reduce(&BetTarget::Straight { number: 17 }, 100); | ||
| 412 | assert_eq!(bets.amount_on(&BetTarget::Straight { number: 17 }), 0); | ||
| 413 | assert_eq!(bets.total(), 10); | ||
| 414 | |||
| 415 | // A target with no chip is left alone. | ||
| 416 | bets.reduce(&BetTarget::Dozen { index: 0 }, 25); | ||
| 417 | assert_eq!(bets.total(), 10); | ||
| 418 | } | ||
