public void StringNames(string name) { string path = CreateFile(name, 1024); string thumb_path = ThumbnailGenerator.ThumbnailPath(path); ThumbnailGenerator.Create(path); Assert.IsTrue(File.Exists(thumb_path), String.Format("Missing: {0} created from {1}", thumb_path, path)); using (Gdk.Pixbuf thumb = new Gdk.Pixbuf(thumb_path)) { Assert.IsNotNull(thumb); Assert.AreEqual(thumb.GetOption(ThumbUri), UriList.PathToFileUriEscaped(path)); Assert.AreEqual(new Uri(thumb.GetOption(ThumbUri)), UriList.PathToFileUri(path)); Assert.IsTrue(ThumbnailGenerator.ThumbnailIsValid(thumb, UriList.PathToFileUri(path))); } File.Delete(path); File.Delete(thumb_path); }
void Create(Gdk.Pixbuf pixbuf) { var hotspot = PointF.Empty; // get hotspot from pixbuf if available var xhot = pixbuf.GetOption("x_hot"); if (float.TryParse(xhot, out var xhotf)) { hotspot.X = xhotf; } var yhot = pixbuf.GetOption("y_hot"); if (float.TryParse(yhot, out var yhotf)) { hotspot.Y = yhotf; } Control = new Gdk.Cursor(Gdk.Display.Default, pixbuf, (int)hotspot.X, (int)hotspot.Y); }
public void UriNames(string name) { string path = CreateFile(name, 768); Uri uri = new Uri(Gnome.Vfs.Uri.GetUriFromLocalPath(path)); string string_path = ThumbnailGenerator.ThumbnailPath(path); string thumb_path = ThumbnailGenerator.ThumbnailPath(uri); Assert.AreEqual(thumb_path, string_path); ThumbnailGenerator.Create(uri); Assert.IsTrue(File.Exists(thumb_path), String.Format("Missing: {0} created from {1}", thumb_path, uri)); using (Gdk.Pixbuf thumb = new Gdk.Pixbuf(thumb_path)) { Assert.IsNotNull(thumb); Assert.AreEqual(thumb.GetOption(ThumbUri), UriList.UriToStringEscaped(uri)); Assert.AreEqual(new Uri(thumb.GetOption(ThumbUri)), uri); Assert.IsTrue(ThumbnailGenerator.ThumbnailIsValid(thumb, uri)); } File.Delete(thumb_path); File.Delete(path); }
public void UriNames (string name) { string path = CreateFile (name, 768); Uri uri = new Uri (Gnome.Vfs.Uri.GetUriFromLocalPath (path)); string string_path = ThumbnailGenerator.ThumbnailPath (path); string thumb_path = ThumbnailGenerator.ThumbnailPath (uri); Assert.AreEqual (thumb_path, string_path); ThumbnailGenerator.Create (uri); Assert.IsTrue (File.Exists (thumb_path), String.Format ("Missing: {0} created from {1}", thumb_path, uri)); using (Gdk.Pixbuf thumb = new Gdk.Pixbuf (thumb_path)) { Assert.IsNotNull (thumb); Assert.AreEqual (thumb.GetOption (ThumbUri), UriList.UriToStringEscaped (uri)); Assert.AreEqual (new Uri (thumb.GetOption (ThumbUri)), uri); Assert.IsTrue (ThumbnailGenerator.ThumbnailIsValid (thumb, uri)); } File.Delete (thumb_path); File.Delete (path); }
public void StringNames (string name) { string path = CreateFile (name, 1024); string thumb_path = ThumbnailGenerator.ThumbnailPath (path); ThumbnailGenerator.Create (path); Assert.IsTrue (File.Exists (thumb_path), String.Format ("Missing: {0} created from {1}", thumb_path, path)); using (Gdk.Pixbuf thumb = new Gdk.Pixbuf (thumb_path)) { Assert.IsNotNull (thumb); Assert.AreEqual (thumb.GetOption (ThumbUri), UriList.PathToFileUriEscaped (path)); Assert.AreEqual (new Uri (thumb.GetOption (ThumbUri)), UriList.PathToFileUri (path)); Assert.IsTrue (ThumbnailGenerator.ThumbnailIsValid (thumb, UriList.PathToFileUri (path))); } File.Delete (path); File.Delete (thumb_path); }