void UT_CMceStateIdle::UT_CMceStateIdle_AcceptLL()
{
    TMceIds ids;
    CMceMsgBase* msg = NULL;

    TMceStateTransitionEvent event1( *iSipSession, EMceItcEstablishSession, ids, *msg );
    EUNIT_ASSERT ( iState->AcceptL( event1 ) );

    TMceStateTransitionEvent event2( *iSipSession, EMceInvite );
    EUNIT_ASSERT ( iState->AcceptL( event2 ) );

    TMceStateTransitionEvent event3( *iSipSession, EMceMediaUpdated );
    TRAPD( e1, iState->AcceptL( event3 ) );
    EUNIT_ASSERT ( e1 == KErrTotalLossOfPrecision );

    TMceStateTransitionEvent event4( *iSipSession, EMceItcUpdate, ids, *msg );
    TRAPD( e2, iState->AcceptL( event4 ) );
    EUNIT_ASSERT ( e2 == KErrTotalLossOfPrecision );

    TMceStateTransitionEvent event5( *iSipSession, EMceCancel, KErrNotFound );
    TRAPD( e3, iState->AcceptL( event5 ) );
    EUNIT_ASSERT ( e3 == KErrTotalLossOfPrecision );


    TMceStateTransitionEvent event8( *iSipSession, EMceMediaUpdated );
    TRAPD( e6, iState->AcceptL( event8 ) );
    EUNIT_ASSERT ( e6 == KErrTotalLossOfPrecision );
}
Example #2
0
wxInt32 wxRadioButton::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler), WXEVENTREF WXUNUSED(event) )
{
    // if already set -> no action
    if (GetValue())
        return noErr;

    wxRadioButton *cycle;
    cycle = this->NextInCycle();
    if (cycle != NULL)
    {
        while (cycle != this)
        {
            if (cycle->GetValue())
                cycle->SetValue( false );

            cycle = cycle->NextInCycle();
        }
    }

    SetValue( true );

    wxCommandEvent event2( wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId );
    event2.SetEventObject( this );
    event2.SetInt( true );
    ProcessCommand( event2 );

    return noErr;
}
Example #3
0
static void
gtk_value_changed(GtkSpinButton* spinbutton, wxSpinButton* win)
{
    const double value = gtk_spin_button_get_value(spinbutton);
    const int pos = int(value);
    const int oldPos = win->m_pos;
    if (g_blockEventsOnDrag || pos == oldPos)
    {
        win->m_pos = pos;
        return;
    }

    wxSpinEvent event(pos > oldPos ? wxEVT_SCROLL_LINEUP : wxEVT_SCROLL_LINEDOWN, win->GetId());
    event.SetPosition(pos);
    event.SetEventObject(win);

    if ((win->HandleWindowEvent( event )) &&
        !event.IsAllowed() )
    {
        /* program has vetoed */
        // this will cause another "value_changed" signal,
        // but because pos == oldPos nothing will happen
        gtk_spin_button_set_value(spinbutton, oldPos);
        return;
    }

    win->m_pos = pos;

    /* always send a thumbtrack event */
    wxSpinEvent event2(wxEVT_SCROLL_THUMBTRACK, win->GetId());
    event2.SetPosition(pos);
    event2.SetEventObject(win);
    win->HandleWindowEvent(event2);
}
void DebuggerToolbarHandler::OnStop(cb_unused wxCommandEvent& event)
{
    DebuggerManager *manager = Manager::Get()->GetDebuggerManager();
    cbDebuggerPlugin *plugin = manager->GetActiveDebugger();
    if (!plugin)
        return;

    if (plugin->IsAttachedToProcess())
    {
        wxMenu m;

        if (plugin->IsStopped())
            m.Append(idMenuDetach, _("Detach"));
        else
        {
            wxMenuItem *detach_item = m.Append(idMenuDetach, _("Detach (debugger is running)"));
            detach_item->Enable(false);
        }

        m.Append(idMenuStop, _("Stop debugger (kills the debuggee)"));

        Manager::Get()->GetAppWindow()->PopupMenu(&m);
    }
    else
    {
        wxCommandEvent event2(wxEVT_COMMAND_TOOL_CLICKED, idMenuStop);
        m_Toolbar->GetEventHandler()->ProcessEvent(event2);
    }
}
Example #5
0
void RunEvent(int id, EditorFrame* editorFrame) {
	wxCommandEvent event2(wxEVT_COMMAND_MENU_SELECTED);
	event2.SetEventObject(editorFrame);
	event2.SetId(id);
	event2.SetInt(id);
	editorFrame->GetEventHandler()->ProcessEvent(event2);
}
Example #6
0
void wxRadioButtonCallback (Widget w, XtPointer clientData,
                            XmToggleButtonCallbackStruct * cbs)
{
    if (!cbs->set)
        return;

    wxRadioButton *item = (wxRadioButton *) clientData;
    if (item->InSetValue())
        return;

    //based on mac/radiobut.cpp
    wxRadioButton* old = item->ClearSelections();
    item->SetValue(true);

    if ( old )
    {
        wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
                             old->GetId() );
        event.SetEventObject(old);
        event.SetInt( false );
        old->ProcessCommand(event);
    }
    wxCommandEvent event2(wxEVT_COMMAND_RADIOBUTTON_SELECTED, item->GetId() );
    event2.SetEventObject(item);
    event2.SetInt( true );
    item->ProcessCommand(event2);
}
Example #7
0
static void
gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
{
    // when the popup is hidden, throw a SELECTED event only if the combobox
    // selection changed.
    const int curSelection = combo->GetCurrentSelection();

    const bool hasChanged = curSelection != g_SelectionBeforePopup;

    // reset the selection flag to value meaning that it is hidden and do it
    // now, before generating the events, so that GetSelection() returns the
    // new value from the event handler
    g_SelectionBeforePopup = wxID_NONE;

    if ( hasChanged )
    {
        wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
        event.SetInt( curSelection );
        event.SetString( combo->GetStringSelection() );
        event.SetEventObject( combo );
        combo->GetEventHandler()->ProcessEvent( event );

        // for consistency with the other ports, send TEXT event
        wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
        event2.SetString( combo->GetStringSelection() );
        event2.SetEventObject( combo );
        combo->GetEventHandler()->ProcessEvent( event2 );
    }
}
bool wxRadioButton::OSXHandleClicked( double WXUNUSED(timestampsec) )
{
    if ( !GetPeer()->ButtonClickDidStateChange() )
    {
        // if already set -> no action
        if (GetValue())
            return true;
    }

    wxRadioButton *cycle;
    cycle = this->NextInCycle();
    if (cycle != NULL)
    {
        while (cycle != this)
        {
            if (cycle->GetValue())
                cycle->SetValue( false );

            cycle = cycle->NextInCycle();
        }
    }

    SetValue( true );

    wxCommandEvent event2( wxEVT_RADIOBUTTON, m_windowId );
    event2.SetEventObject( this );
    event2.SetInt( true );
    ProcessCommand( event2 );

    return true;
}
void UT_CMceStateError::UT_CMceStateError_AcceptLL()
    {
    TMceIds ids;
    CMceMsgBase* msg = NULL;
    
    
    TMceStateTransitionEvent event1( *iSipSession, EMceItcEstablishSession, ids, *msg );
    TRAPD( error, iState->AcceptL( event1 ) );
    EUNIT_ASSERT ( error != KErrNone );

    TMceStateTransitionEvent event2( *iSipSession, EMceAck );
    EUNIT_ASSERT ( iState->AcceptL( event2 ) );

    TMceStateTransitionEvent event3( *iSipSession, EMceMediaSessionStopped );
    EUNIT_ASSERT ( iState->AcceptL( event3 ) );
    
    //state terminated tests
    iSipSession->NextState( KMceStateTerminated );
    CMceStateTerminated* stateTerminated = static_cast<CMceStateTerminated*>(&iSipSession->CurrentState());
    
    TMceStateTransitionEvent event4( *iSipSession, EMceItcEstablishSession, ids, *msg );
    TRAPD( error1, stateTerminated->AcceptL( event4 ) );
    EUNIT_ASSERT ( error1 != KErrNone );
    
    
    }
Example #10
0
void wxSliderCallback (Widget widget, XtPointer clientData,
                       XmScaleCallbackStruct * cbs)
{
    wxSlider *slider = (wxSlider *) clientData;
    wxEventType scrollEvent;

    switch (cbs->reason)
    {
    case XmCR_VALUE_CHANGED:
        scrollEvent = wxEVT_SCROLL_THUMBRELEASE;
        break;

    case XmCR_DRAG:
        scrollEvent = wxEVT_SCROLL_THUMBTRACK;
        break;

    default:
        return;
    }

    wxScrollEvent event(scrollEvent, slider->GetId());
    int commandInt = event.GetInt();
    XtVaGetValues (widget, XmNvalue, &commandInt, NULL);
    event.SetInt(commandInt);
    event.SetEventObject(slider);
    slider->HandleWindowEvent(event);

    // Also send a wxCommandEvent for compatibility.
    wxCommandEvent event2(wxEVT_SLIDER, slider->GetId());
    event2.SetEventObject(slider);
    event2.SetInt( event.GetInt() );
    slider->HandleWindowEvent(event2);
}
/*!
 * Test style in preedit mode.
 */
void Ut_MRichTextEdit::testStyleOnPreedit()
{
    QString htmlText = "<b>bold </b><i>italic </i>";
    m_subject->document()->setHtml(htmlText);

    QString text("preedit mode text");
    QInputMethodEvent event1(text, QList<QInputMethodEvent::Attribute>());

    m_subject->inputMethodEvent(&event1);

    QFont curFont = m_subject->currentFont();
    bool curItalicStyle = curFont.italic();
    QCOMPARE(curItalicStyle, true);

    event1.setCommitString("Test preedit style");
    m_subject->inputMethodEvent(&event1);

    curFont = m_subject->currentFont();
    curItalicStyle = curFont.italic();
    QCOMPARE(curItalicStyle, true);

    m_subject->setText("text");
    text = QString("preedit mode");
    QInputMethodEvent event2(text, QList<QInputMethodEvent::Attribute>());

    int eventCursorPosition = 1;
    QGraphicsSceneMouseEvent *mouseEvent = new QGraphicsSceneMouseEvent();
    m_subject->handleMouseRelease(eventCursorPosition, mouseEvent);
    m_subject->setFontUnderline(true);
    m_subject->inputMethodEvent(&event2);

    text = QString("a");
    QInputMethodEvent event3(text, QList<QInputMethodEvent::Attribute>());
    m_subject->inputMethodEvent(&event3);

    curFont = m_subject->currentFont();
    bool curUnderlineStyle = curFont.underline();
    QCOMPARE(curUnderlineStyle, true);

    m_subject->setText("text");
    text = QString("preedit mode");
    QInputMethodEvent event4(text, QList<QInputMethodEvent::Attribute>());

    m_subject->handleMouseRelease(eventCursorPosition, mouseEvent);
    m_subject->setFontUnderline(true);
    m_subject->inputMethodEvent(&event4);
    event4.setCommitString(" ");
    m_subject->inputMethodEvent(&event4);

    QTextCursor cursor = m_subject->textCursor();
    cursor.setPosition(0);
    curFont = m_subject->currentFont();
    curUnderlineStyle = curFont.underline();
    QCOMPARE(curUnderlineStyle, true);

    delete mouseEvent;
    mouseEvent = 0;
}
Example #12
0
void TabOrderEditor::mousePressEvent(QMouseEvent *e)
{
    e->accept();

    if (!m_indicator_region.contains(e->pos())) {
        if (QWidget *child = m_bg_widget->childAt(e->pos())) {
            QDesignerFormEditorInterface *core = m_form_window->core();
            if (core->widgetFactory()->isPassiveInteractor(child)) {

                QMouseEvent event(QEvent::MouseButtonPress,
                                    child->mapFromGlobal(e->globalPos()),
                                    e->button(), e->buttons(), e->modifiers());

                qApp->sendEvent(child, &event);

                QMouseEvent event2(QEvent::MouseButtonRelease,
                                    child->mapFromGlobal(e->globalPos()),
                                    e->button(), e->buttons(), e->modifiers());

                qApp->sendEvent(child, &event2);

                updateBackground();
            }
        }
        return;
    }

    if (e->button() != Qt::LeftButton)
        return;

    const int target_index = widgetIndexAt(e->pos());
    if (target_index == -1)
        return;

    m_beginning = false;

    if (e->modifiers() & Qt::ControlModifier) {
        m_current_index = target_index + 1;
        if (m_current_index >= m_tab_order_list.size())
            m_current_index = 0;
        update();
        return;
    }

    if (m_current_index == -1)
        return;

    m_tab_order_list.swap(target_index, m_current_index);

    ++m_current_index;
    if (m_current_index == m_tab_order_list.size())
        m_current_index = 0;

    TabOrderCommand *cmd = new TabOrderCommand(formWindow());
    cmd->init(m_tab_order_list);
    formWindow()->commandHistory()->push(cmd);
}
Example #13
0
void EventSender::contextClick()
{
    QMouseEvent event(QEvent::MouseButtonPress, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier);
    QApplication::sendEvent(m_page, &event);
    QMouseEvent event2(QEvent::MouseButtonRelease, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier);
    QApplication::sendEvent(m_page, &event2);
    QContextMenuEvent event3(QContextMenuEvent::Mouse, m_mousePos);
    QApplication::sendEvent(m_page->view(), &event3);
}
Example #14
0
static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *win )
{
    if (g_isIdle) wxapp_install_idle_handler();

    if (!win->m_hasVMT) return;
    if (g_blockEventsOnDrag) return;

    float diff = win->m_adjust->value - win->m_oldPos;
    if (fabs(diff) < sensitivity) return;

    wxEventType command = wxEVT_NULL;

    float line_step = win->m_adjust->step_increment;

    if (fabs(diff-line_step) < sensitivity) command = wxEVT_SCROLL_LINEUP;
    else if (fabs(diff+line_step) < sensitivity) command = wxEVT_SCROLL_LINEDOWN;
    else command = wxEVT_SCROLL_THUMBTRACK;

    int value = (int)ceil(win->m_adjust->value);

    wxSpinEvent event( command, win->GetId());
    event.SetPosition( value );
    event.SetEventObject( win );

    if ((win->HandleWindowEvent( event )) &&
        !event.IsAllowed() )
    {
        /* program has vetoed */
        win->m_adjust->value = win->m_oldPos;

        gtk_signal_disconnect_by_func( GTK_OBJECT (win->m_adjust),
                                       (GtkSignalFunc) gtk_spinbutt_callback,
                                       (gpointer) win );

        gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );

        gtk_signal_connect( GTK_OBJECT (win->m_adjust),
                            "value_changed",
                            (GtkSignalFunc) gtk_spinbutt_callback,
                            (gpointer) win );
        return;
    }

    win->m_oldPos = win->m_adjust->value;

    /* always send a thumbtrack event */
    if (command != wxEVT_SCROLL_THUMBTRACK)
    {
        command = wxEVT_SCROLL_THUMBTRACK;
        wxSpinEvent event2( command, win->GetId());
        event2.SetPosition( value );
        event2.SetEventObject( win );
        win->HandleWindowEvent( event2 );
    }
}
Example #15
0
void TestEITFixups::testHTMLFixup()
{
    // Make sure we correctly strip HTML tags from EIT data
    EITFixUp fixup;

    DBEventEIT event(9311,
                      "<EM>CSI: Crime Scene Investigation</EM>",
                      "Double-Cross: Las Vegas-based forensic drama. The team investigates when two nuns find a woman crucified in the rafters of their church - and clues implicate the priest. (S7 Ep 5)",
                      QDateTime::fromString("2015-02-28T19:40:00Z", Qt::ISODate),
                      QDateTime::fromString("2015-02-28T20:00:00Z", Qt::ISODate),
                      EITFixUp::kFixHTML | EITFixUp::kFixUK,
                      SUB_UNKNOWN,
                      AUD_STEREO,
                      VID_UNKNOWN);

    fixup.Fix(event);
    PRINT_EVENT(event);
    QCOMPARE(event.title,       QString("CSI: Crime Scene Investigation"));
    QCOMPARE(event.subtitle,    QString("Double-Cross"));
// FIXME: Need to fix the capturing of (S7 Ep 5) for this to properly validate.
//    QCOMPARE(event.description, QString("Las Vegas-based forensic drama. The team investigates when two nuns find a woman crucified in the rafters of their church - and clues implicate the priest."));

    DBEventEIT event2(9311,
                      "<EM>New: Redneck Island</EM>",
                      "Twelve rednecks are stranded on a tropical island with 'Stone Cold' Steve Austin, but this is no holiday, they're here to compete for $100,000. S4, Ep4",
                      QDateTime::fromString("2015-02-28T19:40:00Z", Qt::ISODate),
                      QDateTime::fromString("2015-02-28T20:00:00Z", Qt::ISODate),
                      EITFixUp::kFixHTML | EITFixUp::kFixUK,
                      SUB_UNKNOWN,
                      AUD_STEREO,
                      VID_UNKNOWN);

    fixup.Fix(event2);
    PRINT_EVENT(event2);
    QCOMPARE(event2.title,       QString("Redneck Island"));

    DBEventEIT event3(14101,
                      "New: Jericho",
                      "Drama set in 1870s Yorkshire. In her desperation to protect her son, Annie unwittingly opens the door for Bamford the railway detective, who has returned to Jericho. [AD,S]",
                      QDateTime::fromString("2015-02-28T19:40:00Z", Qt::ISODate),
                      QDateTime::fromString("2015-02-28T20:00:00Z", Qt::ISODate),
                      EITFixUp::kFixHTML | EITFixUp::kFixUK,
                      SUB_UNKNOWN,
                      AUD_STEREO,
                      VID_UNKNOWN);

    fixup.Fix(event3);
    PRINT_EVENT(event3);
    QCOMPARE(event3.title,       QString("Jericho"));
    QCOMPARE(event3.description, QString("Drama set in 1870s Yorkshire. In her desperation to protect her son, Annie unwittingly opens the door for Bamford the railway detective, who has returned to Jericho."));

}
Example #16
0
static void
gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
                              GtkNotebookPage *page,
                              gint WXUNUSED(page_num),
                              wxMDIParentFrame *parent )
{
    if (g_isIdle)
        wxapp_install_idle_handler();

    // send deactivate event to old child

    wxMDIChildFrame *child = parent->GetActiveChild();
    if (child)
    {
        wxActivateEvent event1( wxEVT_ACTIVATE, false, child->GetId() );
        event1.SetEventObject( child);
        child->GetEventHandler()->ProcessEvent( event1 );
    }

    // send activate event to new child

    wxMDIClientWindow *client_window = parent->GetClientWindow();
    if (!client_window)
        return;

    child = (wxMDIChildFrame*) NULL;

    wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
    while (node)
    {
        wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
        // CE: we come here in the destructor with a null child_frame - I think because
        // gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page", (see below)
        // isn't deleted early enough
        if (!child_frame)
          return ;

        if (child_frame->m_page == page)
        {
            child = child_frame;
            break;
        }
        node = node->GetNext();
    }

    if (!child)
         return;

    wxActivateEvent event2( wxEVT_ACTIVATE, true, child->GetId() );
    event2.SetEventObject( child);
    child->GetEventHandler()->ProcessEvent( event2 );
}
Example #17
0
void wxSpinButton::MacHandleValueChanged( int inc )
{

    wxEventType scrollEvent = wxEVT_NULL;
    int oldValue = m_value ;

    m_value = oldValue + inc;

    if (m_value < m_min)
    {
        if ( m_windowStyle & wxSP_WRAP )
            m_value = m_max;
        else
            m_value = m_min;
    }

    if (m_value > m_max)
    {
        if ( m_windowStyle & wxSP_WRAP )
            m_value = m_min;
        else
            m_value = m_max;
    }

    if ( m_value - oldValue == -1 )
        scrollEvent = wxEVT_SCROLL_LINEDOWN ;
    else if ( m_value - oldValue == 1 )
        scrollEvent = wxEVT_SCROLL_LINEUP ;
    else
        scrollEvent = wxEVT_SCROLL_THUMBTRACK ;

    wxSpinEvent event(scrollEvent, m_windowId);

    event.SetPosition(m_value);
    event.SetEventObject( this );
    if ((GetEventHandler()->ProcessEvent( event )) &&
        !event.IsAllowed() )
    {
        m_value = oldValue ;
    }
    SetControl32BitValue( (ControlHandle) m_macControl , m_value ) ;

    /* always send a thumbtrack event */
    if (scrollEvent != wxEVT_SCROLL_THUMBTRACK)
    {
        scrollEvent = wxEVT_SCROLL_THUMBTRACK;
        wxSpinEvent event2( scrollEvent, GetId());
        event2.SetPosition( m_value );
        event2.SetEventObject( this );
        GetEventHandler()->ProcessEvent( event2 );
    }
}
Example #18
0
bool RegStore::Connector::set_aor_data(const std::string& aor_id,
                                       AoR* aor_data,
                                       int expiry,
                                       SAS::TrailId trail)
{
  std::string data = serialize_aor(aor_data);

  SAS::Event event(trail, SASEvent::REGSTORE_SET_START, 0);
  event.add_var_param(aor_id);
  SAS::report_event(event);

  Store::Status status = _data_store->set_data("reg",
                                               aor_id,
                                               data,
                                               aor_data->_cas,
                                               expiry,
                                               trail);

  LOG_DEBUG("Data store set_data returned %d", status);

  if (status == Store::Status::OK)
  {
    SAS::Event event2(trail, SASEvent::REGSTORE_SET_SUCCESS, 0);
    event2.add_var_param(aor_id);
    SAS::report_event(event2);
  }
  else
  {
    // LCOV_EXCL_START
    SAS::Event event2(trail, SASEvent::REGSTORE_SET_FAILURE, 0);
    event2.add_var_param(aor_id);
    SAS::report_event(event2);
    // LCOV_EXCL_STOP
  }


  return (status == Store::Status::OK);
}
void UT_CMceStateOffering::UT_CMceStateOffering_EntryL_WithUpdateL()
    {	
    MCE_RESET_STUBS();
    // EMceUpdate
    // update fails
    TMceStateTransitionEvent event1( *iSipSession, EMceUpdate);
    iStorage->iMediaManagerUpdateStatus = KErrGeneral;
    iState->EntryL(event1);
    MCE_ASSERT_STUBS(CMCETls::EUpdate /*mmaction*/,
            CMCETls::EDecode /*mmsdpaction*/,
            SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/);
    MCE_ASSERT_EVENT(event1 /*event*/, EMceUpdate /*code*/, KErrGeneral /*status*/);

    MCE_RESET_STUBS();
    
    // async
    TMceStateTransitionEvent event2( *iSipSession, EMceUpdate);
    iStorage->iMediaManagerUpdateStatus = KMceAsync;
    iState->EntryL(event2);
    MCE_ASSERT_STUBS(CMCETls::EUpdate /*mmaction*/,
            CMCETls::EDecode /*mmsdpaction*/,
            SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/);
    MCE_ASSERT_EVENT(event2 /*event*/, EMceUpdate /*code*/, KMceAsync /*status*/);

    MCE_RESET_STUBS();
	
    // ready, reserve async
	    
    TMceStateTransitionEvent event3( *iSipSession, EMceUpdate);
    iStorage->iMediaManagerUpdateStatus = KMceReady;
    iStorage->iMediaManagerReserveStatus = KMceAsync;
    iState->EntryL(event3);
    MCE_ASSERT_STUBS(CMCETls::EReserve /*mmaction*/,
            CMCETls::EDecode /*mmsdpaction*/,
            SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/);
    MCE_ASSERT_EVENT(event3 /*event*/, EMceMediaUpdated /*code*/, KMceAsync /*status*/);
	
    // ready, reserve ready
	    
    TMceStateTransitionEvent event4( *iSipSession, EMceUpdate);
    iStorage->iMediaManagerUpdateStatus = KMceReady;
    iStorage->iMediaManagerReserveStatus = KMceReady;
    iState->EntryL(event4);
    MCE_ASSERT_STUBS(CMCETls::EReserve /*mmaction*/,
            CMCETls::EEncode /*mmsdpaction*/,
            SipStrConsts::EEmpty /*sentMethod*/, KMceSipOK /*sentResponse*/);
    MCE_ASSERT_EVENT(event4 /*event*/, EMceMediaUpdated /*code*/, KMceReady /*status*/);

    MCE_RESET_STUBS();
    }
