Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4924527

java.awt.dnd.DragSourceDragEvent.getModifiers[Ex] and invalid modifiers

XMLWordPrintable

    • b32
    • sparc
    • solaris_2.6
    • Verified



      Name: sdR10048 Date: 09/18/2003


      Filed By : SPB JCK team (###@###.###)
      JDK : java full version "1.5.0-beta-b18"
      JCK : 1.5
      Platform[s] : Solaris
      switch/Mode :
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test [s] :
          api/java_awt/dnd/DragSourceDragEvent/index.html#Ctor[DragSourceDragEvent0005]
          api/java_awt/dnd/DragSourceDragEvent/index.html#Ctor2[DragSourceDragEvent0011]


      Specification excerpt:
      ======================
      --------- J2SE API spec v.1.5 ---------
      ...
      public DragSourceDragEvent(DragSourceContext?dsc,
                                 int?dropAction,
                                 int?action,
                                 int?modifiers)

      Constructs a DragSourceDragEvent. This class is typically instantiated by the DragSourceContextPeer rather than directly by client code. The coordinates for this DragSourceDragEvent are not specified, so getLocation will return null for this event.

      The arguments dropAction and action should be one of DnDConstants that represents a single action. The argument modifiers should be either a bitwise mask of old java.awt.event.InputEvent.*_MASK constants or a bitwise mask of extended java.awt.event.InputEvent.*_DOWN_MASK constants. This constructor does not throw any exception for invalid dropAction, action and modifiers.

      Parameters:
      dsc - the DragSourceContext that is to manage notifications for this event.
      dropAction - the user drop action.
      action - the target drop action.
      modifiers - the modifier keys down during event (shift, ctrl, alt, meta) Either extended _DOWN_MASK or old _MASK modifiers should be used, but both models should not be mixed in one event. Use of the extended modifiers is preferred.
      Throws:
      IllegalArgumentException - if dsc is null.

      ---

      public int getGestureModifiers()

      This method returns an int representing the current state of the input device modifiers associated with the user's gesture. Typically these would be mouse buttons or keyboard modifiers.

      Returns:
      the current state of the input device modifiers

      ---

      public int getGestureModifiersEx()

      This method returns an int representing the current state of the input device extended modifiers associated with the user's gesture. See InputEvent.getModifiersEx()

      Returns:
      the current state of the input device extended modifiers

      ...
      ---------- end-of-excerpt ---------------

      Problem description
      ===================
      The spec says that constructors accept (do not throw any exception) invalid modifiers. Modifiers can be: the "ordinary" and the extended ones.

      So some words about where (getModifiers or getModifiersEx) to get the
      passed in invalid modifiers should be said here.


      JCK test source location:
      ==========================
      /java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests

      Test output:
      =============
      BadModifier's found: 16384
      drag source context | was : java.awt.dnd.DragSourceContext@1df5a8f
                          | expected : java.awt.dnd.DragSourceContext@1df5a8f
      user action | was : 0
                          | expected : 0
      target actions | was : 0
                          | expected : 0
      gesture modifiers | was : 0
      gesture modifiersEx | was : 16384
      gesture modifiers | expected : 16384
      ----------log:(7/407)----------
      Warning: Cannot convert string "-monotype-arial-regular-r-normal--*-140-*-*-p-*-iso8859-1" to type FontStruct
      DragSourceDragEvent0001: Passed. OK
      DragSourceDragEvent0002: Passed. OK
      DragSourceDragEvent0003: Passed. OK
      DragSourceDragEvent0004: Passed. OK
      DragSourceDragEvent0005: Failed. Bad class instance.

      ======================================================================

      Name: sdR10048 Date: 09/22/2003

      The real failing tests are:
          api/java_awt/dnd/DragSourceDragEvent/index.html#Ctor[DragSourceDragEvent0005]
          api/java_awt/dnd/DragSourceDragEvent/index.html#Ctor2[DragSourceDragEvent0013]

      ======================================================================

            agerasimsunw Alexander Gerasimov (Inactive)
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: