gnome-power-manager r3010 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r3010 - in trunk: . src
- Date: Mon, 6 Oct 2008 14:22:56 +0000 (UTC)
Author: rhughes
Date: Mon Oct 6 14:22:55 2008
New Revision: 3010
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3010&view=rev
Log:
2008-10-06 Richard Hughes <richard hughsie com>
* src/egg-color.c: (egg_color_from_rgb), (egg_color_to_rgb),
(egg_color_test):
* src/egg-test.c: (egg_test_assert), (egg_test_title_assert):
* src/egg-test.h:
Trivial egg updates.
Modified:
trunk/ChangeLog
trunk/src/egg-color.c
trunk/src/egg-test.c
trunk/src/egg-test.h
Modified: trunk/src/egg-color.c
==============================================================================
--- trunk/src/egg-color.c (original)
+++ trunk/src/egg-color.c Mon Oct 6 14:22:55 2008
@@ -30,11 +30,11 @@
guint32
egg_color_from_rgb (guint8 red, guint8 green, guint8 blue)
{
- guint32 colour = 0;
- colour += (guint32) red * 0x10000;
- colour += (guint32) green * 0x100;
- colour += (guint32) blue;
- return colour;
+ guint32 color = 0;
+ color += (guint32) red * 0x10000;
+ color += (guint32) green * 0x100;
+ color += (guint32) blue;
+ return color;
}
/**
@@ -44,11 +44,11 @@
* @blue: The blue value
**/
void
-egg_color_to_rgb (guint32 colour, guint8 *red, guint8 *green, guint8 *blue)
+egg_color_to_rgb (guint32 color, guint8 *red, guint8 *green, guint8 *blue)
{
- *red = (colour & 0xff0000) / 0x10000;
- *green = (colour & 0x00ff00) / 0x100;
- *blue = colour & 0x0000ff;
+ *red = (color & 0xff0000) / 0x10000;
+ *green = (color & 0x00ff00) / 0x100;
+ *blue = color & 0x0000ff;
}
/***************************************************************************
@@ -61,7 +61,7 @@
egg_color_test (EggTest *test)
{
guint8 r, g, b;
- guint32 colour;
+ guint32 color;
if (egg_test_start (test, "EggColor") == FALSE) {
return;
@@ -114,38 +114,38 @@
/************************************************************/
egg_test_title (test, "set red");
- colour = egg_color_from_rgb (0xff, 0x00, 0x00);
- if (colour == 0xff0000) {
+ color = egg_color_from_rgb (0xff, 0x00, 0x00);
+ if (color == 0xff0000) {
egg_test_success (test, "set red");
} else {
- egg_test_failed (test, "could not set red (%i)", colour);
+ egg_test_failed (test, "could not set red (%i)", color);
}
/************************************************************/
egg_test_title (test, "set green");
- colour = egg_color_from_rgb (0x00, 0xff, 0x00);
- if (colour == 0x00ff00) {
+ color = egg_color_from_rgb (0x00, 0xff, 0x00);
+ if (color == 0x00ff00) {
egg_test_success (test, "set green");
} else {
- egg_test_failed (test, "could not set green (%i)", colour);
+ egg_test_failed (test, "could not set green (%i)", color);
}
/************************************************************/
egg_test_title (test, "set blue");
- colour = egg_color_from_rgb (0x00, 0x00, 0xff);
- if (colour == 0x0000ff) {
+ color = egg_color_from_rgb (0x00, 0x00, 0xff);
+ if (color == 0x0000ff) {
egg_test_success (test, "set blue");
} else {
- egg_test_failed (test, "could not set blue (%i)", colour);
+ egg_test_failed (test, "could not set blue (%i)", color);
}
/************************************************************/
egg_test_title (test, "set white");
- colour = egg_color_from_rgb (0xff, 0xff, 0xff);
- if (colour == 0xffffff) {
+ color = egg_color_from_rgb (0xff, 0xff, 0xff);
+ if (color == 0xffffff) {
egg_test_success (test, "set white");
} else {
- egg_test_failed (test, "could not set white (%i)", colour);
+ egg_test_failed (test, "could not set white (%i)", color);
}
egg_test_end (test);
Modified: trunk/src/egg-test.c
==============================================================================
--- trunk/src/egg-test.c (original)
+++ trunk/src/egg-test.c Mon Oct 6 14:22:55 2008
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2007 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2007-2008 Richard Hughes <richard hughsie com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -263,6 +263,31 @@
}
/**
+ * egg_test_assert:
+ **/
+void
+egg_test_assert (EggTest *test, gboolean value)
+{
+ if (value)
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, NULL);
+}
+
+/**
+ * egg_test_title_assert:
+ **/
+void
+egg_test_title_assert (EggTest *test, const gchar *text, gboolean value)
+{
+ egg_test_title (test, "%s", text);
+ if (value)
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, NULL);
+}
+
+/**
* egg_test_get_data_file:
**/
gchar *
Modified: trunk/src/egg-test.h
==============================================================================
--- trunk/src/egg-test.h (original)
+++ trunk/src/egg-test.h Mon Oct 6 14:22:55 2008
@@ -30,6 +30,8 @@
gboolean egg_test_start (EggTest *test, const gchar *name);
void egg_test_end (EggTest *test);
void egg_test_title (EggTest *test, const gchar *format, ...);
+void egg_test_title_assert (EggTest *test, const gchar *text, gboolean value);
+void egg_test_assert (EggTest *test, gboolean value);
void egg_test_success (EggTest *test, const gchar *format, ...);
void egg_test_failed (EggTest *test, const gchar *format, ...);
EggTest *egg_test_init (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]