예제 #1
0
파일: Conversion.cs 프로젝트: vavavr00m/NCM
        private static void CheckConversionPath(PathCheckData pathData)
        {
            double *inColor  = stackalloc double[pathData.inCount];
            double *outColor = stackalloc double[pathData.outCount];
            var     data     = new TestConversionData(pathData.inColor, pathData.outColor);

            for (int i = 0; i < pathData.inCount; i++)
            {
                inColor[i] = pathData.inValues[i];
            }

            if (pathData.conversion != null)
            {
                pathData.conversion(inColor, outColor, data);
            }
            else if (pathData.conversionEx != null)
            {
                int idx = data.AddAdditionalData(pathData.additionalData);
                pathData.conversionEx(inColor, outColor, data, data.AdditionalData[idx]);
            }

            //Ensure that the input values have not changed
            for (int i = 0; i < pathData.inCount; i++)
            {
                Assert.AreEqual(inColor[i], pathData.inValues[i], 0);
            }

            //Check the output values
            for (int i = 0; i < pathData.outCount; i++)
            {
                Assert.AreEqual(outColor[i], pathData.outValues[i], Margin);
            }
        }
예제 #2
0
파일: Conversion.cs 프로젝트: vavavr00m/NCM
        private void Test(double[] inValues, double[] outValues, bool toU)
        {
            PathCheckData path;

            if (toU)
            {
                if (IsConversionEx)
                {
                    path = new PathCheckData(Color1, Color2, ConvToUEx, inValues, outValues, AdditionalDataToU);
                }
                else
                {
                    path = new PathCheckData(Color1, Color2, ConvToU, inValues, outValues);
                }
            }
            else
            {
                if (IsConversionEx)
                {
                    path = new PathCheckData(Color2, Color1, ConvToTEx, inValues, outValues, AdditionalDataToT);
                }
                else
                {
                    path = new PathCheckData(Color2, Color1, ConvToT, inValues, outValues);
                }
            }

            CheckConversionPath(path);
        }