Ejemplo n.º 1
0
extern "C" void popStackHandles(char* nextFrame) {
  DeltaProcess* active = DeltaProcess::active();
  if (active->thread_id() != os::current_thread_id()) {
    active = Processes::find_from_thread_id(os::current_thread_id());
  }
  BaseHandle* current = active->firstHandle();
  while (current && (char*) current < nextFrame) {
    current->pop();
    current = active->firstHandle();
  }
}
Ejemplo n.º 2
0
int UtcDaliBaseHandleGetBaseObject(void)
{
  TestApplication application;
  tet_infoline("Testing Dali::BaseHandle::GetBaseObject()");

  BaseHandle object = Actor::New();

  BaseObject& handle = object.GetBaseObject();

  DALI_TEST_EQUALS(1, handle.ReferenceCount(), TEST_LOCATION);
  END_TEST;
}
Ejemplo n.º 3
0
int UtcDaliBaseHandleReset(void)
{
  TestApplication application;
  tet_infoline("Testing Dali::BaseHandle::Reset()");

  // Initialize an object, ref count == 1
  BaseHandle object = Actor::New();

  DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);

  object.Reset();

  DALI_TEST_CHECK(!object);
  END_TEST;
}
Dali::PhysicalKeyboard PhysicalKeyboard::Get()
{
  Dali::PhysicalKeyboard keyboardHandle;

  // Ensure the adaptor has been created
  if ( Adaptor::IsAvailable() )
  {
    Dali::Adaptor& adaptor = Adaptor::Get();

    BaseHandle handle = adaptor.GetSingleton( typeid( Dali::PhysicalKeyboard ) );
    if( handle )
    {
      // If so, downcast the handle of singleton to focus manager
      keyboardHandle = Dali::PhysicalKeyboard( dynamic_cast< PhysicalKeyboard* >( handle.GetObjectPtr() ) );
    }
  }

  return keyboardHandle;
}
Ejemplo n.º 5
0
int UtcDaliBaseHandleAssignmentOperator(void)
{
  TestApplication application;
  tet_infoline("Testing Dali::BaseHandle::operator=");

  BaseHandle object = Actor::New();

  DALI_TEST_CHECK(object);
  if (object)
  {
    DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
  }

  BaseHandle copy = object;

  DALI_TEST_CHECK(copy);
  if (copy)
  {
    DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
  }
  END_TEST;
}
Ejemplo n.º 6
0
int UtcDaliBaseHandleCopyConstructor(void)
{
  TestApplication application;
  tet_infoline("Testing Dali::BaseHandle::BaseHandle(const BaseHandle&)");

  // Initialize an object, ref count == 1
  BaseHandle object = Actor::New();

  DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);

  // Copy the object, ref count == 2
  BaseHandle copy(object);
  DALI_TEST_CHECK(copy);
  if (copy)
  {
    DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
  }

  {
    // Pass by value, and return another copy, ref count == 3
    BaseHandle anotherCopy = ImplicitCopyConstructor(copy);

    DALI_TEST_CHECK(anotherCopy);
    if (anotherCopy)
    {
      DALI_TEST_EQUALS(3, anotherCopy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
    }
  }

  // anotherCopy out of scope, ref count == 2
  DALI_TEST_CHECK(copy);
  if (copy)
  {
    DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
  }
  END_TEST;
}
Ejemplo n.º 7
0
Handle Handle::DownCast( BaseHandle handle )
{
  return Handle( dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()) );
}
Ejemplo n.º 8
0
Animation Animation::DownCast( BaseHandle handle )
{
  return Animation( dynamic_cast<Dali::Internal::Animation*>(handle.GetObjectPtr()) );
}
Ejemplo n.º 9
0
Material Material::DownCast( BaseHandle handle )
{
  return Material( dynamic_cast<Dali::Internal::Material*>(handle.GetObjectPtr()));
}
Ejemplo n.º 10
0
Layer Layer::DownCast( BaseHandle handle )
{
  return Layer( dynamic_cast<Dali::Internal::Layer*>(handle.GetObjectPtr()) );
}
Ejemplo n.º 11
0
JsonParser DownCast( BaseHandle handle )
{
  return JsonParser( dynamic_cast<Internal::JsonParser*>(handle.GetObjectPtr()) );
}
Ejemplo n.º 12
0
GestureDetector GestureDetector::DownCast( BaseHandle handle )
{
  return GestureDetector( dynamic_cast<Dali::Internal::GestureDetector*>(handle.GetObjectPtr()) );
}
Ejemplo n.º 13
0
int UtcDaliBaseHandleDoAction(void)
{
  TestApplication application;
  tet_infoline("Positive Test Dali::BaseHandle::UtcDaliBaseHandleDoAction");

  Actor actor = Actor::New();
  BaseHandle actorObject = actor;

  DALI_TEST_CHECK(actorObject);

  // Check that an invalid command is not performed
  Property::Map attributes;
  DALI_TEST_CHECK(actorObject.DoAction("invalidCommand", attributes) == false);

  // Check that the actor is visible
  actor.SetVisible(true);
  DALI_TEST_CHECK(actor.IsVisible() == true);

  // Check the actor performed an action to hide itself
  DALI_TEST_CHECK(actorObject.DoAction("hide", attributes) == true);

  // flush the queue and render once
  application.SendNotification();
  application.Render();

  // Check that the actor is now invisible
  DALI_TEST_CHECK(actor.IsVisible() == false);

  // Check the actor performed an action to show itself
  DALI_TEST_CHECK(actorObject.DoAction("show", attributes) == true);

  // flush the queue and render once
  application.SendNotification();
  application.Render();

  // Check that the actor is now visible
  DALI_TEST_CHECK(actor.IsVisible() == true);

  Stage::GetCurrent().Add(actor);

  // Build an animation with initial duration of 1 second
  float durationSeconds(1.0f);
  Animation animation = Animation::New(durationSeconds);
  BaseHandle animationObject = animation;

  DALI_TEST_CHECK(animationObject);

  // Check the current animation duration is 1 second
  DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);

  Vector3 targetPosition(100.0f, 100.0f, 100.0f);
  animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);

  // Set the new duration to be 2 seconds
  float newDurationSeconds(2.0f);
  Property::Value newDurationSecondsValue = Property::Value( newDurationSeconds );
  attributes["duration"] = newDurationSecondsValue;

  // Check the animation performed an action to play itself with the specified duration of 2 seconds
  animationObject.DoAction("play", attributes);

  bool signalReceived(false);
  AnimationFinishCheck finishCheck(signalReceived);
  animation.FinishedSignal().Connect(&application, finishCheck);

  application.SendNotification();
  application.Render(static_cast<unsigned int>(newDurationSeconds * 1000.0f) + 1u/*just beyond the animation duration*/);

  // We expect the animation to finish
  application.SendNotification();
  finishCheck.CheckSignalReceived();
  DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );

  // Check the new animation duration is 2 seconds
  DALI_TEST_EQUALS(animation.GetDuration(), newDurationSeconds, TEST_LOCATION);
  END_TEST;
}
Ejemplo n.º 14
0
Geometry Geometry::DownCast( BaseHandle handle )
{
  return Geometry( dynamic_cast<Dali::Internal::Geometry*>(handle.GetObjectPtr()));
}
Ejemplo n.º 15
0
extern "C" volatile void* handleCallBack(int index, int params) {
    DeltaProcess* proc = NULL;

    if (Universe::callBack_receiver()->is_nil()) {
        warning("callBack receiver is not set");
    }

    int low  = get_unsigned_bitfield(params,  0, 16);
    int high = get_unsigned_bitfield(params, 16, 16);

    if (DeltaProcess::active()->thread_id() != os::current_thread_id()) {
        // We'are now back in a asynchronous DLL call so give up the control
        // Fix this:
        //   remove warning when it has been tested
        proc = Processes::find_from_thread_id(os::current_thread_id());
        assert(proc, "process must be present");
        DLLs::exit_async_call(&proc);
    }

    DeltaProcess::active()->setIsCallback(true);

    oop res = Delta::call(Universe::callBack_receiver(),
                          Universe::callBack_selector(),
                          as_smiOop(index),
                          as_smiOop(high),
                          as_smiOop(low));

    assert(DeltaProcess::active()->thread_id() == os::current_thread_id(), "check for process torch");

    void* result;

    // convert return result

    if (have_nlr_through_C) {
        // Continues the NLR after at the next Delta frame
        BaseHandle* handle = DeltaProcess::active()->firstHandle();
        if (handle && ((char*) handle < (char*)DeltaProcess::active()->last_Delta_fp()))
            handle->pop();

        ErrorHandler::continue_nlr_in_delta();
    }

    if (res->is_smi()) {
        result = (void*) smiOop(res)->value();
    } else if (res->is_proxy()) {
        result = (void*) proxyOop(res)->get_pointer();
    } else {
        warning("Wrong return type for call back, returning NULL");
        result = NULL;
    }

    // Return value has to be converted before we transfer control to another
    // thread.

    if (proc) {
        // We'are now back in a asynchronous DLL call so give up the control
        proc->resetStepping();
        proc->transfer_and_continue();
    }

    // Call Delta level error routine
    return result;
}
Ejemplo n.º 16
0
FrameBufferImage FrameBufferImage::DownCast( BaseHandle handle )
{
  return FrameBufferImage( dynamic_cast<Dali::Internal::FrameBufferImage*>(handle.GetObjectPtr()) );
}
Ejemplo n.º 17
0
RenderTaskList RenderTaskList::DownCast( BaseHandle handle )
{
  return RenderTaskList( dynamic_cast<Dali::Internal::RenderTaskList*>( handle.GetObjectPtr() ) );
}
Ejemplo n.º 18
0
CameraActor CameraActor::DownCast( BaseHandle handle )
{
    return CameraActor( dynamic_cast<Dali::Internal::CameraActor*>(handle.GetObjectPtr()) );
}
ScrollViewPageCubeEffect ScrollViewPageCubeEffect::DownCast( BaseHandle handle )
{
  return ScrollViewPageCubeEffect( dynamic_cast<Internal::ScrollViewPageCubeEffect*>(handle.GetObjectPtr()) );
}