static void
test_engine_misc (CORBA_Environment *ev)
{
	MateComponentUINode *node;
	MateComponentUIEngine *engine;

	fprintf (stderr, "   misc ...\n");

	engine = matecomponent_ui_engine_new (NULL);

	node = matecomponent_ui_node_from_string (
		"<testnode name=\"Foo\" prop=\"A\"/>");

	matecomponent_ui_engine_xml_merge_tree (engine, "/", node, "A");

	matecomponent_ui_engine_xml_set_prop (engine, "/Foo", "prop", "B", "B");

	check_prop (engine, "/Foo", "prop", "B");

	matecomponent_ui_engine_xml_rm (engine, "/", "B");

	check_prop (engine, "/Foo", "prop", "A");

	g_assert (matecomponent_ui_engine_node_is_dirty (
		engine, matecomponent_ui_engine_get_path (engine, "/Foo")));

	g_object_unref (engine);
}
Esempio n. 2
0
/**
 * \a check_prop callback filters functions to avoid drawing certain properties,
 * in cases where PROP_HIDDEN flag can't be used for a property.
 */
int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr,
                     int (*check_prop)(PointerRNA *, PropertyRNA *),
                     const char label_align)
{
	uiLayout *split, *col;
	int flag;
	const char *name;
	int tot = 0;

	assert(ELEM3(label_align, '\0', 'H', 'V'));

	RNA_STRUCT_BEGIN (ptr, prop)
	{
		flag = RNA_property_flag(prop);
		if (flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop) == FALSE))
			continue;

		if (label_align != '\0') {
			PropertyType type = RNA_property_type(prop);
			int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop));

			name = RNA_property_ui_name(prop);

			if (label_align == 'V') {
				col = uiLayoutColumn(layout, TRUE);

				if (!is_boolean)
					uiItemL(col, name, ICON_NONE);
			}
			else if (label_align == 'H') {
				split = uiLayoutSplit(layout, 0.5f, FALSE);

				col = uiLayoutColumn(split, FALSE);
				uiItemL(col, (is_boolean) ? "" : name, ICON_NONE);
				col = uiLayoutColumn(split, FALSE);
			}
			else {
				col = NULL;
			}

			/* may meed to add more cases here.
			 * don't override enum flag names */

			/* name is shown above, empty name for button below */
			name = (flag & PROP_ENUM_FLAG || is_boolean) ? NULL : "";
		}
		else {
			col = layout;
			name = NULL; /* no smart label alignment, show default name with button */
		}

		uiItemFullR(col, ptr, prop, -1, 0, 0, name, ICON_NONE);
		tot++;
	}
static void
run_subtest(const struct subtest_t st, bool *pass)
{
	enum piglit_result result;
	bool local_pass = true;
	int index, i = 0;

	if (*st.prog == -1 || !check_extensions(*st.prog, st.programInterface)) {
		result = PIGLIT_SKIP;
		goto report_result;
	}

	if (st.programInterface != GL_ATOMIC_COUNTER_BUFFER) {
		index = glGetProgramResourceIndex(*st.prog,
						  st.programInterface, st.name);
		piglit_check_gl_error(GL_NO_ERROR);
		if (index < 0) {
			printf("	Could not find resource '%s' in program"
			       " %u\n", st.name, *st.prog);
			result = PIGLIT_FAIL;
			goto report_result;
		}
	} else {
		/* As we cannot query the index of an atomic variable, let's
		 * hardcode it to 0 and make sure the program only has ONE
		 * atomic variable. In our case, we only use the fs_atom stage
		 * which defines only one variable.
		 */
		index = 0;
	}

	while (st.props[i].prop != 0) {
		check_prop(*st.prog, st.programInterface, index, st.name,
			   st.inputs, st.props[i], &local_pass);
		i++;
	}

	*pass = *pass && local_pass;
	result = local_pass ? PIGLIT_PASS : PIGLIT_FAIL;

report_result:
	piglit_report_subtest_result(result, "%s on %s", st.name,
				  piglit_get_gl_enum_name(st.programInterface));
}
Esempio n. 4
0
void permute_and_check(int start, int end)
{
	int i, tmp;

	if (start == end-1) {
		if (check_prop())
			sum += to_number(0, 9);
		return;
	}

	permute_and_check(start+1, end);
	for (i = start+1; i < end; i++) {
		tmp = digits[start];
		digits[start] = digits[i];
		digits[i] = tmp;
		permute_and_check(start+1, end);
	}

	tmp = digits[start];
	for (i = start; i < end-1; i++)
		digits[i] = digits[i+1];
	digits[end-1] = tmp;
}