mirror of
https://git.proxmox.com/git/fwupd
synced 2025-06-05 10:40:20 +00:00
trivial: Fix bitwise operators in last commit
This commit is contained in:
parent
5d6cb83d1c
commit
fd08eaefee
@ -1093,7 +1093,7 @@ fu_context_add_flag(FuContext *context, FuContextFlags flag)
|
||||
{
|
||||
FuContextPrivate *priv = GET_PRIVATE(context);
|
||||
g_return_if_fail(FU_IS_CONTEXT(context));
|
||||
if (priv->flags | flag)
|
||||
if (priv->flags & flag)
|
||||
return;
|
||||
priv->flags |= flag;
|
||||
g_object_notify(G_OBJECT(context), "flags");
|
||||
@ -1113,7 +1113,7 @@ fu_context_remove_flag(FuContext *context, FuContextFlags flag)
|
||||
{
|
||||
FuContextPrivate *priv = GET_PRIVATE(context);
|
||||
g_return_if_fail(FU_IS_CONTEXT(context));
|
||||
if ((priv->flags | flag) == 0)
|
||||
if ((priv->flags & flag) == 0)
|
||||
return;
|
||||
priv->flags &= ~flag;
|
||||
g_object_notify(G_OBJECT(context), "flags");
|
||||
|
@ -415,6 +415,22 @@ fu_smbios3_func(void)
|
||||
g_assert_cmpstr(str, ==, "Dell Inc.");
|
||||
}
|
||||
|
||||
static void
|
||||
fu_context_flags_func(void)
|
||||
{
|
||||
g_autoptr(FuContext) ctx = fu_context_new();
|
||||
|
||||
g_assert_false(fu_context_has_flag(ctx, FU_CONTEXT_FLAG_SAVE_EVENTS));
|
||||
fu_context_add_flag(ctx, FU_CONTEXT_FLAG_SAVE_EVENTS);
|
||||
g_assert_true(fu_context_has_flag(ctx, FU_CONTEXT_FLAG_SAVE_EVENTS));
|
||||
fu_context_remove_flag(ctx, FU_CONTEXT_FLAG_SAVE_EVENTS);
|
||||
fu_context_remove_flag(ctx, FU_CONTEXT_FLAG_SAVE_EVENTS);
|
||||
g_assert_false(fu_context_has_flag(ctx, FU_CONTEXT_FLAG_SAVE_EVENTS));
|
||||
fu_context_add_flag(ctx, FU_CONTEXT_FLAG_SAVE_EVENTS);
|
||||
fu_context_add_flag(ctx, FU_CONTEXT_FLAG_SAVE_EVENTS);
|
||||
g_assert_true(fu_context_has_flag(ctx, FU_CONTEXT_FLAG_SAVE_EVENTS));
|
||||
}
|
||||
|
||||
static void
|
||||
fu_context_hwids_dmi_func(void)
|
||||
{
|
||||
@ -3790,6 +3806,7 @@ main(int argc, char **argv)
|
||||
g_test_add_func("/fwupd/common{strsafe}", fu_strsafe_func);
|
||||
g_test_add_func("/fwupd/efivar", fu_efivar_func);
|
||||
g_test_add_func("/fwupd/hwids", fu_hwids_func);
|
||||
g_test_add_func("/fwupd/context{flags}", fu_context_flags_func);
|
||||
g_test_add_func("/fwupd/context{hwids-dmi}", fu_context_hwids_dmi_func);
|
||||
g_test_add_func("/fwupd/smbios", fu_smbios_func);
|
||||
g_test_add_func("/fwupd/smbios3", fu_smbios3_func);
|
||||
|
Loading…
Reference in New Issue
Block a user