QROptionsTest
extends TestCase
in package
FinalYes
QROptions test
Table of Contents
Methods
- clampCircleRadius() : void
- Tests clamping of the circle radius
- clampLogoSpaceValue() : void
- Tests the clamping (between 0 and 177) of the logo space values
- logoSpaceStartNullable() : void
- Tests if the optional logo space start values are nullable
- setEccLevel() : void
- Tests setting the ECC level from string or int
- setEccLevelFromIntException() : void
- Tests if an exception is thrown when attempting to set an invalid ECC level integer
- setEccLevelFromStringException() : void
- Tests if an exception is thrown when attempting to set an invalid ECC level string
- versionClamp() : void
- Tests the $version clamping
- versionMinMaxClamp() : void
- Tests the $versionMin/$versionMax clamping
Methods
clampCircleRadius()
Tests clamping of the circle radius
public
clampCircleRadius(float $value, float $expected) : void
Parameters
- $value : float
- $expected : float
Attributes
- #[Test]
- #[TestWith]
- [0.0, 0.1]
- 'min'
- #[TestWith]
- [0.5, 0.5]
- 'no clamp'
- #[TestWith]
- [1.5, 0.75]
- 'max'
clampLogoSpaceValue()
Tests the clamping (between 0 and 177) of the logo space values
public
clampLogoSpaceValue(int $value, int $expected) : void
Parameters
- $value : int
- $expected : int
Attributes
- #[Test]
- #[TestWith]
- [-1, 0]
- 'negative'
- #[TestWith]
- [0, 0]
- 'zero'
- #[TestWith]
- [69, 69]
- 'normal'
- #[TestWith]
- [177, 177]
- 'max'
- #[TestWith]
- [178, 177]
- 'exceed'
logoSpaceStartNullable()
Tests if the optional logo space start values are nullable
public
logoSpaceStartNullable() : void
Attributes
- #[Test]
setEccLevel()
Tests setting the ECC level from string or int
public
setEccLevel() : void
Tags
Attributes
- #[Test]
setEccLevelFromIntException()
Tests if an exception is thrown when attempting to set an invalid ECC level integer
public
setEccLevelFromIntException() : void
Attributes
- #[Test]
setEccLevelFromStringException()
Tests if an exception is thrown when attempting to set an invalid ECC level string
public
setEccLevelFromStringException() : void
Attributes
- #[Test]
versionClamp()
Tests the $version clamping
public
versionClamp(int $version, int $expected) : void
Parameters
- $version : int
- $expected : int
Attributes
- #[Test]
- #[TestWith]
- [42, 40]
- 'values > 40 should be clamped to 40'
- #[TestWith]
- [-42, 1]
- 'values < 1 should be clamped to 1'
- #[TestWith]
- [21, 21]
- 'values in between should not be touched'
- #[TestWith]
- [Version::AUTO, -1]
- 'value -1 should be treated as is (default)'
versionMinMaxClamp()
Tests the $versionMin/$versionMax clamping
public
versionMinMaxClamp(int $versionMin, int $versionMax, int $expectedMin, int $expectedMax) : void
Parameters
- $versionMin : int
- $versionMax : int
- $expectedMin : int
- $expectedMax : int
Attributes
- #[Test]
- #[TestWith]
- [5, 10, 5, 10]
- 'normal clamp'
- #[TestWith]
- [-42, 42, 1, 40]
- 'exceeding values'
- #[TestWith]
- [10, 5, 5, 10]
- 'min > max'
- #[TestWith]
- [42, -42, 1, 40]
- 'min > max, exceeding'