Initial font work
This commit is contained in:
@@ -100,6 +100,26 @@ void TestEnumAndDefaults()
|
||||
error.clear();
|
||||
Expect(!NormalizeAndValidateParameterValue(definition, JsonValue("other"), value, error), "enum rejects unknown options");
|
||||
}
|
||||
|
||||
void TestTextNormalization()
|
||||
{
|
||||
ShaderParameterDefinition definition;
|
||||
definition.id = "titleText";
|
||||
definition.type = ShaderParameterType::Text;
|
||||
definition.defaultTextValue = "DEFAULT";
|
||||
definition.maxLength = 6;
|
||||
|
||||
ShaderParameterValue defaultValue = DefaultValueForDefinition(definition);
|
||||
Expect(defaultValue.textValue == "DEFAUL", "text default is clamped to max length");
|
||||
|
||||
ShaderParameterValue value;
|
||||
std::string error;
|
||||
Expect(NormalizeAndValidateParameterValue(definition, JsonValue("ABC\tDEF\x01GHI"), value, error), "text accepts string values");
|
||||
Expect(value.textValue == "ABCDEF", "text drops non-printable characters and clamps length");
|
||||
|
||||
error.clear();
|
||||
Expect(!NormalizeAndValidateParameterValue(definition, JsonValue(12.0), value, error), "text rejects non-string values");
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
@@ -108,6 +128,7 @@ int main()
|
||||
TestFloatNormalization();
|
||||
TestVectorNormalization();
|
||||
TestEnumAndDefaults();
|
||||
TestTextNormalization();
|
||||
|
||||
if (gFailures != 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user