Style/doc fixes from review
This commit is contained in:
committed by
FeRD (Frank Dana)
parent
114d0621aa
commit
0114fad8a5
@@ -61,9 +61,14 @@ G_DEFINE_BOXED_TYPE (GdkRGBA, gdk_rgba,
|
||||
* Allocates a new `GdkRGBA` and populates it with the color values
|
||||
* represented by @spec.
|
||||
*
|
||||
* If @spec does not conform to the formats specified by
|
||||
* [func@Gdk.Rgba.parse], this function will return `NULL`.
|
||||
*
|
||||
* The result must be freed through [method@Gdk.RGBA.free].
|
||||
*
|
||||
* Returns: A newly allocated `GdkRGBA`, or `NULL` if @spec cannot be parsed.
|
||||
* Returns: (transfer full) (nullable): A newly allocated `GdkRGBA`
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
GdkRGBA *
|
||||
gdk_rgba_new_from_string (const char *spec)
|
||||
|
||||
@@ -45,7 +45,7 @@ struct _GdkRGBA
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_rgba_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_AVAILABLE_IN_4_14
|
||||
GdkRGBA * gdk_rgba_new_from_string (const char *spec);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -210,19 +210,20 @@ test_color_hash (void)
|
||||
static void
|
||||
test_alloc_from_string (void)
|
||||
{
|
||||
GdkRGBA expected;
|
||||
expected.red = 1.0;
|
||||
expected.green = 0.0;
|
||||
expected.blue = 1.0;
|
||||
expected.alpha = 1.0;
|
||||
GdkRGBA expected = {
|
||||
.red = 1.0,
|
||||
.green = 0.0,
|
||||
.blue = 1.0,
|
||||
.alpha = 1.0,
|
||||
};
|
||||
|
||||
GdkRGBA *parsed = gdk_rgba_new_from_string("#ff00ff");
|
||||
GdkRGBA *parsed = gdk_rgba_new_from_string ("#ff00ff");
|
||||
g_assert_true (gdk_rgba_equal (&expected, parsed));
|
||||
|
||||
gdk_rgba_free(parsed);
|
||||
gdk_rgba_free (parsed);
|
||||
|
||||
GdkRGBA *fail = gdk_rgba_new_from_string("//xx!!");
|
||||
g_assert_true (fail == NULL);
|
||||
GdkRGBA *fail = gdk_rgba_new_from_string ("//xx!!");
|
||||
g_assert_null (fail);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user