xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
<root> / tests / misc / ui_view_schedule.c (e7a6d2bb24759eacca37d9b6816e24f5b5cacab9) (1,777B) (mode 100644) [raw]
#include <stic.h>

#include <test-utils.h>

#include "../../src/ui/ui.h"

static view_t *const view = &lwin;

SETUP()
{
	view_setup(&lwin);

	(void)ui_view_query_scheduled_event(view);
	assert_true(ui_view_query_scheduled_event(view) == UUE_NONE);
}

TEARDOWN()
{
	view_teardown(&lwin);
}

TEST(schedule_redraw_sets_redrawn)
{
	ui_view_schedule_redraw(view);
	assert_true(ui_view_query_scheduled_event(view) == UUE_REDRAW);
}

TEST(schedule_reload_sets_reload)
{
	ui_view_schedule_reload(view);
	assert_true(ui_view_query_scheduled_event(view) == UUE_RELOAD);
}

TEST(query_resets_redraw_event)
{
	ui_view_schedule_redraw(view);
	assert_true(ui_view_query_scheduled_event(view) == UUE_REDRAW);
	assert_true(ui_view_query_scheduled_event(view) == UUE_NONE);
}

TEST(query_resets_reload_event)
{
	ui_view_schedule_reload(view);
	assert_true(ui_view_query_scheduled_event(view) == UUE_RELOAD);
	assert_true(ui_view_query_scheduled_event(view) == UUE_NONE);
}

TEST(redraw_request_does_not_reset_reload)
{
	ui_view_schedule_reload(view);
	ui_view_schedule_redraw(view);
	assert_true(ui_view_query_scheduled_event(view) == UUE_RELOAD);
}

TEST(reload_resets_redraw)
{
	ui_view_schedule_redraw(view);
	ui_view_schedule_reload(view);
	assert_true(ui_view_query_scheduled_event(view) == UUE_RELOAD);
}

TEST(multiple_requests_do_not_cancel_each_other)
{
	int i;
	for(i = 0; i < 10; ++i)
	{
		ui_view_schedule_redraw(view);
		ui_view_schedule_redraw(view);
		assert_true(ui_view_query_scheduled_event(view) == UUE_REDRAW);

		ui_view_schedule_reload(view);
		ui_view_schedule_reload(view);
		assert_true(ui_view_query_scheduled_event(view) == UUE_RELOAD);
	}
}

/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
/* vim: set cinoptions+=t0 filetype=c : */
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master