/**
  @SYMTestCaseID UIF-TConeBackground-Test4L
 
  @SYMDEF PDEF112327
 
  @SYMTestCaseDesc Tests MCoeControlBackground, when a parent window owning control has one 
  child control not supporting background drawing and non window owning.\n
 
  @SYMTestPriority Critical
 
  @SYMTestStatus Implemented
  
  @SYMTestActions : Sets the background draw style.\n
  Instantiates a parent control (CConeBackgroundTestParent) which has capability of background drawing.\n
  After a new screen device has been instantiated,instantiates a second graphics context and assigns it to the child control.\n
  Thus a scenario of parent control and child control with different graphics context is created and tested.\n
  Activates the parent and child control\n
  Invokes the DrawNow function for the NonWindowOwningControl class which results in calling Draw() and DrawComponets() on the parent control itself.\n 
  
  @SYMTestType Manual
  @SYMTestExpectedResults : The background drawing should use the parent graphics context. \n
  All the test code does is to exercise the defect fix and thus the draw should complete without any error.\n
  */
void CConeBackgroundTestView::Test4L()
	{
	delete iControl;
	iControl = 0;
	
	iBgDrawer->SetBgStyle(1);
	iControl = CConeBackgroundTestParentWindowOwning::NewL(*this, Rect(),
				CConeBackgroundTestDrawer2::NewL());
	
	// create a new Gc
	CWsScreenDevice* screenDevice = new (ELeave) CWsScreenDevice((iControl->ControlEnv())->WsSession()); 
	CleanupStack::PushL(screenDevice);
	User::LeaveIfError(screenDevice->Construct());
	
	CWindowGc* gc=new(ELeave) CWindowGc(screenDevice);
	CleanupStack::PushL(gc);
	User::LeaveIfError(gc->Construct());
	
	gc->Activate(Window());
	(iControl->ComponentControl(0))->SetCustomGc(gc);
	gc->Deactivate();
	
	TSize rectSize(90,200);
	iControl->SetSize(rectSize);
	(iControl->ComponentControl(0))->SetSize(rectSize);
	
	iControl->ActivateL();
	(iControl->ComponentControl(0))->ActivateL();
	(iControl->ComponentControl(0))->DrawNow(); 
	
	CleanupStack::PopAndDestroy(gc);
	CleanupStack::PopAndDestroy(screenDevice);
	}
Beispiel #2
0
void ContactsReader::Read() {
    app_state_.Reset();
    app_helper_.ReadTitle(&control_tree_, &app_state_);
    // return;
    const TVwsViewId view_id = app_helper_.ReadView(&control_tree_, &app_state_);
    return;
    app_helper_.ReadCba(&control_tree_, &app_state_);
    CEikMenuBar* menu = control_tree_.MenuBar();
    if (menu && menu->IsFocused()) {
        CEikMenuPane* pane = menu->MenuPane();
        app_helper_.ReadMenu(pane, &app_state_);
        if (pane) {
            return;
        }
    }
    // TODO(mikie): move tab reading to AppHelper.
    CAknTabGroup* tabgroup = control_tree_.TabGroup();
    if (tabgroup) {
        app_state_.SetSelectedTabIndex(tabgroup->ActiveTabIndex());
        app_state_.SetTabCount(tabgroup->TabCount());
        const TInt id = tabgroup->ActiveTabId();
        CAknTabGroupAccess* access = (CAknTabGroupAccess*)tabgroup;
        CArrayPtr<CAknTabAccess>* tabs = access->iTabArray;
        for (int i = 0; i < tabs->Count(); ++i) {
            CAknTabAccess* tab = tabs->At(i);
            CCoeControl* tab_control = (CCoeControl*)tab;
            if (tab && tab->iId == id) {
                // Not all tabs have text.
                CEikLabel* label = tab->iLabel;
                if (label) {
                    app_state_.SetSelectedTabText(*label->Text());
                }
                break;
            }
        }
    }
    if (view_id.iAppUid != ForApplication()) {
        return;
    }
    const TUint view = view_id.iViewUid.iUid;
    if (view == 1) {
        // Main contacts view
        CCoeControl* top = control_tree_.TopFocusedControl();
        if (top->CountComponentControls() == 0) return;
        CCoeControl* container = top->ComponentControl(0);
        if (container->CountComponentControls() < 2) return;
        CEikListBox* listbox = (CEikListBox*)container->ComponentControl(0);
        CAknSearchField* field = (CAknSearchField*)container->ComponentControl(1);

        ReadList(listbox, &app_state_);

        HBufC* text = HBufC::NewLC(field->TextLength());
        TPtr16 textp = text->Des();
        field->GetSearchText(textp);
        app_state_.SetSearchFieldText(*text);
        CleanupStack::PopAndDestroy(text);
    } else if (view == 4) {
        // Details (read-only) view
        CCoeControl* top = control_tree_.TopFocusedControl();
        if (top->CountComponentControls() == 0) return;
        CCoeControl* container = top->ComponentControl(0);
        if (container->CountComponentControls() < 1) return;
        CEikListBox* listbox = (CEikListBox*)container->ComponentControl(0);

        ReadList(listbox, &app_state_);
    }
}