@@ -15,46 +15,35 @@ namespace Immutable.Audience.Samples.SampleApp.Tests
1515 // the log pane via the userData stash on each log row.
1616 internal static class SampleAppTestHelpers
1717 {
18- // Wall-clock interval between predicate checks for WaitForCondition
19- // and WaitForLogEntry. Decoupled from frame pacing so tests poll at a
20- // fixed cadence regardless of how fast the player renders. On Linux
21- // PlayMode under llvmpipe Unity 6 runs at 1 to 2 fps; per-frame
22- // polling there made the polling interval one full second, so a
23- // suite that should finish in seconds dragged into tens of minutes.
24- private const float PollIntervalSeconds = 0.05f ;
25-
26- // Polls predicate at PollIntervalSeconds wall-clock cadence until it
27- // returns true or the deadline elapses. Calls Assert.Fail with
28- // description when the deadline is hit. Use this instead of
29- // WaitForSecondsRealtime when a test is waiting "at most N seconds
30- // for X to become true": the polling exits as soon as the condition
31- // is satisfied rather than burning the full N seconds.
18+ // Polls predicate once per frame until it returns true or the deadline
19+ // elapses. Calls Assert.Fail with description when the deadline is hit.
20+ // Use this instead of WaitForSecondsRealtime when a test is waiting
21+ // "at most N seconds for X to become true" — the polling exits as soon
22+ // as the condition is satisfied rather than burning the full N seconds.
3223 internal static IEnumerator WaitForCondition (
3324 Func < bool > predicate , float timeoutSeconds , string description )
3425 {
3526 var deadline = Time . realtimeSinceStartup + timeoutSeconds ;
36- var poll = new WaitForSecondsRealtime ( PollIntervalSeconds ) ;
3727 while ( Time . realtimeSinceStartup < deadline )
3828 {
3929 if ( predicate ( ) ) yield break ;
40- yield return poll ;
30+ yield return null ;
4131 }
4232 Assert . Fail ( $ "Timed out after { timeoutSeconds : F1} s waiting for: { description } ") ;
4333 }
4434
4535 // Wait until the log pane contains an entry whose label matches `label`
46- // and whose level matches `level`. Polls at PollIntervalSeconds .
36+ // and whose level matches `level`. Yields one frame per check .
4737 // Throws TimeoutException on deadline.
4838 internal static IEnumerator WaitForLogEntry (
4939 VisualElement root , string label , int level , float timeoutSec )
5040 {
5141 var deadline = Time . realtimeSinceStartup + timeoutSec ;
52- var poll = new WaitForSecondsRealtime ( PollIntervalSeconds ) ;
5342 while ( Time . realtimeSinceStartup < deadline )
5443 {
5544 if ( HasLogEntry ( root , label , level ) )
5645 yield break ;
57- yield return poll ;
46+ yield return null ;
5847 }
5948 throw new TimeoutException (
6049 $ "Log entry not found within { timeoutSec } s. " +
0 commit comments