Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State wrapper error in ZoomLevelProperty #221

Open
3 tasks done
pixelzoom opened this issue Apr 5, 2022 · 1 comment
Open
3 tasks done

State wrapper error in ZoomLevelProperty #221

pixelzoom opened this issue Apr 5, 2022 · 1 comment
Labels
dev:phet-io type:bug Something isn't working

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 5, 2022

When fuzz testing the State wrapper with phet-io-wrappers/state/?sim=fourier-making-waves&phetioDebug&fuzz, this error occurs:

assert.js:25 Uncaught Error: Assertion failed: Property value not valid: value failed isValidValue: 5
    at window.assertions.assertFunction (assert.js:25:13)
    at Function.isValueValid (ValidatorDef.ts:326:39)
    at validate (validate.ts:37:18)
    at Property.ts:183:34
    at TinyProperty.emit (TinyEmitter.ts:93:9)
    at ZoomLevelProperty._notifyListeners (Property.ts:285:23)
    at ZoomLevelProperty.set (Property.ts:217:14)
    at ZoomLevelProperty.set value [as value] (Property.ts:355:10)
    at listener (ZoomButtonGroup.ts:80:9)
    at TinyEmitter.emit (TinyEmitter.ts:93:9)

Some problems:

  • ZoomLevelProperty is not instrumented.

  • In ZoomLevelProperty constructor, option isValidValue is not needed, that should be handled by option range:

    super( axisDescriptions.indexOf( axisDescriptionProperty.value ), {
      range: new Range( 0, axisDescriptions.length - 1 ),
      isValidValue: value => value >= 0 && value < axisDescriptions.length
    } );
  • ZoomLevelProperty should have option numberType: 'Integer'.
@pixelzoom
Copy link
Contributor Author

I made improvements identified in the above commit, and the State wrapper is still failing fuzz testing.

I'm not going to spend more time on this now, will come back to it when we work on this sim again.

@pixelzoom pixelzoom changed the title State wrapper error: invalid value for ZoomLevelProperty State wrapper error in ZoomLevelProperty Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev:phet-io type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant