Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e4e902dc
Unverified
Commit
e4e902dc
authored
Nov 07, 2022
by
Jonah Williams
Committed by
GitHub
Nov 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] add compilation failure tests for new cases added in impellerc (#114757)
parent
f1cdfa28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
0 deletions
+82
-0
shader_compiler_test.dart
...er_tools/test/integration.shard/shader_compiler_test.dart
+82
-0
No files found.
packages/flutter_tools/test/integration.shard/shader_compiler_test.dart
View file @
e4e902dc
...
...
@@ -17,6 +17,26 @@ void main() {
logger
=
BufferLogger
.
test
();
});
Future
<
void
>
testCompileShader
(
String
source
)
async
{
final
Directory
tmpDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'shader_compiler_test.'
,
);
final
File
file
=
tmpDir
.
childFile
(
'test_shader.frag'
)
..
writeAsStringSync
(
source
);
final
ShaderCompiler
shaderCompiler
=
ShaderCompiler
(
processManager:
globals
.
processManager
,
logger:
logger
,
fileSystem:
globals
.
fs
,
artifacts:
globals
.
artifacts
!,
);
await
shaderCompiler
.
compileShader
(
input:
file
,
outputPath:
tmpDir
.
childFile
(
'test_shader.frag.out'
).
path
,
target:
ShaderTarget
.
sksl
,
json:
false
,
);
}
testUsingContext
(
'impellerc .iplr output has correct permissions'
,
()
async
{
if
(
globals
.
platform
.
isWindows
)
{
return
;
...
...
@@ -54,4 +74,66 @@ void main() {
final
int
expectedMode
=
int
.
parse
(
'644'
,
radix:
8
);
expect
(
resultFile
.
statSync
().
mode
&
expectedMode
,
equals
(
expectedMode
));
});
testUsingContext
(
'Compilation error with in storage'
,
()
async
{
const
String
kShaderWithInput
=
'''
in float foo;
out vec4 fragColor;
void main() {
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
'''
;
expect
(()
=>
testCompileShader
(
kShaderWithInput
),
throwsA
(
isA
<
ShaderCompilerException
>()
.
having
(
(
ShaderCompilerException
exception
)
=>
exception
.
message
,
'message'
,
contains
(
'SkSL does not support inputs'
),
),
));
});
testUsingContext
(
'Compilation error with UBO'
,
()
async
{
const
String
kShaderWithInput
=
'''
uniform Data {
vec4 foo;
} data;
out vec4 fragColor;
void main() {
fragColor = data.foo;
}
'''
;
expect
(()
=>
testCompileShader
(
kShaderWithInput
),
throwsA
(
isA
<
ShaderCompilerException
>()
.
having
(
(
ShaderCompilerException
exception
)
=>
exception
.
message
,
'message'
,
contains
(
'SkSL does not support UBOs or SSBOs'
),
),
));
});
testUsingContext
(
'Compilation error with texture arguments besides position or sampler'
,
()
async
{
const
String
kShaderWithInput
=
'''
uniform sampler2D tex;
out vec4 fragColor;
void main() {
fragColor = texture(tex, vec2(0.5, 0.3), 0.5);
}
'''
;
expect
(()
=>
testCompileShader
(
kShaderWithInput
),
throwsA
(
isA
<
ShaderCompilerException
>()
.
having
(
(
ShaderCompilerException
exception
)
=>
exception
.
message
,
'message'
,
contains
(
'Only sampler and position arguments are supported in texture() calls'
),
),
));
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment