void TestKeyModded(CuTest* tc) { START_KEY_CAPTURE; key_press(3);//sD key_release(3); EXPECT_SENT(3); VERIFY NOKEYS WITH(LSFT); THEN KEY(D) WITH(LSFT); THEN NOKEYS; }
void TestModifierTapModded(CuTest *tc) { START_KEY_CAPTURE; key_press(2);//rshift or ) key_release(2); EXPECT_SENT(5); VERIFY NOKEYS WITH(RSFT); THEN NOKEYS NOMODS; THEN NOKEYS WITH(LSFT); THEN KEY(9) WITH(LSFT); THEN NOKEYS NOMODS; }
void TestModifierTapRelease(CuTest *tc) { START_KEY_CAPTURE; key_press(4);//lshift or z make_dualrole_modifier_possible();//pretend enough time has passed key_press(0); key_release(4); key_release(0); VERIFY NOKEYS WITH(LSFT); THEN KEY(A) WITH(LSFT); THEN KEY(A) NOMODS; THEN NOKEYS NOMODS; }
void TestComplicated(CuTest *tc) { START_KEY_CAPTURE; SHOULDNOT_SEND; key_press(5);//F or layer 1 VERIFY_DIDNOT_SEND; CuAssertIntEquals(tc, 1, active_layer); make_dualrole_modifier_possible();//pretend enough time has passed key_press(0);//LSFT of LBRACKET key_release(0); CuAssertIntEquals(tc, 1, active_layer); SHOULDNOT_SEND; key_release(5); VERIFY_DIDNOT_SEND; CuAssertIntEquals(tc, 0, active_layer); EXPECT_SENT(4); VERIFY NOKEYS WITH(LSFT); THEN NOKEYS NOMODS; THEN KEY(LBRACKET); THEN NOKEYS; }
void TestModifierOrKeyCanMod(CuTest *tc) { START_KEY_CAPTURE; key_press(4);//shift or Z make_dualrole_modifier_possible();//pretend enough time has passed key_press(0);//A key_release(0); key_release(4); key_press(0);//A key_release(0); EXPECT_SENT(6); VERIFY NOKEYS WITH(LSFT); THEN KEY(A) WITH(LSFT); THEN NOKEYS WITH(LSFT); THEN NOKEYS NOMODS; THEN KEY(A) NOMODS; THEN NOKEYS NOMODS; }
void TestModifierOrKeyCanTap(CuTest *tc) { START_KEY_CAPTURE; key_press(4);//shift or Z key_release(4); EXPECT_SENT(4); VERIFY NOKEYS WITH(LSFT); THEN NOKEYS NOMODS; THEN KEY(Z) NOMODS; THEN NOKEYS NOMODS; }
/// Function name : calculateReturnObjectEncoding // Description : Encodes the data in a ReturnObject into the format used in MSCI scripts // // CONST RETURN_OBJECT* pReturnObject : [in] ReturnObject containing the ReturnType, JumpDestination and Conditional to encode into an integer // // Return type : Packed 32-bit ReturnObject // INT calculateReturnObjectEncoding(CONST RETURN_OBJECT* pReturnObject) { switch (pReturnObject->eType) { // [VARIABLE] Return the zero-based variable ID case ROT_VARIABLE: return pReturnObject->iVariableID; // [CONDITIONAL] Encode the jump and conditional information case ROT_CONDITIONAL: // RETURN_TYPE in the H.O. byte, DESTINATION in the middle word, CONDITIONAL in the L.O. byte return ((INT)pReturnObject->eReturnType << 24) WITH (pReturnObject->iDestination << 8) WITH (INT)pReturnObject->eConditional; } return NULL; }
void TestSpaceFn(CuTest *tc) { START_KEY_CAPTURE; key_press(3); key_release(3); SHOULDNOT_SEND; key_press(16*8+6);//SPACE CuAssertIntEquals(tc, 1, active_layer); VERIFY_DIDNOT_SEND; key_release(16*8+6);//SPACE CuAssertIntEquals(tc, 0, active_layer); SHOULDNOT_SEND; key_press(16*8+6);//SPACE CuAssertIntEquals(tc, 1, active_layer); VERIFY_DIDNOT_SEND; make_dualrole_modifier_possible();//pretend enough time has passed key_press(11*8+3);//K or down key_release(11*8+3); SHOULDNOT_SEND; key_release(16*8+6);//SPACE CuAssertIntEquals(tc, 0, active_layer); VERIFY_DIDNOT_SEND; VERIFY NOKEYS WITH(RGUI); THEN NOKEYS NOMODS; THEN KEY(SPACE) NOMODS; THEN NOKEYS NOMODS; THEN KEY(DOWN); THEN NOKEYS; }
void TestModModded(CuTest* tc) { START_KEY_CAPTURE; SHOULDNOT_SEND; key_press(7);//toggle layer to 1 CuAssertIntEquals(tc, 1, active_layer); key_release(7); CuAssertIntEquals(tc, 1, active_layer); VERIFY_DIDNOT_SEND; key_press(2);//sLALT key_release(2);//sLALT SHOULDNOT_SEND; key_press(7);//toggle layer to 0 CuAssertIntEquals(tc, 0, active_layer); key_release(7); CuAssertIntEquals(tc, 0, active_layer); VERIFY_DIDNOT_SEND; VERIFY NOKEYS WITH(LSFT|LALT); THEN NOKEYS; }
group create_global_group(client<mailing_list_state>& ct, groups g){ assert(g._ro); #ifdef USE_PRECOMPILED constexpr #include "mailing_list_create_group.cpp.precompiled" txn; #else constexpr auto txn = TRANSACTION( var new_group = g->value, /* cut off the users list */ new_group.users->next = new_group.users->next.nulled(), var new_grouplist_node = *g, new_grouplist_node.value = new_group, g->next = g.new(new_grouplist_node), return new_group ).WITH(g); #endif using connections = typename DECT(ct.trk)::connection_references; auto strong_connection = ct.get_relay<Level::strong>().lock(); auto causal_connection = ct.get_relay<Level::causal>().lock(); return txn.run_remote(ct.trk,&ct.dsm, connections{ConnectionReference<Label<strong> >{*strong_connection},ConnectionReference<Label<causal> >{*causal_connection}},g); }