in winrt/test.managed/EffectTests.cs [749:879]
object GetArbitraryTestValue(Type type, bool whichOne)
{
if (type == typeof(int))
{
return whichOne ? 2 : 7;
}
else if (type == typeof(float))
{
return whichOne ? 0.5f : 0.75f;
}
else if (type == typeof(bool))
{
return whichOne;
}
else if (type.GetTypeInfo().IsEnum)
{
return GetEnumValues(type).GetValue(whichOne ? 0 : 1);
}
else if (type == typeof(Vector2))
{
return whichOne ? new Vector2 { X = 0.25f, Y = 0.75f } :
new Vector2 { X = 0.5f, Y = 0.125f };
}
else if (type == typeof(Vector3))
{
return whichOne ? new Vector3 { X = 1, Y = 2, Z = 3 } :
new Vector3 { X = 4, Y = 5, Z = 6 };
}
else if (type == typeof(Vector4))
{
return whichOne ? new Vector4 { X = 1, Y = 2, Z = 3, W = 4 } :
new Vector4 { X = 5, Y = 6, Z = 7, W = 8 };
}
else if (type == typeof(Matrix3x2))
{
return whichOne ? new Matrix3x2
{
M11 = 1, M12 = 2,
M21 = 3, M22 = 4,
M31 = 5, M32 = 6
} :
new Matrix3x2
{
M11 = 7, M12 = 8,
M21 = 9, M22 = 10,
M31 = 11, M32 = 12
};
}
else if (type == typeof(Matrix4x4))
{
return whichOne ? new Matrix4x4
{
M11 = 1, M12 = 2, M13 = 3, M14 = 4,
M21 = 5, M22 = 6, M23 = 7, M24 = 8,
M31 = 9, M32 = 10, M33 = 11, M34 = 12,
M41 = 13, M42 = 14, M43 = 15, M44 = 16
} :
new Matrix4x4
{
M11 = 11, M12 = 12, M13 = 13, M14 = 14,
M21 = 15, M22 = 16, M23 = 17, M24 = 18,
M31 = 19, M32 = 20, M33 = 21, M34 = 22,
M41 = 23, M42 = 24, M43 = 25, M44 = 26
};
}
else if (type == typeof(Matrix5x4))
{
return whichOne ? new Matrix5x4
{
M11 = 1, M12 = 2, M13 = 3, M14 = 4,
M21 = 5, M22 = 6, M23 = 7, M24 = 8,
M31 = 9, M32 = 10, M33 = 11, M34 = 12,
M41 = 13, M42 = 14, M43 = 15, M44 = 16,
M51 = 17, M52 = 18, M53 = 19, M54 = 20
} :
new Matrix5x4
{
M11 = 11, M12 = 12, M13 = 13, M14 = 14,
M21 = 15, M22 = 16, M23 = 17, M24 = 18,
M31 = 19, M32 = 20, M33 = 21, M34 = 22,
M41 = 23, M42 = 24, M43 = 25, M44 = 26,
M51 = 27, M52 = 28, M53 = 29, M54 = 30
};
}
else if (type == typeof(Rect))
{
return whichOne ? new Rect(1, 2, 3, 4) :
new Rect(10, 20, 5, 6);
}
else if (type == typeof(Windows.UI.Color))
{
return whichOne ? Colors.CornflowerBlue : Colors.Crimson;
}
else if (type == typeof(float[]))
{
return whichOne ? new float[] { 1, 2, 3 } :
new float[] { 4, 5, 6, 7, 8, 9 };
}
else if (type == typeof(ColorManagementProfile))
{
if (colorProfiles == null)
{
colorProfiles = new ColorManagementProfile[]
{
new ColorManagementProfile(CanvasColorSpace.Srgb),
new ColorManagementProfile(CanvasColorSpace.ScRgb),
};
}
return colorProfiles[whichOne ? 0 : 1];
}
#if WINDOWS_UWP
else if (type == typeof(EffectTransferTable3D))
{
if (transferTables == null)
{
transferTables = new EffectTransferTable3D[]
{
EffectTransferTable3D.CreateFromColors(device, new Windows.UI.Color[8], 2, 2, 2),
EffectTransferTable3D.CreateFromColors(device, new Windows.UI.Color[8], 2, 2, 2),
};
}
return transferTables[whichOne ? 0 : 1];
}
#endif
else
{
throw new NotSupportedException("Unsupported GetArbitraryTestValue type " + type);
}
}