Files
mcde/programs/dtsystemsettings/test_panes.c
T
lotherkandClaude Opus 5.5 6f68d92f75 mcde: dtsystemsettings, the settings of the computer in one window
Four bands of icons -- Personal, Hardware, Internet & Network, System --
from panes.c (plain C, PASS test_panes); a click opens the pane in the
window, Show All goes back, -pane ID opens one directly.  Own panes through
McdeSys: Sound (volume, mute), Network (the cards, addresses, SSID),
Bluetooth (state, on/off), Date & Time (a running clock, the zone), About
(everything mcde_sys_info knows).  Appearance, Desktop, Fonts, Language,
Screen Saver, Keyboard, Mouse, Startup open dtstyle, Printers dtprintinfo,
until they are drawn here; Accounts and Software Update are greyed.  dtbar's
System Settings... and the Sound/Bluetooth/Network Settings... items open
it.  New icons: a 48-pixel Makronix logo, 32-pixel network and Bluetooth.
Seen on Xvfb with dtwm and dtbar, sound against a private PulseAudio.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 12:24:42 +00:00

58 lines
1.5 KiB
C

/*
* test_panes.c -- the tests of panes.c (make check)
*
* Copyright (c) 2026 The Makronix project. GNU LGPL 2.0 or later, as CDE.
*/
#include <stdio.h>
#include <string.h>
#include "panes.h"
static int failures;
#define CHECK(cond) do { \
if (!(cond)) { \
printf("FAIL %s:%d: %s\n", __FILE__, __LINE__, #cond); \
failures++; \
} \
} while (0)
int
main(void)
{
int i, j, perCat[CAT_COUNT] = { 0 };
CHECK(paneCount > 0);
for (i = 0; i < paneCount; i++) {
const Pane *p = &panes[i];
CHECK(p->id != NULL && p->id[0] != '\0');
CHECK(p->label != NULL && p->label[0] != '\0');
CHECK(p->icon != NULL && strstr(p->icon, ".pm") != NULL);
CHECK(p->category >= 0 && p->category < CAT_COUNT);
CHECK(p->kind == PANE_OWN || p->kind == PANE_COMMAND ||
p->kind == PANE_LATER);
/* a command pane has its command, the others none */
CHECK((p->kind == PANE_COMMAND) == (p->command != NULL));
for (j = 0; j < i; j++)
CHECK(strcmp(panes[j].id, p->id) != 0);
/* the panes of a category stand together */
if (i > 0)
CHECK(p->category >= panes[i - 1].category);
if (p->category >= 0 && p->category < CAT_COUNT)
perCat[p->category]++;
CHECK(PaneFind(p->id) == p);
}
for (i = 0; i < CAT_COUNT; i++) {
CHECK(categoryNames[i] != NULL);
CHECK(perCat[i] > 0); /* no empty row */
}
CHECK(PaneFind("nothing") == NULL);
CHECK(PaneFind(NULL) == NULL);
CHECK(PaneFind("sound") != NULL && PaneFind("sound")->kind == PANE_OWN);
if (failures == 0)
printf("PASS test_panes\n");
return failures != 0;
}