Exemplo n.º 1
0
            static void RunTest(string providerDump, string nonContiguousBuffersStr)
            {
                TestImageProvider <Rgba32> provider = BasicSerializer.Deserialize <TestImageProvider <Rgba32> >(providerDump);

                provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100);

                using Image <Rgba32> image = provider.GetImage(PngDecoder);
                image.DebugSave(provider, testOutputDetails: nonContiguousBuffersStr);
                image.CompareToOriginal(provider);
            }
Exemplo n.º 2
0
            static void RunTest(string providerDump)
            {
                TestImageProvider <TPixel> provider =
                    BasicSerializer.Deserialize <TestImageProvider <TPixel> >(providerDump);

                using Image <TPixel> image = provider.GetImage(JpegDecoder);
                image.DebugSave(provider);

                provider.Utility.TestName = DecodeBaselineJpegOutputName;
                image.CompareToReferenceOutput(ImageComparer.Tolerant(BaselineTolerance), provider, appendPixelTypeToFileName: false);
            }
Exemplo n.º 3
0
            static void RunTest(string providerDump, string nonContiguousBuffersStr)
            {
                TestImageProvider <Rgba32> provider = BasicSerializer.Deserialize <TestImageProvider <Rgba32> >(providerDump);

                provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100);

                using Image <Rgba32> image = provider.GetImage(BmpDecoder);
                image.DebugSave(provider, nonContiguousBuffersStr);

                if (TestEnvironment.IsWindows)
                {
                    image.CompareToOriginal(provider);
                }
            }
        public void Serialize()
        {
            BasicSerializer<GeoCodeAddressResponseModel.WebServiceGeocodeQueryResultSet> serializer = new BasicSerializer<GeoCodeAddressResponseModel.WebServiceGeocodeQueryResultSet>();

            // Object -> String
            string objectSerialized = serializer.Serialze(GeoCodeAddressModelResponseSample.TypedSample);

            // String -> Object
            GeoCodeAddressResponseModel.WebServiceGeocodeQueryResultSet stringSerialized = serializer.DeSerialize(GeoCodeAddressModelResponseSample.StringSample);
            // And Back
            string result = serializer.Serialze(stringSerialized);

            // Make sure they are the same
            Assert.AreEqual(objectSerialized, result);
        }
            static void RunTest(string providerDump, string nonContiguousBuffersStr)
            {
                TestImageProvider <Rgb24> provider =
                    BasicSerializer.Deserialize <TestImageProvider <Rgb24> >(providerDump);

                provider.LimitAllocatorBufferCapacity().InBytesSqrt(200);

                using Image <Rgb24> image = provider.GetImage(JpegDecoder);
                image.DebugSave(provider, nonContiguousBuffersStr);

                provider.Utility.TestName = DecodeProgressiveJpegOutputName;
                image.CompareToReferenceOutput(
                    GetImageComparer(provider),
                    provider,
                    appendPixelTypeToFileName: false);
            }
Exemplo n.º 6
0
        public void SerializeDeserialize_ShouldPreserveValues()
        {
            var obj = new DerivedObj()
            {
                Length = 123.1, Name = "Lol123!", Lives = 7, Strength = 4.8
            };

            string  str        = BasicSerializer.Serialize(obj);
            BaseObj mirrorBase = BasicSerializer.Deserialize <BaseObj>(str);

            DerivedObj mirror = Assert.IsType <DerivedObj>(mirrorBase);

            Assert.Equal(obj.Length, mirror.Length);
            Assert.Equal(obj.Name, mirror.Name);
            Assert.Equal(obj.Lives, mirror.Lives);
            Assert.Equal(obj.Strength, mirror.Strength);
        }
Exemplo n.º 7
0
            static void RunTest(string providerDump, string nonContiguousBuffersStr)
            {
                TestImageProvider <TPixel> provider = BasicSerializer.Deserialize <TestImageProvider <TPixel> >(providerDump);

                if (!string.IsNullOrEmpty(nonContiguousBuffersStr))
                {
                    provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100);
                }

                using Image <TPixel> image = provider.GetImage(BmpDecoder);
                image.DebugSave(provider, testOutputDetails: nonContiguousBuffersStr);

                if (TestEnvironment.IsWindows)
                {
                    image.CompareToOriginal(provider);
                }
            }
Exemplo n.º 8
0
            static void RunTest(string providerDump, string nonContiguousBuffersStr)
            {
                TestImageProvider <TPixel> provider =
                    BasicSerializer.Deserialize <TestImageProvider <TPixel> >(providerDump);

                if (!string.IsNullOrEmpty(nonContiguousBuffersStr))
                {
                    provider.LimitAllocatorBufferCapacity().InPixels(1000 * 8);
                }

                using Image <TPixel> image = provider.GetImage(JpegDecoder);
                image.DebugSave(provider, testOutputDetails: nonContiguousBuffersStr);

                provider.Utility.TestName = DecodeBaselineJpegOutputName;
                image.CompareToReferenceOutput(
                    GetImageComparer(provider),
                    provider,
                    appendPixelTypeToFileName: false);
            }
Exemplo n.º 9
0
            static void RunTest(string providerDump)
            {
                TestImageProvider <TPixel> provider =
                    BasicSerializer.Deserialize <TestImageProvider <TPixel> >(providerDump);

#if SUPPORTS_RUNTIME_INTRINSICS
                Assert.False(Ssse3.IsSupported);
#endif

                foreach (PngInterlaceMode interlaceMode in InterlaceMode)
                {
                    TestPngEncoderCore(
                        provider,
                        PngColorType.Rgb,
                        PngFilterMethod.Adaptive,
                        PngBitDepth.Bit8,
                        interlaceMode,
                        appendPixelType: true,
                        appendPngColorType: true);
                }
            }
Exemplo n.º 10
0
 public void SetUp()
 {
     Serializer = new BasicSerializer<Note>();
 }