1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
3
* Copyright (C) 2007-2011 Richard Hughes <richard@hughsie.com>
5
* Licensed under the GNU General Public License Version 2
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
#include <glib-object.h>
32
gcm_test_dmi_func (void)
37
g_assert (dmi != NULL);
38
g_assert (gcm_dmi_get_name (dmi) != NULL);
39
g_assert (gcm_dmi_get_vendor (dmi) != NULL);
44
gcm_test_edid_func (void)
52
edid = gcm_edid_new ();
53
g_assert (edid != NULL);
55
/* LG 21" LCD panel */
56
ret = g_file_get_contents (TESTDATADIR "/LG-L225W-External.bin",
57
&data, &length, &error);
58
g_assert_no_error (error);
60
ret = gcm_edid_parse (edid, (const guint8 *) data, length, &error);
61
g_assert_no_error (error);
64
g_assert_cmpstr (gcm_edid_get_monitor_name (edid), ==, "L225W");
65
g_assert_cmpstr (gcm_edid_get_vendor_name (edid), ==, "Goldstar Company Ltd");
66
g_assert_cmpstr (gcm_edid_get_serial_number (edid), ==, "34398");
67
g_assert_cmpstr (gcm_edid_get_eisa_id (edid), ==, NULL);
68
g_assert_cmpstr (gcm_edid_get_checksum (edid), ==, "0bb44865bb29984a4bae620656c31368");
69
g_assert_cmpstr (gcm_edid_get_pnp_id (edid), ==, "GSM");
70
g_assert_cmpint (gcm_edid_get_height (edid), ==, 30);
71
g_assert_cmpint (gcm_edid_get_width (edid), ==, 47);
72
g_assert_cmpfloat (gcm_edid_get_gamma (edid), >=, 2.2f - 0.01);
73
g_assert_cmpfloat (gcm_edid_get_gamma (edid), <, 2.2f + 0.01);
76
/* Lenovo T61 internal Panel */
77
ret = g_file_get_contents (TESTDATADIR "/Lenovo-T61-Internal.bin",
78
&data, &length, &error);
79
g_assert_no_error (error);
81
ret = gcm_edid_parse (edid, (const guint8 *) data, length, &error);
82
g_assert_no_error (error);
85
g_assert_cmpstr (gcm_edid_get_monitor_name (edid), ==, NULL);
86
g_assert_cmpstr (gcm_edid_get_vendor_name (edid), ==, "IBM France");
87
g_assert_cmpstr (gcm_edid_get_serial_number (edid), ==, NULL);
88
g_assert_cmpstr (gcm_edid_get_eisa_id (edid), ==, "LTN154P2-L05");
89
g_assert_cmpstr (gcm_edid_get_checksum (edid), ==, "e1865128c7cd5e5ed49ecfc8102f6f9c");
90
g_assert_cmpstr (gcm_edid_get_pnp_id (edid), ==, "IBM");
91
g_assert_cmpint (gcm_edid_get_height (edid), ==, 21);
92
g_assert_cmpint (gcm_edid_get_width (edid), ==, 33);
93
g_assert_cmpfloat (gcm_edid_get_gamma (edid), >=, 2.2f - 0.01);
94
g_assert_cmpfloat (gcm_edid_get_gamma (edid), <, 2.2f + 0.01);
97
g_object_unref (edid);
101
main (int argc, char **argv)
103
gtk_init (&argc, &argv);
104
g_test_init (&argc, &argv, NULL);
106
g_test_add_func ("/color/dmi", gcm_test_dmi_func);
107
g_test_add_func ("/color/edid", gcm_test_edid_func);
109
return g_test_run ();