forked from dunst-project/dunst
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for icon scaling math & loading
- Loading branch information
Showing
5 changed files
with
202 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <gdk-pixbuf/gdk-pixbuf.h> | ||
|
||
#include "helpers.h" | ||
|
||
GVariant *notification_setup_raw_image(const char *path) | ||
{ | ||
GdkPixbuf *pb = gdk_pixbuf_new_from_file(path, NULL); | ||
|
||
if (!pb) | ||
return NULL; | ||
|
||
GVariant *hint_data = g_variant_new_from_data( | ||
G_VARIANT_TYPE("ay"), | ||
gdk_pixbuf_read_pixels(pb), | ||
gdk_pixbuf_get_byte_length(pb), | ||
TRUE, | ||
(GDestroyNotify) g_object_unref, | ||
g_object_ref(pb)); | ||
|
||
GVariant *hint = g_variant_new( | ||
"(iiibii@ay)", | ||
gdk_pixbuf_get_width(pb), | ||
gdk_pixbuf_get_height(pb), | ||
gdk_pixbuf_get_rowstride(pb), | ||
gdk_pixbuf_get_has_alpha(pb), | ||
gdk_pixbuf_get_bits_per_sample(pb), | ||
gdk_pixbuf_get_n_channels(pb), | ||
hint_data); | ||
|
||
g_object_unref(pb); | ||
|
||
return hint; | ||
} | ||
|
||
/* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef DUNST_TEST_HELPERS_H | ||
#define DUNST_TEST_HELPERS_H | ||
|
||
#include <glib.h> | ||
|
||
GVariant *notification_setup_raw_image(const char *path); | ||
|
||
#endif | ||
/* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters