-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for resolvePerAspectFormat
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export const description = ` | ||
Unittests for helpers in format_info.ts. | ||
`; | ||
|
||
import { Fixture } from '../common/framework/fixture.js'; | ||
import { makeTestGroup } from '../common/framework/test_group.js'; | ||
import { assert, objectEquals } from '../common/util/util.js'; | ||
|
||
import { kDepthStencilFormats, kTextureFormatInfo, resolvePerAspectFormat } from './format_info.js'; | ||
|
||
export const g = makeTestGroup(Fixture); | ||
|
||
g.test('resolvePerAspectFormat') | ||
.desc( | ||
`Test that resolvePerAspectFormat works and kTextureFormatInfo contains identical | ||
information for the combined and separate versions of that aspect.` | ||
) | ||
.fn(t => { | ||
for (const format of kDepthStencilFormats) { | ||
const info = kTextureFormatInfo[format]; | ||
if (info.depth) { | ||
const depthFormatInfo = kTextureFormatInfo[resolvePerAspectFormat(format, 'depth-only')]; | ||
assert(objectEquals(info.depth, depthFormatInfo.depth), 'Error in texture format table'); | ||
} | ||
if (info.stencil) { | ||
const stencilFormatInfo = | ||
kTextureFormatInfo[resolvePerAspectFormat(format, 'stencil-only')]; | ||
assert( | ||
objectEquals(info.stencil, stencilFormatInfo.stencil), | ||
'Error in texture format table' | ||
); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters