Ejemplo n.º 1
0
        public void TestSplit7()
        {
            string[] Split(string path)
            {
                var filename7 = NetVips.PathFilename7(path);
                var mode7     = NetVips.PathMode7(path);

                return(new[] { filename7, mode7 });
            }

            var cases = new Dictionary <string, string[]>
            {
                {
                    "c:\\silly:dir:name\\fr:ed.tif:jpeg:95,,,,c:\\icc\\srgb.icc",
                    new[]
                    {
                        "c:\\silly:dir:name\\fr:ed.tif",
                        "jpeg:95,,,,c:\\icc\\srgb.icc"
                    }
                },
                {
                    "I180:",
                    new[]
                    {
                        "I180",
                        ""
                    }
                },
                {
                    "c:\\silly:",
                    new[]
                    {
                        "c:\\silly",
                        ""
                    }
                },
                {
                    "c:\\program files\\x:hello",
                    new[]
                    {
                        "c:\\program files\\x",
                        "hello"
                    }
                },
                {
                    "C:\\fixtures\\2569067123_aca715a2ee_o.jpg",
                    new[]
                    {
                        "C:\\fixtures\\2569067123_aca715a2ee_o.jpg",
                        ""
                    }
                }
            };

            foreach (var entry in cases)
            {
                Assert.Equal(entry.Value, Split(entry.Key));
            }
        }
Ejemplo n.º 2
0
        public void TestSplit7()
        {
            var ex = Record.Exception(() => NetVips.PathFilename7(""));

            Skip.IfNot(ex == null, "vips configured with --disable-deprecated, skipping test");

            string[] Split(string path)
            {
                var filename7 = NetVips.PathFilename7(path);
                var mode7     = NetVips.PathMode7(path);

                return(new[] { filename7, mode7 });
            }

            var cases = new Dictionary <string, string[]>
            {
                {
                    "c:\\silly:dir:name\\fr:ed.tif:jpeg:95,,,,c:\\icc\\srgb.icc",
                    new[]
                    {
                        "c:\\silly:dir:name\\fr:ed.tif",
                        "jpeg:95,,,,c:\\icc\\srgb.icc"
                    }
                },
                {
                    "I180:",
                    new[]
                    {
                        "I180",
                        ""
                    }
                },
                {
                    "c:\\silly:",
                    new[]
                    {
                        "c:\\silly",
                        ""
                    }
                },
                {
                    "c:\\program files\\x:hello",
                    new[]
                    {
                        "c:\\program files\\x",
                        "hello"
                    }
                },
                {
                    "C:\\fixtures\\2569067123_aca715a2ee_o.jpg",
                    new[]
                    {
                        "C:\\fixtures\\2569067123_aca715a2ee_o.jpg",
                        ""
                    }
                }
            };

            foreach (var entry in cases)
            {
                Assert.Equal(entry.Value, Split(entry.Key));
            }
        }