void UT_CMceStateIdle::UT_CMceStateIdle_ExitLL()
{
    TMceIds ids;
    CMceMsgBase* msg = NULL;

    iSipSession->iBody = CMceComSession::NewL( CMceComSession::EOutSession );

    TMceStateTransitionEvent event1( *iSipSession, EMceItcEstablishSession, ids, *msg );
    event1.ParamStatus() = KMceAsync;

    iState->ExitL( event1 );
    EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateClientEstablishing );
    EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EOffering );
    EUNIT_ASSERT ( ids.iState == CMceSession::EOffering );
    MCE_SET_STATES( iSipSession /*session*/,
                    CMceSession::EIdle /*clientState*/,
                    KMceStateIdle /*serverState*/ );


    TMceStateTransitionEvent event1_1( *iSipSession, EMceItcEstablishSession, ids, *msg );
    event1_1.ParamStatus() = KMceReady;

    iState->ExitL( event1_1 );
    EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering );
    EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EOffering );
    EUNIT_ASSERT ( ids.iState == CMceSession::EOffering );
    MCE_SET_STATES( iSipSession /*session*/,
                    CMceSession::EIdle /*clientState*/,
                    KMceStateIdle /*serverState*/ );

    EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateIdle );
    MCE_TH_SET( iSipSession->iBody, NULL );
    iSipSession->iBody = CMceComSession::NewL( CMceComSession::EInSession );

    TMceStateTransitionEvent event2( *iSipSession, EMceInvite );
    iState->ExitL( event2 );
    EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateServerEstablishing );
    EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EIncoming );

    MCE_SET_STATES( iSipSession /*session*/,
                    CMceSession::EIdle /*clientState*/,
                    KMceStateIdle /*serverState*/ );

    TMceStateTransitionEvent event3( *iSipSession, EMceCancel );
    iState->ExitL( event3 );

    MCE_SET_STATES( iSipSession /*session*/,
                    CMceSession::EIdle /*clientState*/,
                    KMceStateIdle /*serverState*/ );
}
Example #21
0
void DecorationTest::testSection()
{
    MockBridge bridge;
    auto decoSettings = QSharedPointer<KDecoration2::DecorationSettings>::create(&bridge);
    MockDecoration deco(&bridge);
    deco.setSettings(decoSettings);

    MockSettings *settings = bridge.lastCreatedSettings();
    settings->setLargeSpacing(0);

    MockClient *client = bridge.lastCreatedClient();
    client->setWidth(100);
    client->setHeight(100);
    QCOMPARE(deco.size(), QSize(100, 100));
    QCOMPARE(deco.borderLeft(), 0);
    QCOMPARE(deco.borderTop(), 0);
    QCOMPARE(deco.borderRight(), 0);
    QCOMPARE(deco.borderBottom(), 0);
    QCOMPARE(deco.titleBar(), QRect());
    QCOMPARE(deco.sectionUnderMouse(), Qt::NoSection);

    QFETCH(QRect, titleBar);
    QFETCH(QMargins, margins);
    deco.setBorders(margins);
    QCOMPARE(deco.borderLeft(), margins.left());
    QCOMPARE(deco.borderTop(), margins.top());
    QCOMPARE(deco.borderRight(), margins.right());
    QCOMPARE(deco.borderBottom(), margins.bottom());
    deco.setTitleBar(titleBar);
    QCOMPARE(deco.titleBar(), titleBar);
    QCOMPARE(deco.size(), QSize(100 + deco.borderLeft() + deco.borderRight(), 100 + deco.borderTop() + deco.borderBottom()));

    QSignalSpy spy(&deco, SIGNAL(sectionUnderMouseChanged(Qt::WindowFrameSection)));
    QVERIFY(spy.isValid());
    QFETCH(QPoint, pos);
    QHoverEvent event(QEvent::HoverMove, QPointF(pos), QPointF(pos));
    QCoreApplication::sendEvent(&deco, &event);
    QFETCH(Qt::WindowFrameSection, expected);
    QCOMPARE(deco.sectionUnderMouse(), expected);
    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.first().first().value<Qt::WindowFrameSection>(), expected);

    QHoverEvent event2(QEvent::HoverMove, QPointF(50, 50), QPointF(50, 50));
    QCoreApplication::sendEvent(&deco, &event2);
    QCOMPARE(deco.sectionUnderMouse(), Qt::NoSection);
    QCOMPARE(spy.count(), 2);
    QCOMPARE(spy.first().first().value<Qt::WindowFrameSection>(), expected);
    QCOMPARE(spy.last().first().value<Qt::WindowFrameSection>(), Qt::NoSection);
}
Example #22
0
static void
gtkcombo_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
    if (g_isIdle) wxapp_install_idle_handler();

    if (!combo->m_hasVMT) return;

    if (g_blockEventsOnDrag) return;

    int curSelection = combo->GetCurrentSelection();

    if (combo->m_prevSelection == curSelection) return;

    GtkWidget *list = GTK_COMBO(combo->m_widget)->list;
    gtk_list_unselect_item( GTK_LIST(list), combo->m_prevSelection );

    combo->m_prevSelection = curSelection;

    // Quickly set the value of the combo box
    // as GTK+ does that only AFTER the event
    // is sent.
    g_signal_handlers_disconnect_by_func (GTK_COMBO (combo->GetHandle())->entry,
                                          (gpointer) gtkcombo_text_changed_callback,
                                          combo);
    combo->SetValue( combo->GetStringSelection() );
    g_signal_connect_after (GTK_COMBO (combo->GetHandle())->entry, "changed",
                            G_CALLBACK (gtkcombo_text_changed_callback), combo);

    // throw a SELECTED event only if the combobox popup is hidden (wxID_NONE)
    // because when combobox popup is shown, gtkcombo_combo_select_child_callback is
    // called each times the mouse is over an item with a pressed button so a lot
    // of SELECTED event could be generated if the user keep the mouse button down
    // and select other items ...
    if (g_SelectionBeforePopup == wxID_NONE)
    {
        wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
        event.SetInt( curSelection );
        event.SetString( combo->GetStringSelection() );
        event.SetEventObject( combo );
        combo->GetEventHandler()->ProcessEvent( event );

        // for consistency with the other ports, don't generate text update
        // events while the user is browsing the combobox neither
        wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
        event2.SetString( combo->GetValue() );
        event2.SetEventObject( combo );
        combo->GetEventHandler()->ProcessEvent( event2 );
    }
}
Example #23
0
void ReopenEditor::OnViewList(wxCommandEvent& event)
{
    if(m_IsManaged)
    {
        if(event.IsChecked())
        {
                CodeBlocksLogEvent evtShow(cbEVT_SHOW_LOG_MANAGER);
                Manager::Get()->ProcessEvent(evtShow);
                CodeBlocksLogEvent event2(cbEVT_SWITCH_TO_LOG_WINDOW, m_pListLog);
                Manager::Get()->ProcessEvent(event2);
        }
        else
        {
            CodeBlocksLogEvent event2(cbEVT_HIDE_LOG_WINDOW, m_pListLog);
            Manager::Get()->ProcessEvent(event2);
        }
    }
    else
    {
        CodeBlocksDockEvent evt(event.IsChecked() ? cbEVT_SHOW_DOCK_WINDOW : cbEVT_HIDE_DOCK_WINDOW);
        evt.pWindow = m_pListLog;
        Manager::Get()->ProcessEvent(evt);
    }
}
Example #24
0
bool handleViKey(QKeyEvent *event, QObject *eventReceiver)
{
    int key = event->key();
    Qt::KeyboardModifiers mods = event->modifiers();

    switch ( key ) {
    case Qt::Key_G:
        key = mods & Qt::ShiftModifier ? Qt::Key_End : Qt::Key_Home;
        mods = mods & ~Qt::ShiftModifier;
        break;
    case Qt::Key_J:
        key = Qt::Key_Down;
        break;
    case Qt::Key_K:
        key = Qt::Key_Up;
        break;
    case Qt::Key_L:
        key = Qt::Key_Return;
        break;
    case Qt::Key_F:
    case Qt::Key_D:
    case Qt::Key_B:
    case Qt::Key_U:
        if (mods & Qt::ControlModifier) {
            key = (key == Qt::Key_F || key == Qt::Key_D) ? Qt::Key_PageDown : Qt::Key_PageUp;
            mods = mods & ~Qt::ControlModifier;
        } else {
            return false;
        }
        break;
    case Qt::Key_BracketLeft:
        if (mods & Qt::ControlModifier) {
            key = Qt::Key_Escape;
            mods = mods & ~Qt::ControlModifier;
        } else {
            return false;
        }
        break;
    default:
        return false;
    }

    QKeyEvent event2(QEvent::KeyPress, key, mods, event->text());
    QCoreApplication::sendEvent(eventReceiver, &event2);
    event->accept();

    return true;
}
Example #25
0
int ToolsManager::Configure()
{
    CodeBlocksEvent event(cbEVT_MENUBAR_CREATE_BEGIN);
    Manager::Get()->ProcessEvent(event);

    ConfigureToolsDlg dlg(Manager::Get()->GetAppWindow());
    PlaceWindow(&dlg);
    dlg.ShowModal();
    SaveTools();
    BuildToolsMenu(m_Menu);

    CodeBlocksEvent event2(cbEVT_MENUBAR_CREATE_END);
    Manager::Get()->ProcessEvent(event2);

    return 0;
} // end of Configure
Example #26
0
static void
gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
                              GtkNotebookPage *page,
                              gint WXUNUSED(page_num),
                              wxMDIParentFrame *parent )
{
    // send deactivate event to old child

    wxMDIChildFrame *child = parent->GetActiveChild();
    if (child)
    {
        wxActivateEvent event1( wxEVT_ACTIVATE, false, child->GetId() );
        event1.SetEventObject( child);
        child->HandleWindowEvent( event1 );
    }

    // send activate event to new child

    wxMDIClientWindowBase *client_window = parent->GetClientWindow();
    if ( !client_window )
        return;

    child = NULL;

    wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
    while ( node )
    {
        wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );

        // child_frame can be NULL when this is called from dtor, probably
        // because g_signal_connect (m_widget, "switch_page", (see below)
        // isn't deleted early enough
        if ( child_frame && child_frame->m_page == page )
        {
            child = child_frame;
            break;
        }
        node = node->GetNext();
    }

    if (!child)
         return;

    wxActivateEvent event2( wxEVT_ACTIVATE, true, child->GetId() );
    event2.SetEventObject( child);
    child->HandleWindowEvent( event2 );
}
Example #27
0
void CMouseMoveMap::slotMoveWpt()
{
    if(selWpts.isEmpty()) return;
    canvas->setMouseMode(CCanvas::eMouseMoveWpt);

    CWpt * selWpt = selWpts.first().wpt;

    double u = selWpt->lon * DEG_TO_RAD;
    double v = selWpt->lat * DEG_TO_RAD;
    CMapDB::self().getMap().convertRad2Pt(u,v);

    QMouseEvent event1(QEvent::MouseMove, QPoint(u,v), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
    QCoreApplication::sendEvent(canvas,&event1);

    QMouseEvent event2(QEvent::MouseButtonPress, QPoint(u,v), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
    QCoreApplication::sendEvent(canvas,&event2);
}
static void *dchan(void *data)
{
	/* Joint D-channel */
	struct pri *pri = data;
	struct timeval *next, tv;
	pri_event *e;
	fd_set fds;
	int res;
	for(;;) {
		if ((next = pri_schedule_next(pri))) {
			gettimeofday(&tv, NULL);
			tv.tv_sec = next->tv_sec - tv.tv_sec;
			tv.tv_usec = next->tv_usec - tv.tv_usec;
			if (tv.tv_usec < 0) {
				tv.tv_usec += 1000000;
				tv.tv_sec -= 1;
			}
			if (tv.tv_sec < 0) {
				tv.tv_sec = 0;
				tv.tv_usec = 0;
			}
		}
		FD_ZERO(&fds);
		FD_SET(pri_fd(pri), &fds);
		res = select(pri_fd(pri) + 1, &fds, NULL, NULL, next ? &tv : NULL);
		pthread_mutex_lock(&lock);
		cur = pri;
		if (res < 0) {
			perror("select");
		} else if (!res) {
			e = pri_schedule_run(pri);
		} else {
			e = pri_check_event(pri);
		}
		if (e) {
			if (first == pri) {
				event1(pri, e);
			} else {
				event2(pri, e);
			}
		}
		pthread_mutex_unlock(&lock);
	}
	return NULL;
}
Example #29
0
void TestEITFixups::testUKFixups2()
{
    EITFixUp fixup;

    DBEventEIT event2(54275,
                      "Hoarders",
                      "Fascinating series chronicling the lives of serial hoarders. Often facing loss of their children, career, or divorce, can people with this disorder be helped? S3, Ep1",
                      QDateTime::fromString("2015-02-28T17:00:00Z", Qt::ISODate),
                      QDateTime::fromString("2015-02-28T18:00:00Z", Qt::ISODate),
                      EITFixUp::kFixGenericDVB | EITFixUp::kFixUK,
                      SUB_UNKNOWN,
                      AUD_STEREO,
                      VID_UNKNOWN);

    fixup.Fix(event2);
    PRINT_EVENT(event2);
    QCOMPARE(event2.season,  3u);
    QCOMPARE(event2.episode, 1u);
}
Example #30
0
static void
gtk_event_after(GtkRange* range, GdkEvent* event, wxScrollBar* win)
{
    if (event->type == GDK_BUTTON_RELEASE)
    {
        g_signal_handlers_block_by_func(range, (void*)gtk_event_after, win);

        const int value = win->GetThumbPosition();
        const int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;

        wxScrollEvent event(wxEVT_SCROLL_THUMBRELEASE, win->GetId(), value, orient);
        event.SetEventObject(win);
        win->GetEventHandler()->ProcessEvent(event);

        wxScrollEvent event2(wxEVT_SCROLL_CHANGED, win->GetId(), value, orient);
        event2.SetEventObject(win);
        win->GetEventHandler()->ProcessEvent(event2);
    }
}