Compare commits

..

3 Commits

Author SHA1 Message Date
Vitaly Provodin
50fbed1202 JBR-4099 add env.JBSDK_VERSION into test binaries 2022-02-01 16:34:15 +07:00
Vitaly Provodin
8386fdac72 JBR-4099 make test-image on jbrsdk_jcef step followup 2022-01-31 16:41:00 +07:00
Vitaly Provodin
86079256d3 JBR-4099 make test-image on jbrsdk_jcef step 2022-01-31 14:21:09 +07:00
58 changed files with 755 additions and 1735 deletions

View File

@@ -11,7 +11,6 @@ can be found on the [releases page](https://github.com/JetBrains/JetBrainsRuntim
| IDE Version | Latest JBR | Date Released |
| --- | --- | --- |
| 2022.1 | [17_0_2-b315.1](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr17_0_2b315.1) | 09-Feb-2022 |
| 2021.3 | [17_0_1-b164.8](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr17_0_1b164.8) | 15-Nov-2021 |
## Contents

View File

@@ -1,18 +1,6 @@
#!/bin/bash -x
function do_maketest() {
if [ "${bundle_type: -1}" == "t" ]; then
echo ${bundle_type%?}
return 1
else
echo ${bundle_type}
return 0
fi
}
function getVersionProp() {
grep "^${1}" make/conf/version-numbers.conf | cut -d'=' -f2
}
tag_prefix="jbr-"
while getopts ":i?" o; do
case "${o}" in
@@ -24,25 +12,27 @@ while getopts ":i?" o; do
done
shift $((OPTIND-1))
build_number=$1
bundle_type=$2
architecture=$3 # aarch64 or x64
if [ $# -le $min_parameters_count ]; then
build_number=$1
bundle_type=$2
architecture=$3 # aarch64 or x64
else
JBSDK_VERSION=$1
JDK_BUILD_NUMBER=$2
build_number=$3
bundle_type=$4
architecture=$5 # aarch64 or x64
fi
bundle_type=$(do_maketest)
do_maketest=$?
tag_prefix="jbr-"
OPENJDK_TAG=$(git log --simplify-by-decoration --decorate=short --pretty=short | grep "$tag_prefix" | cut -d "(" -f2 | cut -d ")" -f1 | awk '{print $2}' | sort -t "-" -k 2 -g | tail -n 1)
VERSION_FEATURE=$(getVersionProp "DEFAULT_VERSION_FEATURE")
VERSION_INTERIM=$(getVersionProp "DEFAULT_VERSION_INTERIM")
VERSION_UPDATE=$(getVersionProp "DEFAULT_VERSION_UPDATE")
[[ $VERSION_UPDATE = 0 ]] && JBSDK_VERSION="$VERSION_FEATURE" || JBSDK_VERSION="${VERSION_FEATURE}.${VERSION_INTERIM}.${VERSION_UPDATE}"
JBSDK_VERSION=${JBSDK_VERSION:=$(echo $OPENJDK_TAG | awk -F "-|[+]" '{print $2}')}
echo "##teamcity[setParameter name='env.JBSDK_VERSION' value='${JBSDK_VERSION}']"
JDK_BUILD_NUMBER=${JDK_BUILD_NUMBER:=$(echo $OPENJDK_TAG | awk -F "-|[+]" '{print $3}')}
[ -z $JDK_BUILD_NUMBER ] && JDK_BUILD_NUMBER=1
echo "##teamcity[setParameter name='env.JDK_UPDATE_NUMBER' value='${JDK_BUILD_NUMBER}']"
JBSDK_VERSION_WITH_DOTS=$(echo $JBSDK_VERSION | sed 's/_/\./g')
VENDOR_NAME="JetBrains s.r.o."
VENDOR_VERSION_STRING="JBR-${JBSDK_VERSION}+${JDK_BUILD_NUMBER}-${build_number}"
VENDOR_VERSION_STRING="JBR-${JBSDK_VERSION_WITH_DOTS}+${JDK_BUILD_NUMBER}-${build_number}"
[ -z "$bundle_type" ] || VENDOR_VERSION_STRING="${VENDOR_VERSION_STRING}-${bundle_type}"
do_reset_changes=0
@@ -64,17 +54,15 @@ case "$OS_NAME" in
BUILD_TIME="$(date --utc --date=@$SOURCE_DATE_EPOCH +%F)"
REPRODUCIBLE_TAR_OPTS="--mtime=@$SOURCE_DATE_EPOCH --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime"
;;
CYGWIN*)
COPYRIGHT_YEAR="$(date --utc --date=@$SOURCE_DATE_EPOCH +%Y)"
BUILD_TIME="$(date --utc --date=@$SOURCE_DATE_EPOCH +%F)"
REPRODUCIBLE_TAR_OPTS="--mtime=@$SOURCE_DATE_EPOCH --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime"
;;
Darwin)
COPYRIGHT_YEAR="$(date -u -r $SOURCE_DATE_EPOCH +%Y)"
BUILD_TIME="$(date -u -r $SOURCE_DATE_EPOCH +%F)"
TOUCH_TIME="$(date -u -r $SOURCE_DATE_EPOCH +%Y%m%d%H%M.%S)"
REPRODUCIBLE_TAR_OPTS="--uid 0 --gid 0 --numeric-owner"
;;
*)
# TODO: Windows
;;
esac
REPRODUCIBLE_BUILD_OPTS="--enable-reproducible-build

View File

@@ -1,9 +1,20 @@
#!/bin/bash -x
# The following parameter must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# The following parameters must be specified:
# JBSDK_VERSION - specifies the current version of OpenJDK e.g. 11_0_6
# JDK_BUILD_NUMBER - specifies the number of OpenJDK build or the value of --with-version-build argument to configure
# build_number - specifies the number of JetBrainsRuntime build
#
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
#
# $ ./java --version
# openjdk 11.0.6 2020-01-14
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
#
min_parameters_count=1
source jb/project/tools/common/scripts/common.sh
JBRSDK_BASE_NAME=jbrsdk-${JBSDK_VERSION}

View File

@@ -1,22 +1,27 @@
#!/bin/bash -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
# JBSDK_VERSION - specifies major version of OpenJDK e.g. 11_0_6 (instead of dots '.' underbars "_" are used)
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument to configure
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built; possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# This script makes test-image along with JDK images when bundle_type is set to "jcef".
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
#
# $ ./java --version
# openjdk 11.0.6 2020-01-14
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
#
# Environment variables:
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument
# to configure
# By default JDK_BUILD_NUMBER is set zero
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
# By default JCEF binaries should be located in ./jcef_linux_x64
min_parameters_count=2
source jb/project/tools/common/scripts/common.sh
JCEF_PATH=${JCEF_PATH:=./jcef_linux_x64}
@@ -80,7 +85,6 @@ RELEASE_NAME=linux-x86_64-server-release
case "$bundle_type" in
"jcef")
do_reset_changes=1
do_maketest=1
;;
"nomod" | "")
bundle_type=""
@@ -125,7 +129,7 @@ if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type
fi
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" $JBRSDK_BUNDLE $JSDK_MODS_DIR "$modules" || do_exit $?
if [ $do_maketest -eq 1 ]; then
if [ "$bundle_type" == "jcef" ]; then
JBRSDK_TEST=${JBRSDK_BUNDLE}-${JBSDK_VERSION}-linux-test-x64-b${build_number}
echo Creating "$JBRSDK_TEST" ...
[ $do_reset_changes -eq 1 ] && git checkout HEAD modules.list src/java.desktop/share/classes/module-info.java

View File

@@ -1,24 +1,29 @@
#!/bin/bash -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
# JBSDK_VERSION - specifies major version of OpenJDK e.g. 11_0_6 (instead of dots '.' underbars "_" are used)
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument to configure
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built; possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# This script makes test-image along with JDK images when bundle_type is set to "jcef".
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
#
# $ ./java --version
# openjdk 11.0.6 2020-01-14
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
#
# Environment variables:
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument
# to configure
# By default JDK_BUILD_NUMBER is set zero
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
# By default JCEF binaries should be located in ./jcef_mac
# MACOSX_VERSION_MAX - specifies value for the --with-macosx-version-max parameter. By default it is 10.12.00 for x64
# and 11.00.00 for aarch64
min_parameters_count=3
source jb/project/tools/common/scripts/common.sh
JCEF_PATH=${JCEF_PATH:=./jcef_mac}
@@ -119,7 +124,6 @@ RELEASE_NAME=macosx-${CONF_ARCHITECTURE}-server-release
case "$bundle_type" in
"jcef")
do_reset_changes=1
do_maketest=1
;;
"nomod" | "")
bundle_type=""
@@ -140,7 +144,10 @@ make images CONF=$RELEASE_NAME || do_exit $?
IMAGES_DIR=build/$RELEASE_NAME/images
JSDK=$IMAGES_DIR/jdk-bundle/jdk-$JBSDK_VERSION.jdk/Contents/Home
major_version=$(echo "$JBSDK_VERSION_WITH_DOTS" | awk -F "." '{print $1}')
minor_version=$(echo "$JBSDK_VERSION_WITH_DOTS" | awk -F "." '{print $3}')
[ -z "$minor_version" -o "$minor_version" = "0" ] && version_dir=$major_version || version_dir=$JBSDK_VERSION_WITH_DOTS
JSDK=$IMAGES_DIR/jdk-bundle/jdk-$version_dir.jdk/Contents/Home
JSDK_MODS_DIR=$IMAGES_DIR/jmods
JBRSDK_BUNDLE=jbrsdk
@@ -163,7 +170,7 @@ if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type
fi
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" "$JBRSDK_BUNDLE" "$JSDK_MODS_DIR" "$modules" || do_exit $?
if [ $do_maketest -eq 1 ]; then
if [ "$bundle_type" == "jcef" ]; then
JBRSDK_TEST=${JBRSDK_BUNDLE}-${JBSDK_VERSION}-osx-test-${architecture}-b${build_number}
echo Creating "$JBRSDK_TEST" ...
[ $do_reset_changes -eq 1 ] && git checkout HEAD modules.list src/java.desktop/share/classes/module-info.java

View File

@@ -1,22 +1,27 @@
#!/bin/bash -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
# JBSDK_VERSION - specifies major version of OpenJDK e.g. 11_0_6 (instead of dots '.' underbars "_" are used)
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument to configure
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built; possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# This script makes test-image along with JDK images when bundle_type is set to "jcef".
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
#
# $ ./java --version
# openjdk 11.0.6 2020-01-14
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
#
# Environment variables:
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument
# to configure
# By default JDK_BUILD_NUMBER is set zero
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
# By default JCEF binaries should be located in ./jcef_win_x64
min_parameters_count=2
source jb/project/tools/common/scripts/common.sh
WORK_DIR=$(pwd)
@@ -34,9 +39,7 @@ function do_configure {
--with-toolchain-version=$TOOLCHAIN_VERSION \
--with-boot-jdk=$BOOT_JDK \
--disable-ccache \
--enable-cds=yes \
$REPRODUCIBLE_BUILD_OPTS \
|| do_exit $?
--enable-cds=yes || do_exit $?
}
function create_image_bundle {
@@ -66,7 +69,6 @@ RELEASE_NAME=windows-x86_64-server-release
case "$bundle_type" in
"jcef")
do_reset_changes=0
do_maketest=1
;;
"nomod" | "")
bundle_type=""
@@ -80,13 +82,13 @@ esac
if [ -z "$INC_BUILD" ]; then
do_configure || do_exit $?
if [ $do_maketest -eq 1 ]; then
if [ "$bundle_type" == "jcef" ]; then
make LOG=info CONF=$RELEASE_NAME clean images test-image || do_exit $?
else
make LOG=info CONF=$RELEASE_NAME clean images || do_exit $?
fi
else
if [ $do_maketest -eq 1 ]; then
if [ "$bundle_type" == "jcef" ]; then
make LOG=info CONF=$RELEASE_NAME images test-image || do_exit $?
else
make LOG=info CONF=$RELEASE_NAME images || do_exit $?
@@ -106,7 +108,7 @@ if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
jbr_name_postfix="_${bundle_type}"
fi
# create runtime image bundlef
# create runtime image bundle
modules=$(xargs < modules.list | sed s/" "//g) || do_exit $?
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
@@ -117,4 +119,4 @@ if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type
fi
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" "$JBRSDK_BUNDLE" "$JSDK_MODS_DIR" "$modules" || do_exit $?
do_exit 0
do_exit 0

View File

@@ -1,19 +1,29 @@
#!/bin/bash -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
# JBSDK_VERSION - specifies major version of OpenJDK e.g. 11_0_6 (instead of dots '.' underbars "_" are used)
# JDK_BUILD_NUMBER - specifies udate release of OpenJDK build or the value of --with-version-build argument to configure
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built; possible values:
# <empty> or nomod - the bundles without any additional modules (jcef)
# jcef - the bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# This script packs test-image along with JDK images when bundle_type is set to "jcef".
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
#
# $ ./java --version
# openjdk 11.0.6 2020-01-14
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
#
source jb/project/tools/common/scripts/common.sh
[ "$bundle_type" == "jcef" ] && do_maketest=1
JBSDK_VERSION=$1
JDK_BUILD_NUMBER=$2
build_number=$3
bundle_type=$4
function pack_jbr {
__bundle_name=$1
@@ -41,7 +51,7 @@ fi
pack_jbr jbr${jbr_name_postfix} jbr
pack_jbr jbrsdk${jbr_name_postfix} jbrsdk
if [ $do_maketest -eq 1 ]; then
if [ "$bundle_type" == "jcef" ]; then
JBRSDK_TEST=$JBRSDK_BUNDLE-$JBSDK_VERSION-windows-test-x64-b$build_number
echo Creating $JBRSDK_TEST.tar.gz ...
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?

View File

@@ -784,8 +784,10 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
test "x$ENABLE_REPRODUCIBLE_BUILD" = xtrue; then
# There is a known issue with the pathmap if the mapping is made to the
# empty string. Add a minimal string "s" as prefix to work around this.
workspace_root_win=`$FIXPATH_BASE print "${WORKSPACE_ROOT%/}"`
# PATHMAP_FLAGS is also added to LDFLAGS in flags-ldflags.m4.
PATHMAP_FLAGS="-pathmap:${WORKSPACE_ROOT}=s"
PATHMAP_FLAGS="-pathmap:${workspace_root_win//\//\\\\}=s \
-pathmap:${workspace_root_win}=s"
FILE_MACRO_CFLAGS="$PATHMAP_FLAGS"
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${FILE_MACRO_CFLAGS}],
PREFIX: $3,

View File

@@ -341,9 +341,9 @@ void PhaseIdealLoop::clone_skeleton_predicates_to_unswitched_loop(IdealLoopTree*
assert(predicate->is_Proj() && predicate->as_Proj()->is_IfProj(), "predicate must be a projection of an if node");
IfProjNode* predicate_proj = predicate->as_IfProj();
ProjNode* fast_proj = clone_skeleton_predicate_for_unswitched_loops(iff, predicate_proj, reason, iffast_pred);
ProjNode* fast_proj = clone_skeleton_predicate_for_unswitched_loops(iff, predicate_proj, uncommon_proj, reason, iffast_pred, loop);
assert(skeleton_predicate_has_opaque(fast_proj->in(0)->as_If()), "must find skeleton predicate for fast loop");
ProjNode* slow_proj = clone_skeleton_predicate_for_unswitched_loops(iff, predicate_proj, reason, ifslow_pred);
ProjNode* slow_proj = clone_skeleton_predicate_for_unswitched_loops(iff, predicate_proj, uncommon_proj, reason, ifslow_pred, loop);
assert(skeleton_predicate_has_opaque(slow_proj->in(0)->as_If()), "must find skeleton predicate for slow loop");
// Update control dependent data nodes.
@@ -397,10 +397,10 @@ void PhaseIdealLoop::get_skeleton_predicates(Node* predicate, Unique_Node_List&
// Clone a skeleton predicate for an unswitched loop. OpaqueLoopInit and OpaqueLoopStride nodes are cloned and uncommon
// traps are kept for the predicate (a Halt node is used later when creating pre/main/post loops and copying this cloned
// predicate again).
ProjNode* PhaseIdealLoop::clone_skeleton_predicate_for_unswitched_loops(Node* iff, ProjNode* predicate,
Deoptimization::DeoptReason reason,
ProjNode* output_proj) {
Node* bol = clone_skeleton_predicate_bool(iff, NULL, NULL, output_proj);
ProjNode* PhaseIdealLoop::clone_skeleton_predicate_for_unswitched_loops(Node* iff, ProjNode* predicate, Node* uncommon_proj,
Deoptimization::DeoptReason reason, ProjNode* output_proj,
IdealLoopTree* loop) {
Node* bol = clone_skeleton_predicate_bool(iff, NULL, NULL, predicate, uncommon_proj, output_proj, loop);
ProjNode* proj = create_new_if_for_predicate(output_proj, NULL, reason, iff->Opcode(), predicate->is_IfTrue());
_igvn.replace_input_of(proj->in(0), 1, bol);
_igvn.replace_input_of(output_proj->in(0), 0, proj);

View File

@@ -1264,12 +1264,10 @@ void PhaseIdealLoop::copy_skeleton_predicates_to_main_loop_helper(Node* predicat
// Clone the skeleton predicate twice and initialize one with the initial
// value of the loop induction variable. Leave the other predicate
// to be initialized when increasing the stride during loop unrolling.
prev_proj = clone_skeleton_predicate_for_main_or_post_loop(iff, opaque_init, NULL, predicate, uncommon_proj,
current_proj, outer_loop, prev_proj);
prev_proj = clone_skeleton_predicate_for_main_loop(iff, opaque_init, NULL, predicate, uncommon_proj, current_proj, outer_loop, prev_proj);
assert(skeleton_predicate_has_opaque(prev_proj->in(0)->as_If()), "");
prev_proj = clone_skeleton_predicate_for_main_or_post_loop(iff, init, stride, predicate, uncommon_proj,
current_proj, outer_loop, prev_proj);
prev_proj = clone_skeleton_predicate_for_main_loop(iff, init, stride, predicate, uncommon_proj, current_proj, outer_loop, prev_proj);
assert(!skeleton_predicate_has_opaque(prev_proj->in(0)->as_If()), "");
// Rewire any control inputs from the cloned skeleton predicates down to the main and post loop for data nodes that are part of the
@@ -1346,7 +1344,8 @@ bool PhaseIdealLoop::skeleton_predicate_has_opaque(IfNode* iff) {
// Clone the skeleton predicate bool for a main or unswitched loop:
// Main loop: Set new_init and new_stride nodes as new inputs.
// Unswitched loop: new_init and new_stride are both NULL. Clone OpaqueLoopInit and OpaqueLoopStride instead.
Node* PhaseIdealLoop::clone_skeleton_predicate_bool(Node* iff, Node* new_init, Node* new_stride, Node* control) {
Node* PhaseIdealLoop::clone_skeleton_predicate_bool(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj,
Node* control, IdealLoopTree* outer_loop) {
Node_Stack to_clone(2);
to_clone.push(iff->in(1), 1);
uint current = C->unique();
@@ -1422,9 +1421,9 @@ Node* PhaseIdealLoop::clone_skeleton_predicate_bool(Node* iff, Node* new_init, N
// Clone a skeleton predicate for the main loop. new_init and new_stride are set as new inputs. Since the predicates cannot fail at runtime,
// Halt nodes are inserted instead of uncommon traps.
Node* PhaseIdealLoop::clone_skeleton_predicate_for_main_or_post_loop(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj,
Node* control, IdealLoopTree* outer_loop, Node* input_proj) {
Node* result = clone_skeleton_predicate_bool(iff, new_init, new_stride, control);
Node* PhaseIdealLoop::clone_skeleton_predicate_for_main_loop(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj,
Node* control, IdealLoopTree* outer_loop, Node* input_proj) {
Node* result = clone_skeleton_predicate_bool(iff, new_init, new_stride, predicate, uncommon_proj, control, outer_loop);
Node* proj = predicate->clone();
Node* other_proj = uncommon_proj->clone();
Node* new_iff = iff->clone();
@@ -1438,8 +1437,8 @@ Node* PhaseIdealLoop::clone_skeleton_predicate_for_main_or_post_loop(Node* iff,
C->root()->add_req(halt);
new_iff->set_req(0, input_proj);
register_control(new_iff, outer_loop == _ltree_root ? _ltree_root : outer_loop->_parent, input_proj);
register_control(proj, outer_loop == _ltree_root ? _ltree_root : outer_loop->_parent, new_iff);
register_control(new_iff, outer_loop->_parent, input_proj);
register_control(proj, outer_loop->_parent, new_iff);
register_control(other_proj, _ltree_root, new_iff);
register_control(halt, _ltree_root, other_proj);
return proj;
@@ -1522,8 +1521,7 @@ void PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree *loop, Node_List &old_n
// Add the post loop
const uint idx_before_pre_post = Compile::current()->unique();
CountedLoopNode *post_head = NULL;
Node* post_incr = incr;
Node* main_exit = insert_post_loop(loop, old_new, main_head, main_end, post_incr, limit, post_head);
Node *main_exit = insert_post_loop(loop, old_new, main_head, main_end, incr, limit, post_head);
const uint idx_after_post_before_pre = Compile::current()->unique();
//------------------------------
@@ -1622,7 +1620,6 @@ void PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree *loop, Node_List &old_n
assert(post_head->in(1)->is_IfProj(), "must be zero-trip guard If node projection of the post loop");
copy_skeleton_predicates_to_main_loop(pre_head, castii, stride, outer_loop, outer_main_head, dd_main_head,
idx_before_pre_post, idx_after_post_before_pre, min_taken, post_head->in(1), old_new);
copy_skeleton_predicates_to_post_loop(outer_main_head, post_head, post_incr, stride);
// Step B4: Shorten the pre-loop to run only 1 iteration (for now).
// RCE and alignment may change this later.
@@ -1745,7 +1742,6 @@ void PhaseIdealLoop::insert_vector_post_loop(IdealLoopTree *loop, Node_List &old
// In this case we throw away the result as we are not using it to connect anything else.
CountedLoopNode *post_head = NULL;
insert_post_loop(loop, old_new, main_head, main_end, incr, limit, post_head);
copy_skeleton_predicates_to_post_loop(main_head->skip_strip_mined(), post_head, incr, main_head->stride());
// It's difficult to be precise about the trip-counts
// for post loops. They are usually very short,
@@ -1792,7 +1788,6 @@ void PhaseIdealLoop::insert_scalar_rced_post_loop(IdealLoopTree *loop, Node_List
// In this case we throw away the result as we are not using it to connect anything else.
CountedLoopNode *post_head = NULL;
insert_post_loop(loop, old_new, main_head, main_end, incr, limit, post_head);
copy_skeleton_predicates_to_post_loop(main_head->skip_strip_mined(), post_head, incr, main_head->stride());
// It's difficult to be precise about the trip-counts
// for post loops. They are usually very short,
@@ -1809,9 +1804,9 @@ void PhaseIdealLoop::insert_scalar_rced_post_loop(IdealLoopTree *loop, Node_List
//------------------------------insert_post_loop-------------------------------
// Insert post loops. Add a post loop to the given loop passed.
Node *PhaseIdealLoop::insert_post_loop(IdealLoopTree* loop, Node_List& old_new,
CountedLoopNode* main_head, CountedLoopEndNode* main_end,
Node*& incr, Node* limit, CountedLoopNode*& post_head) {
Node *PhaseIdealLoop::insert_post_loop(IdealLoopTree *loop, Node_List &old_new,
CountedLoopNode *main_head, CountedLoopEndNode *main_end,
Node *incr, Node *limit, CountedLoopNode *&post_head) {
IfNode* outer_main_end = main_end;
IdealLoopTree* outer_loop = loop;
if (main_head->is_strip_mined()) {
@@ -1895,8 +1890,8 @@ Node *PhaseIdealLoop::insert_post_loop(IdealLoopTree* loop, Node_List& old_new,
}
// CastII for the new post loop:
incr = cast_incr_before_loop(zer_opaq->in(1), zer_taken, post_head);
assert(incr != NULL, "no castII inserted");
Node* castii = cast_incr_before_loop(zer_opaq->in(1), zer_taken, post_head);
assert(castii != NULL, "no castII inserted");
return new_main_exit;
}
@@ -1938,8 +1933,7 @@ void PhaseIdealLoop::update_main_loop_skeleton_predicates(Node* ctrl, CountedLoo
_igvn.replace_input_of(iff, 1, iff->in(1)->in(2));
} else {
// Add back predicates updated for the new stride.
prev_proj = clone_skeleton_predicate_for_main_or_post_loop(iff, init, max_value, entry, proj, ctrl, outer_loop,
prev_proj);
prev_proj = clone_skeleton_predicate_for_main_loop(iff, init, max_value, entry, proj, ctrl, outer_loop, prev_proj);
assert(!skeleton_predicate_has_opaque(prev_proj->in(0)->as_If()), "unexpected");
}
}
@@ -1951,34 +1945,6 @@ void PhaseIdealLoop::update_main_loop_skeleton_predicates(Node* ctrl, CountedLoo
}
}
void PhaseIdealLoop::copy_skeleton_predicates_to_post_loop(LoopNode* main_loop_head, CountedLoopNode* post_loop_head, Node* init, Node* stride) {
// Go over the skeleton predicates of the main loop and make a copy for the post loop with its initial iv value and
// stride as inputs.
Node* post_loop_entry = post_loop_head->in(LoopNode::EntryControl);
Node* main_loop_entry = main_loop_head->in(LoopNode::EntryControl);
IdealLoopTree* post_loop = get_loop(post_loop_head);
Node* ctrl = main_loop_entry;
Node* prev_proj = post_loop_entry;
while (ctrl != NULL && ctrl->is_Proj() && ctrl->in(0)->is_If()) {
IfNode* iff = ctrl->in(0)->as_If();
ProjNode* proj = iff->proj_out(1 - ctrl->as_Proj()->_con);
if (proj->unique_ctrl_out()->Opcode() != Op_Halt) {
break;
}
if (iff->in(1)->Opcode() == Op_Opaque4 && skeleton_predicate_has_opaque(iff)) {
prev_proj = clone_skeleton_predicate_for_main_or_post_loop(iff, init, stride, ctrl, proj, post_loop_entry,
post_loop, prev_proj);
assert(!skeleton_predicate_has_opaque(prev_proj->in(0)->as_If()), "unexpected");
}
ctrl = ctrl->in(0)->in(0);
}
if (prev_proj != post_loop_entry) {
_igvn.replace_input_of(post_loop_head, LoopNode::EntryControl, prev_proj);
set_idom(post_loop_head, prev_proj, dom_depth(post_loop_head));
}
}
//------------------------------do_unroll--------------------------------------
// Unroll the loop body one step - make each trip do 2 iterations.
void PhaseIdealLoop::do_unroll(IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip) {

View File

@@ -2150,14 +2150,12 @@ Node* CountedLoopNode::skip_predicates_from_entry(Node* ctrl) {
}
Node* CountedLoopNode::skip_predicates() {
Node* ctrl = in(LoopNode::EntryControl);
if (is_main_loop()) {
ctrl = skip_strip_mined()->in(LoopNode::EntryControl);
}
if (is_main_loop() || is_post_loop()) {
Node* ctrl = skip_strip_mined()->in(LoopNode::EntryControl);
return skip_predicates_from_entry(ctrl);
}
return ctrl;
return in(LoopNode::EntryControl);
}
@@ -5353,45 +5351,38 @@ void PhaseIdealLoop::build_loop_late_post_work(Node *n, bool pinned) {
}
assert(early == legal || legal != C->root(), "bad dominance of inputs");
if (least != early) {
// Move the node above predicates as far up as possible so a
// following pass of loop predication doesn't hoist a predicate
// that depends on it above that node.
Node* new_ctrl = least;
for (;;) {
if (!new_ctrl->is_Proj()) {
break;
}
CallStaticJavaNode* call = new_ctrl->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
if (call == NULL) {
break;
}
int req = call->uncommon_trap_request();
Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
if (trap_reason != Deoptimization::Reason_loop_limit_check &&
trap_reason != Deoptimization::Reason_predicate &&
trap_reason != Deoptimization::Reason_profile_predicate) {
break;
}
Node* c = new_ctrl->in(0)->in(0);
if (is_dominator(c, early) && c != early) {
break;
}
new_ctrl = c;
}
least = new_ctrl;
}
// Try not to place code on a loop entry projection
// which can inhibit range check elimination.
if (least != early) {
Node* ctrl_out = least->unique_ctrl_out();
if (ctrl_out && ctrl_out->is_Loop() &&
least == ctrl_out->in(LoopNode::EntryControl) &&
(ctrl_out->is_CountedLoop() || ctrl_out->is_OuterStripMinedLoop())) {
Node* least_dom = idom(least);
if (get_loop(least_dom)->is_member(get_loop(least))) {
least = least_dom;
least == ctrl_out->in(LoopNode::EntryControl)) {
// Move the node above predicates as far up as possible so a
// following pass of loop predication doesn't hoist a predicate
// that depends on it above that node.
Node* new_ctrl = least;
for (;;) {
if (!new_ctrl->is_Proj()) {
break;
}
CallStaticJavaNode* call = new_ctrl->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
if (call == NULL) {
break;
}
int req = call->uncommon_trap_request();
Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
if (trap_reason != Deoptimization::Reason_loop_limit_check &&
trap_reason != Deoptimization::Reason_predicate &&
trap_reason != Deoptimization::Reason_profile_predicate) {
break;
}
Node* c = new_ctrl->in(0)->in(0);
if (is_dominator(c, early) && c != early) {
break;
}
new_ctrl = c;
}
least = new_ctrl;
}
}

View File

@@ -915,13 +915,13 @@ private:
void copy_skeleton_predicates_to_main_loop(CountedLoopNode* pre_head, Node* init, Node* stride, IdealLoopTree* outer_loop, LoopNode* outer_main_head,
uint dd_main_head, const uint idx_before_pre_post, const uint idx_after_post_before_pre,
Node* zero_trip_guard_proj_main, Node* zero_trip_guard_proj_post, const Node_List &old_new);
Node* clone_skeleton_predicate_for_main_or_post_loop(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, Node* control,
IdealLoopTree* outer_loop, Node* input_proj);
Node* clone_skeleton_predicate_bool(Node* iff, Node* new_init, Node* new_stride, Node* control);
Node* clone_skeleton_predicate_for_main_loop(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, Node* control,
IdealLoopTree* outer_loop, Node* input_proj);
Node* clone_skeleton_predicate_bool(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, Node* control,
IdealLoopTree* outer_loop);
static bool skeleton_predicate_has_opaque(IfNode* iff);
static void get_skeleton_predicates(Node* predicate, Unique_Node_List& list, bool get_opaque = false);
void update_main_loop_skeleton_predicates(Node* ctrl, CountedLoopNode* loop_head, Node* init, int stride_con);
void copy_skeleton_predicates_to_post_loop(LoopNode* main_loop_head, CountedLoopNode* post_loop_head, Node* init, Node* stride);
void insert_loop_limit_check(ProjNode* limit_check_proj, Node* cmp_limit, Node* bol);
#ifdef ASSERT
bool only_has_infinite_loops();
@@ -1244,9 +1244,9 @@ public:
void insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_new, bool peel_only );
// Add post loop after the given loop.
Node *insert_post_loop(IdealLoopTree* loop, Node_List& old_new,
CountedLoopNode* main_head, CountedLoopEndNode* main_end,
Node*& incr, Node* limit, CountedLoopNode*& post_head);
Node *insert_post_loop(IdealLoopTree *loop, Node_List &old_new,
CountedLoopNode *main_head, CountedLoopEndNode *main_end,
Node *incr, Node *limit, CountedLoopNode *&post_head);
// Add an RCE'd post loop which we will multi-version adapt for run time test path usage
void insert_scalar_rced_post_loop( IdealLoopTree *loop, Node_List &old_new );
@@ -1579,9 +1579,8 @@ private:
Node_List* old_new = NULL);
void clone_skeleton_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, Deoptimization::DeoptReason reason,
ProjNode* old_predicate_proj, ProjNode* iffast_pred, ProjNode* ifslow_pred);
ProjNode* clone_skeleton_predicate_for_unswitched_loops(Node* iff, ProjNode* predicate,
Deoptimization::DeoptReason reason,
ProjNode* output_proj);
ProjNode* clone_skeleton_predicate_for_unswitched_loops(Node* iff, ProjNode* predicate, Node* uncommon_proj, Deoptimization::DeoptReason reason,
ProjNode* output_proj, IdealLoopTree* loop);
static void check_created_predicate_for_unswitching(const Node* new_entry) PRODUCT_RETURN;
bool _created_loop_node;

View File

@@ -2562,7 +2562,6 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
assert(n->Opcode() == Op_LoopLimit ||
n->Opcode() == Op_Opaque2 ||
n->Opcode() == Op_Opaque3 ||
n->Opcode() == Op_Opaque4 ||
BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(n),
"unknown node type in macro list");
}
@@ -2624,19 +2623,6 @@ bool PhaseMacroExpand::expand_macro_nodes() {
_igvn.replace_node(n, repl);
success = true;
#endif
} else if (n->Opcode() == Op_Opaque4) {
// With Opaque4 nodes, the expectation is that the test of input 1
// is always equal to the constant value of input 2. So we can
// remove the Opaque4 and replace it by input 2. In debug builds,
// leave the non constant test in instead to sanity check that it
// never fails (if it does, that subgraph was constructed so, at
// runtime, a Halt node is executed).
#ifdef ASSERT
_igvn.replace_node(n, n->in(1));
#else
_igvn.replace_node(n, n->in(2));
#endif
success = true;
} else if (n->Opcode() == Op_OuterStripMinedLoop) {
n->as_OuterStripMinedLoop()->adjust_strip_mined_loop(&_igvn);
C->remove_macro_node(n);

View File

@@ -60,6 +60,25 @@ bool Opaque2Node::cmp( const Node &n ) const {
return (&n == this); // Always fail except on self
}
Node* Opaque4Node::Identity(PhaseGVN* phase) {
if (phase->C->post_loop_opts_phase()) {
// With Opaque4 nodes, the expectation is that the test of input 1
// is always equal to the constant value of input 2. So we can
// remove the Opaque4 and replace it by input 2. In debug builds,
// leave the non constant test in instead to sanity check that it
// never fails (if it does, that subgraph was constructed so, at
// runtime, a Halt node is executed).
#ifdef ASSERT
return this->in(1);
#else
return this->in(2);
#endif
} else {
phase->C->record_for_post_loop_opts_igvn(this);
}
return this;
}
const Type* Opaque4Node::Value(PhaseGVN* phase) const {
return phase->type(in(1));
}

View File

@@ -114,13 +114,11 @@ class Opaque3Node : public Opaque2Node {
// GraphKit::must_be_not_null().
class Opaque4Node : public Node {
public:
Opaque4Node(Compile* C, Node *tst, Node* final_tst) : Node(NULL, tst, final_tst) {
init_flags(Flag_is_macro);
C->add_macro_node(this);
}
Opaque4Node(Compile* C, Node *tst, Node* final_tst) : Node(NULL, tst, final_tst) {}
virtual int Opcode() const;
virtual const Type *bottom_type() const { return TypeInt::BOOL; }
virtual Node* Identity(PhaseGVN* phase);
virtual const Type* Value(PhaseGVN* phase) const;
};

View File

@@ -200,24 +200,6 @@ bool PhaseIdealLoop::split_up( Node *n, Node *blk1, Node *blk2 ) {
return true;
}
}
if (n->Opcode() == Op_OpaqueLoopStride || n->Opcode() == Op_OpaqueLoopInit) {
Unique_Node_List wq;
wq.push(n);
for (uint i = 0; i < wq.size(); i++) {
Node* m = wq.at(i);
if (m->is_If()) {
assert(skeleton_predicate_has_opaque(m->as_If()), "opaque node not reachable from if?");
Node* bol = clone_skeleton_predicate_bool(m, NULL, NULL, m->in(0));
_igvn.replace_input_of(m, 1, bol);
} else {
assert(!m->is_CFG(), "not CFG expected");
for (DUIterator_Fast jmax, j = m->fast_outs(jmax); j < jmax; j++) {
Node* u = m->fast_out(j);
wq.push(u);
}
}
}
}
// See if splitting-up a Store. Any anti-dep loads must go up as
// well. An anti-dep load might be in the wrong block, because in

View File

@@ -249,13 +249,6 @@ public final class CStrike extends PhysicalStrike {
}
}
int getSlot0GlyphImagePtrs(int[] glyphCodes, long[] images, int len) {
int ourGlyphs = 0;
while (ourGlyphs < len && (glyphCodes[ourGlyphs] & CompositeGlyphMapper.SLOTMASK) == 0) ourGlyphs++;
getGlyphImagePtrs(glyphCodes, images, ourGlyphs);
return ourGlyphs;
}
// called from the Sun2D renderer
void getGlyphImagePtrs(int[] glyphCodes, long[] images, int len) {
synchronized (glyphInfoCache) {

View File

@@ -1339,7 +1339,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// which is going to become 'main window', are placed above their siblings.
CPlatformWindow rootOwner = getRootOwner();
if (rootOwner.isVisible() && !rootOwner.isIconified() && !rootOwner.isActive()) {
rootOwner.execute(CWrapper.NSWindow::orderFrontIfOnActiveSpace);
rootOwner.execute(CWrapper.NSWindow::orderFront);
}
// Do not order child windows of iconified owner.
@@ -1375,7 +1375,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
pwUnder.execute(underPtr -> {
pw.execute(ptr -> {
CWrapper.NSWindow.orderWindowIfOnActiveSpace(ptr, CWrapper.NSWindow.NSWindowAbove, underPtr);
CWrapper.NSWindow.orderWindow(ptr, CWrapper.NSWindow.NSWindowAbove, underPtr);
});
});
pwUnder = pw;

View File

@@ -56,10 +56,8 @@ final class CWrapper {
static native boolean isKeyWindow(long window);
static native void orderFront(long window);
static native void orderFrontIfOnActiveSpace(long window);
static native void orderFrontRegardless(long window);
static native void orderWindow(long window, int ordered, long relativeTo);
static native void orderWindowIfOnActiveSpace(long window, int ordered, long relativeTo);
/**
* Removes the window from the screen.

View File

@@ -69,9 +69,6 @@ static NSPoint lastTopLeftPoint;
static BOOL ignoreResizeWindowDuringAnotherWindowEnd = NO;
static BOOL fullScreenTransitionInProgress = NO;
static BOOL orderingScheduled = NO;
// --------------------------------------------------------------
// NSWindow/NSPanel descendants implementation
#define AWT_NS_WINDOW_IMPLEMENTATION \
@@ -402,11 +399,10 @@ AWT_NS_WINDOW_IMPLEMENTATION
if (IS(mask, FULLSCREENABLE) && [self.nsWindow respondsToSelector:@selector(toggleFullScreen:)]) {
if (IS(bits, FULLSCREENABLE)) {
self.nsWindow.collectionBehavior = self.nsWindow.collectionBehavior |
NSWindowCollectionBehaviorFullScreenPrimary;
[self.nsWindow setCollectionBehavior:
NSWindowCollectionBehaviorFullScreenPrimary | NSWindowCollectionBehaviorManaged];
} else {
self.nsWindow.collectionBehavior = self.nsWindow.collectionBehavior &
~NSWindowCollectionBehaviorFullScreenPrimary;
[self.nsWindow setCollectionBehavior: NSWindowCollectionBehaviorManaged];
}
}
@@ -482,7 +478,6 @@ AWT_ASSERT_APPKIT_THREAD;
self.isJustCreated = YES;
self.javaWindowTabbingMode = [self getJavaWindowTabbingMode];
self.nsWindow.collectionBehavior = NSWindowCollectionBehaviorManaged;
self.isEnterFullScreen = NO;
return self;
@@ -646,9 +641,8 @@ AWT_ASSERT_APPKIT_THREAD;
- (BOOL) delayShowing {
AWT_ASSERT_APPKIT_THREAD;
return ownerWindow != nil &&
([ownerWindow delayShowing] || !ownerWindow.nsWindow.onActiveSpace) &&
!nsWindow.visible;
return ownerWindow != nil && ([ownerWindow delayShowing] || !ownerWindow.nsWindow.onActiveSpace)
&& !nsWindow.visible;
}
- (BOOL) checkBlockingAndOrder {
@@ -669,19 +663,14 @@ AWT_ASSERT_APPKIT_THREAD;
+ (void)activeSpaceDidChange {
AWT_ASSERT_APPKIT_THREAD;
if (fullScreenTransitionInProgress) {
orderingScheduled = YES;
return;
}
// show delayed windows
for (NSWindow *window in NSApp.windows) {
if ([AWTWindow isJavaPlatformWindowVisible:window] && !window.visible) {
for (NSWindow* window in [NSApp windows]) {
if (window.onActiveSpace && window.mainWindow && [AWTWindow isJavaPlatformWindowVisible:window]) {
AWTWindow *awtWindow = (AWTWindow *)[window delegate];
while (awtWindow.ownerWindow != nil) {
awtWindow = awtWindow.ownerWindow;
}
if (awtWindow.nsWindow.visible && awtWindow.nsWindow.onActiveSpace) {
// there can be only one current blocker per window hierarchy,
// so we're checking just hierarchy root
if (awtWindow.ownerWindow == nil) {
// this should ensure that delayed blocking windows
// show up on space activation
[awtWindow checkBlockingAndOrder];
}
}
@@ -730,6 +719,11 @@ AWT_ASSERT_APPKIT_THREAD;
// back to normal window level
[window setLevel:NSNormalWindowLevel];
}
if (window.onActiveSpace && owner.onActiveSpace) {
// The childWindow should be displayed in front of
// its nearest parentWindow
[window orderWindow:NSWindowAbove relativeTo:[owner windowNumber]];
}
}
}];
}
@@ -1086,26 +1080,13 @@ AWT_ASSERT_APPKIT_THREAD;
[self processVisibleChildren:^void(AWTWindow* child){
NSWindow *window = child.nsWindow;
NSWindowCollectionBehavior behavior = window.collectionBehavior;
behavior &= ~(NSWindowCollectionBehaviorManaged | NSWindowCollectionBehaviorTransient);
behavior &= !(NSWindowCollectionBehaviorManaged | NSWindowCollectionBehaviorTransient);
behavior |= allow ? NSWindowCollectionBehaviorTransient : NSWindowCollectionBehaviorManaged;
window.collectionBehavior = behavior;
}];
}
- (void) fullScreenTransitionStarted {
fullScreenTransitionInProgress = YES;
}
- (void) fullScreenTransitionFinished {
fullScreenTransitionInProgress = NO;
if (orderingScheduled) {
orderingScheduled = NO;
[self checkBlockingAndOrder];
}
}
- (void)windowWillEnterFullScreen:(NSNotification *)notification {
[self fullScreenTransitionStarted];
[self allowMovingChildrenBetweenSpaces:YES];
self.isEnterFullScreen = YES;
@@ -1126,7 +1107,6 @@ AWT_ASSERT_APPKIT_THREAD;
self.isEnterFullScreen = YES;
[self allowMovingChildrenBetweenSpaces:NO];
[self fullScreenTransitionFinished];
JNIEnv *env = [ThreadUtilities getJNIEnv];
GET_CPLATFORM_WINDOW_CLASS();
@@ -1144,8 +1124,6 @@ AWT_ASSERT_APPKIT_THREAD;
- (void)windowWillExitFullScreen:(NSNotification *)notification {
self.isEnterFullScreen = NO;
[self fullScreenTransitionStarted];
JNIEnv *env = [ThreadUtilities getJNIEnv];
GET_CPLATFORM_WINDOW_CLASS();
DECLARE_METHOD(jm_windowWillExitFullScreen, jc_CPlatformWindow, "windowWillExitFullScreen", "()V");
@@ -1166,8 +1144,6 @@ AWT_ASSERT_APPKIT_THREAD;
- (void)windowDidExitFullScreen:(NSNotification *)notification {
self.isEnterFullScreen = NO;
[self fullScreenTransitionFinished];
JNIEnv *env = [ThreadUtilities getJNIEnv];
jobject platformWindow = (*env)->NewLocalRef(env, self.javaPlatformWindow);
if (platformWindow != NULL) {

View File

@@ -154,25 +154,6 @@ JNI_COCOA_ENTER(env);
JNI_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: orderFrontIfOnActiveSpace
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_orderFrontIfOnActiveSpace
(JNIEnv *env, jclass cls, jlong windowPtr)
{
JNI_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
if (window.onActiveSpace) [window orderFront:window];
}];
JNI_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: nativeOrderOut
@@ -250,26 +231,6 @@ JNI_COCOA_ENTER(env);
JNI_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: orderWindowIfOnActiveSpace
* Signature: (JIJ)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_orderWindowIfOnActiveSpace
(JNIEnv *env, jclass cls, jlong windowPtr, jint order, jlong relativeToPtr)
{
JNI_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
NSWindow *relativeTo = (NSWindow *)jlong_to_ptr(relativeToPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
if (window.onActiveSpace) [window orderWindow:(NSWindowOrderingMode)order relativeTo:[relativeTo windowNumber]];
}];
JNI_COCOA_EXIT(env);
}
// Used for CWrapper.NSWindow.setLevel() (and level() which isn't implemented yet)
static NSInteger LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_MAX_WINDOW_LEVELS];
static void initLevels()

View File

@@ -161,8 +161,8 @@ void initializeActions() {
[sActions setObject:NSAccessibilityPressAction forKey:@"click"];
[sActions setObject:NSAccessibilityIncrementAction forKey:@"increment"];
[sActions setObject:NSAccessibilityDecrementAction forKey:@"decrement"];
[sActions setObject:NSAccessibilityShowMenuAction forKey:@"toggle popup"];
[sActions setObject:NSAccessibilityPressAction forKey:@"toggleexpand"];
[sActions setObject:NSAccessibilityShowMenuAction forKey:@"togglePopup"];
[sActions setObject:NSAccessibilityPressAction forKey:@"toggleExpand"];
sActionSelectors = [[NSMutableDictionary alloc] initWithCapacity:actionsCount];

View File

@@ -37,9 +37,7 @@
#include "sizecalc.h"
#include <jni_util.h>
#include <stdio.h>
#include <math.h>
#include "awt.h"
#include "debug_assert.h"
static void *gtk3_libhandle = NULL;
static void *gthread_libhandle = NULL;
@@ -2913,45 +2911,17 @@ static void transform_detail_string (const gchar *detail,
}
}
inline static int scale_down_to_plus_inf(int what, int scale) {
return (int)ceilf(what / (float)scale);
}
inline static int scale_down_to_minus_inf(int what, int scale) {
return (int)floorf(what / (float)scale);
}
static gboolean gtk3_get_drawable_data(JNIEnv *env, jintArray pixelArray,
int x, jint y, jint width, jint height, jint jwidth, int dx, int dy,
jint scale) {
GdkPixbuf *pixbuf;
jint *ary;
int skip_left = 0;
int skip_top = 0;
GdkWindow *root = (*fp_gdk_get_default_root_window)();
if (gtk3_version_3_10) {
int win_scale = (*fp_gdk_window_get_scale_factor)(root);
// Scale the coordinate and size carefully such that the captured area
// is at least as large as requested. We trim off excess later by
// using the skip_* variables.
const int x_scaled = scale_down_to_minus_inf(x, win_scale);
const int y_scaled = scale_down_to_minus_inf(y, win_scale);
skip_left = x - x_scaled*win_scale;
skip_top = y - y_scaled*win_scale;
DASSERT(skip_left >= 0 && skip_top >= 0);
const int x_right_scaled = scale_down_to_plus_inf(x + width, win_scale);
const int width_scaled = x_right_scaled - x_scaled;
DASSERT(width_scaled > 0);
const int y_bottom_scaled = scale_down_to_plus_inf(y + height, win_scale);
const int height_scaled = y_bottom_scaled - y_scaled;
DASSERT(height_scaled > 0);
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(
root, x_scaled, y_scaled, width_scaled, height_scaled);
root, x, y, (int) (width / (float) win_scale + 0.5), (int) (height / (float) win_scale + 0.5));
} else {
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(root, x, y, width, height);
}
@@ -2986,8 +2956,7 @@ static gboolean gtk3_get_drawable_data(JNIEnv *env, jintArray pixelArray,
int index;
for (_y = 0; _y < height; _y++) {
for (_x = 0; _x < width; _x++) {
p = pix + (intptr_t) (_y + skip_top) * stride
+ (_x + skip_left) * nchan;
p = pix + (intptr_t) _y * stride + _x * nchan;
index = (_y + dy) * jwidth + (_x + dx);
ary[index] = 0xff000000

View File

@@ -2784,12 +2784,9 @@ AwtComponent::GetJavaModifiers()
if (HIBYTE(::GetKeyState(VK_MENU)) != 0) {
modifiers |= java_awt_event_InputEvent_ALT_DOWN_MASK;
}
// Reverted fix of JDK-8041928: MouseEvent.getModifiersEx gives wrong result
// Because it breaks AltGr shortcuts.
// See IDEA-287559, JBR-4207 for more info.
// if (HIBYTE(::GetKeyState(VK_RMENU)) != 0) {
// modifiers |= java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK;
// }
if (HIBYTE(::GetKeyState(VK_RMENU)) != 0) {
modifiers |= java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK;
}
if (HIBYTE(::GetKeyState(VK_MBUTTON)) != 0) {
modifiers |= java_awt_event_InputEvent_BUTTON2_DOWN_MASK;
}

View File

@@ -1,79 +0,0 @@
/*
* Copyright (c) 2021, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8275330
* @summary C2: assert(n->is_Root() || n->is_Region() || n->is_Phi() || n->is_MachMerge() || def_block->dominates(block)) failed: uses must be dominated by definitions
*
* @run main/othervm -Xmx512m -XX:+UnlockDiagnosticVMOptions -Xcomp -XX:CompileOnly=TestDeadPostLoopBecausePredicate TestDeadPostLoopBecausePredicate
*
*/
public class TestDeadPostLoopBecausePredicate {
public static final int N = 400;
public static int iFld=54270;
public static int iFld1=-4;
public int iFld2=201;
public int mainTest(String[] strArr1) {
int i=0, i17=8052, i19=22380, i20=60894, iArr[]=new int[N];
init(iArr, 4);
i = 1;
do {
for (i17 = 5; i17 < 114; i17++) {
switch ((i17 % 7) + 126) {
case 126:
for (i19 = 2; i19 > i; i19 -= 3) {
try {
i20 = (iFld2 % TestDeadPostLoopBecausePredicate.iFld1);
i20 = (iArr[i19 - 1] % TestDeadPostLoopBecausePredicate.iFld);
TestDeadPostLoopBecausePredicate.iFld = (TestDeadPostLoopBecausePredicate.iFld1 % iArr[i19]);
} catch (ArithmeticException a_e) {}
}
break;
}
}
} while (++i < 220);
return i20;
}
public static void init(int[] a, int seed) {
for (int j = 0; j < a.length; j++) {
a[j] = (j % 2 == 0) ? seed + j : seed - j;
}
}
public static void main(String[] strArr) {
TestDeadPostLoopBecausePredicate _instance = new TestDeadPostLoopBecausePredicate();
for (int i = 0; i < 10; i++ ) {
_instance.mainTest(strArr);
}
}
}

View File

@@ -1,268 +0,0 @@
/*
* Copyright (c) 2022, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* bug 8280799
* @summary С2: assert(false) failed: cyclic dependency prevents range check elimination
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseCountedLoopSafepoints TestPredicateInputBelowLoopPredicate
*/
public class TestPredicateInputBelowLoopPredicate {
private static final Object object = new Object();
private static int fieldStop = 100;
private static int[] array = new int[200];
private static int[] array2 = new int[200];
private static int fieldStart = 0;
public static void main(String[] args) {
for (int i = 0; i < 20_000; i++) {
test(true);
test(false);
}
}
private static void test(boolean flag) {
if (array == null) {
}
int start = fieldStart;
int i = start;
for(;;) {
int j;
for (j = -10; j < 0; j++) {
}
int stop = fieldStop;
// bound check becomes candidate for predication once
// loop above is optimized out
array[stop - i + j] = 0;
// A bunch of stuff to grow loop body size and prevent peeling:
array2[0] = 0;
array2[1] = 0;
array2[2] = 0;
array2[3] = 0;
array2[4] = 0;
array2[5] = 0;
array2[6] = 0;
array2[7] = 0;
array2[8] = 0;
array2[9] = 0;
array2[10] = 0;
array2[11] = 0;
array2[12] = 0;
array2[13] = 0;
array2[14] = 0;
array2[15] = 0;
array2[16] = 0;
array2[17] = 0;
array2[18] = 0;
array2[19] = 0;
array2[20] = 0;
array2[21] = 0;
array2[22] = 0;
array2[23] = 0;
array2[24] = 0;
array2[25] = 0;
array2[26] = 0;
array2[27] = 0;
array2[28] = 0;
array2[29] = 0;
array2[30] = 0;
array2[31] = 0;
array2[32] = 0;
array2[33] = 0;
array2[34] = 0;
array2[35] = 0;
array2[36] = 0;
array2[37] = 0;
array2[38] = 0;
array2[39] = 0;
array2[40] = 0;
array2[41] = 0;
array2[42] = 0;
array2[43] = 0;
array2[44] = 0;
array2[45] = 0;
array2[46] = 0;
array2[47] = 0;
array2[48] = 0;
array2[49] = 0;
array2[50] = 0;
array2[51] = 0;
array2[52] = 0;
array2[53] = 0;
array2[54] = 0;
array2[55] = 0;
array2[56] = 0;
array2[57] = 0;
array2[58] = 0;
array2[59] = 0;
array2[60] = 0;
array2[61] = 0;
array2[62] = 0;
array2[63] = 0;
array2[64] = 0;
array2[65] = 0;
array2[66] = 0;
array2[67] = 0;
array2[68] = 0;
array2[69] = 0;
array2[70] = 0;
array2[71] = 0;
array2[72] = 0;
array2[73] = 0;
array2[74] = 0;
array2[75] = 0;
array2[76] = 0;
array2[77] = 0;
array2[78] = 0;
array2[79] = 0;
array2[80] = 0;
array2[81] = 0;
array2[82] = 0;
array2[83] = 0;
array2[84] = 0;
array2[85] = 0;
array2[86] = 0;
array2[87] = 0;
array2[88] = 0;
array2[89] = 0;
array2[90] = 0;
array2[91] = 0;
array2[92] = 0;
array2[93] = 0;
array2[94] = 0;
array2[95] = 0;
array2[96] = 0;
array2[97] = 0;
array2[98] = 0;
array2[99] = 0;
array2[100] = 0;
array2[101] = 0;
array2[102] = 0;
array2[103] = 0;
array2[104] = 0;
array2[105] = 0;
array2[106] = 0;
array2[107] = 0;
array2[108] = 0;
array2[109] = 0;
array2[110] = 0;
array2[111] = 0;
array2[112] = 0;
array2[113] = 0;
array2[114] = 0;
array2[115] = 0;
array2[116] = 0;
array2[117] = 0;
array2[118] = 0;
array2[119] = 0;
array2[120] = 0;
array2[121] = 0;
array2[122] = 0;
array2[123] = 0;
array2[124] = 0;
array2[125] = 0;
array2[126] = 0;
array2[127] = 0;
array2[128] = 0;
array2[129] = 0;
array2[130] = 0;
array2[131] = 0;
array2[132] = 0;
array2[133] = 0;
array2[134] = 0;
array2[135] = 0;
array2[136] = 0;
array2[137] = 0;
array2[138] = 0;
array2[139] = 0;
array2[140] = 0;
array2[141] = 0;
array2[142] = 0;
array2[143] = 0;
array2[144] = 0;
array2[145] = 0;
array2[146] = 0;
array2[147] = 0;
array2[148] = 0;
array2[149] = 0;
array2[150] = 0;
array2[151] = 0;
array2[152] = 0;
array2[153] = 0;
array2[154] = 0;
array2[155] = 0;
array2[156] = 0;
array2[157] = 0;
array2[158] = 0;
array2[159] = 0;
array2[160] = 0;
array2[161] = 0;
array2[162] = 0;
array2[163] = 0;
array2[164] = 0;
array2[165] = 0;
array2[166] = 0;
array2[167] = 0;
array2[168] = 0;
array2[169] = 0;
array2[170] = 0;
array2[171] = 0;
array2[172] = 0;
array2[173] = 0;
array2[174] = 0;
array2[175] = 0;
array2[176] = 0;
array2[177] = 0;
array2[178] = 0;
array2[179] = 0;
array2[180] = 0;
array2[181] = 0;
array2[182] = 0;
array2[183] = 0;
array2[184] = 0;
array2[185] = 0;
array2[186] = 0;
array2[187] = 0;
array2[188] = 0;
array2[189] = 0;
array2[190] = 0;
array2[191] = 0;
array2[192] = 0;
array2[193] = 0;
array2[194] = 0;
array2[195] = 0;
array2[196] = 0;
array2[197] = 0;
array2[198] = 0;
array2[199] = 0;
i++;
if (i == stop) { // requires a loop limit predicate
break;
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -109,7 +109,6 @@ public class LambdaEagerInit {
static void testDefaultArchiveWithEagerInitializationEnabled() throws Exception {
// run with default CDS archive with the -Djdk.internal.lambda.disableEagerInitialization=true property
CDSOptions runOpts = (new CDSOptions())
.setXShareMode("auto")
.addPrefix("-cp", appJar, testProperty, "-Xlog:class+load,cds=debug")
.setUseSystemArchive(true)
.setUseVersion(false)
@@ -123,16 +122,13 @@ public class LambdaEagerInit {
static void testDefaultArchiveWithEagerInitializationDisabled() throws Exception {
// run with default CDS archive without the -Djdk.internal.lambda.disableEagerInitialization=true property
CDSOptions runOpts = (new CDSOptions())
.setXShareMode("auto")
.addPrefix("-cp", appJar, "-Xlog:class+load,cds=debug")
.setUseSystemArchive(true)
.setUseVersion(false)
.addSuffix("-showversion", mainClass);
.addSuffix(mainClass);
OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts);
if (output.getStderr().contains("sharing")) {
output.shouldMatch(lambdaLoadedFromArchive)
.shouldMatch(cdsLoadedLambdaProxy);
}
output.shouldHaveExitValue(0);
output.shouldMatch(lambdaLoadedFromArchive)
.shouldMatch(cdsLoadedLambdaProxy)
.shouldHaveExitValue(0);
}
}

View File

@@ -25,17 +25,13 @@ import java.awt.Dimension;
import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.reflect.InvocationTargetException;
import java.nio.file.Path;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import jdk.jfr.Recording;
import java.io.IOException;
import jdk.jfr.consumer.RecordedEvent;
import jdk.jfr.consumer.RecordedFrame;
import jdk.jfr.consumer.RecordingFile;
/*
* @test
@@ -43,21 +39,20 @@ import jdk.jfr.consumer.RecordingFile;
*
* @summary Test verifies that there is no extra allocation after display mode switch
*
* @run main/othervm -Xmx750M ExtraAllocationTest
* @run main/othervm -Xmx750M ExtraAllocationTest
*/
public class ExtraAllocationTest {
private static final int MAX_MODES = 10;
private static final int W = 500;
private static final int H = 500;
static JFrame f = null;
static long th = ((long) W * H * 32) / (8 * 2);
public static void main(String[] args) throws InterruptedException, InvocationTargetException,
IOException
{
Recording recording = new Recording();
recording.enable("jdk.ObjectAllocationOutsideTLAB");
recording.start();
public static void main(String[] args) throws InterruptedException, InvocationTargetException {
MemoryMXBean memBean = ManagementFactory.getMemoryMXBean();
memBean.gc();
Thread.sleep(2000);
SwingUtilities.invokeAndWait(() -> {
f = new JFrame();
f.add(new JPanel());
@@ -71,38 +66,35 @@ public class ExtraAllocationTest {
GraphicsDevice d = ge.getDefaultScreenDevice();
if (d.isDisplayChangeSupported()) {
DisplayMode odm = d.getDisplayMode();
DisplayMode[] modes = d.getDisplayModes();
int modesCount = Math.min(modes.length, MAX_MODES);
try {
int modesCount = Math.min(modes.length, MAX_MODES);
for (int i = 0; i < modesCount; i++) {
DisplayMode mode = modes[i];
try {
d.setDisplayMode(mode);
} catch (IllegalArgumentException e) {
e.printStackTrace();
for (int i = 0; i < modesCount; i++) {
DisplayMode mode = modes[i];
int w = mode.getWidth();
int h = mode.getHeight();
int bpp = mode.getBitDepth();
long th = ((long) W * H * bpp) / (8 * 2);
DisplayMode newMode =
new DisplayMode(w, h, bpp, DisplayMode.REFRESH_RATE_UNKNOWN);
long usedHeap = memBean.getHeapMemoryUsage().getUsed();
d.setDisplayMode(newMode);
Thread.sleep(2000);
long memDiff = memBean.getHeapMemoryUsage().getUsed() - usedHeap;
if (memDiff > th) {
throw new RuntimeException("Extra allocation detected: " + memDiff);
}
ManagementFactory.getMemoryMXBean().gc();
Thread.sleep(2000);
}
Thread.sleep(2000);
} finally {
d.setDisplayMode(odm);
}
}
f.setVisible(false);
f.dispose();
Thread.sleep(1000);
Path path = Path.of("recording.jfr");
recording.dump(path);
recording.close();
for (RecordedEvent event : RecordingFile.readAllEvents(path)) {
if ("jdk.ObjectAllocationOutsideTLAB".equalsIgnoreCase(event.getEventType().getName())) {
for (RecordedFrame recordedFrame :event.getStackTrace().getFrames()) {
if (recordedFrame.isJavaFrame() &&
"java.awt.image.DataBufferInt".equals(
recordedFrame.getMethod().getType().getName()) &&
event.getLong("allocationSize") > th)
{
throw new RuntimeException("Extra allocation detected: " +
event.getLong("allocationSize"));
}
}
}
}
}
}

View File

@@ -27,29 +27,20 @@ import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Panel;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.image.BufferedImage;
import javax.swing.UIManager;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;
/**
* @test
* @key headful
* @bug 8073320 8280861
* @bug 8073320
* @summary Windows HiDPI support
* @author Alexander Scherbatiy
* @requires (os.family == "linux" | os.family == "windows")
* @requires !display.XWayland
* @run main/othervm -Dsun.java2d.win.uiScaleX=3 -Dsun.java2d.win.uiScaleY=2
* HiDPIRobotScreenCaptureTest
* @run main/othervm -Dsun.java2d.uiScale=1
* HiDPIRobotScreenCaptureTest
* @run main/othervm -Dsun.java2d.uiScale=2
* HiDPIRobotScreenCaptureTest
*/
public class HiDPIRobotScreenCaptureTest {
@@ -69,14 +60,7 @@ public class HiDPIRobotScreenCaptureTest {
}
Frame frame = new Frame();
// Position the frame on prime number coordinates to avoid
// them being multiple of the desktop scale; this tests Linux
// color picker better.
// Also, the position should be far enough from the top left
// corner of the screen to reduce the chance of being repositioned
// by the system because that area's occupied by the global
// menu bar and such.
frame.setBounds(83, 97, 400, 300);
frame.setBounds(40, 30, 400, 300);
frame.setUndecorated(true);
Panel panel = new Panel(new BorderLayout());
@@ -94,13 +78,6 @@ public class HiDPIRobotScreenCaptureTest {
g.fillRect(0, h / 2, w / 2, h / 2);
g.setColor(COLORS[3]);
g.fillRect(w / 2, h / 2, w / 2, h / 2);
// Several distinct pixels next to one another
// in order to test color picker's precision.
for (int i = 1; i < 4; i++) {
g.setColor(COLORS[i]);
g.fillRect(i, 0, 1, 1);
}
}
};
@@ -109,15 +86,11 @@ public class HiDPIRobotScreenCaptureTest {
frame.setVisible(true);
Robot robot = new Robot();
robot.waitForIdle();
robot.delay(500);
final Point screenLocation = frame.getLocationOnScreen();
checkPixelColors(robot, screenLocation.x, screenLocation.y);
Thread.sleep(200);
Rectangle rect = canvas.getBounds();
rect.setLocation(canvas.getLocationOnScreen());
System.out.println("Creating screen capture of " + rect);
BufferedImage image = robot.createScreenCapture(rect);
frame.dispose();
@@ -128,53 +101,20 @@ public class HiDPIRobotScreenCaptureTest {
throw new RuntimeException("Wrong image size!");
}
if (image.getRGB(w / 4, h / 4) != COLORS[0].getRGB()) {
throw new RuntimeException("Wrong image color!");
}
checkRectColor(image, new Rectangle(0, 0, w / 2, h / 2), COLORS[0]);
checkRectColor(image, new Rectangle(w / 2, 0, w / 2, h / 2), COLORS[1]);
checkRectColor(image, new Rectangle(0, h / 2, w / 2, h / 2), COLORS[2]);
checkRectColor(image, new Rectangle(w / 2, h / 2, w / 2, h / 2), COLORS[3]);
}
if (image.getRGB(3 * w / 4, h / 4) != COLORS[1].getRGB()) {
throw new RuntimeException("Wrong image color!");
}
static void checkPixelColors(Robot robot, int x, int y) {
for (int i = 0; i < 4; i++) {
final Color actualColor = robot.getPixelColor(x + i, y);
System.out.print("Checking color at " + (x + i) + ", " + y + " to be equal to " + COLORS[i]);
if (!actualColor.equals(COLORS[i])) {
System.out.println("... Mismatch: found " + actualColor + " instead");
throw new RuntimeException("Wrong screen pixel color");
if (image.getRGB(w / 4, 3 * h / 4) != COLORS[2].getRGB()) {
throw new RuntimeException("Wrong image color!");
}
} else {
System.out.println("... OK");
}
if (image.getRGB(3 * w / 4, 3 * h / 4) != COLORS[3].getRGB()) {
throw new RuntimeException("Wrong image color!");
}
}
private static final int OFFSET = 5;
static void checkRectColor(BufferedImage image, Rectangle rect, Color expectedColor) {
System.out.println("Checking rectangle " + rect + " to have color " + expectedColor);
final Point[] pointsToCheck = new Point[] {
new Point(rect.x + OFFSET, rect.y + OFFSET), // top left corner
new Point(rect.x + rect.width - OFFSET, rect.y + OFFSET), // top right corner
new Point(rect.x + rect.width / 2, rect.y + rect.height / 2), // center
new Point(rect.x + OFFSET, rect.y + rect.height - OFFSET), // bottom left corner
new Point(rect.x + rect.width - OFFSET, rect.y + rect.height - OFFSET) // bottom right corner
};
for (final var point : pointsToCheck) {
System.out.print("Checking color at " + point + " to be equal to " + expectedColor);
final int actualColor = image.getRGB(point.x, point.y);
if (actualColor != expectedColor.getRGB()) {
System.out.println("... Mismatch: found " + new Color(actualColor) + " instead. Check image.png.");
try {
ImageIO.write(image, "png", new File("image.png"));
} catch(IOException e) {
System.out.println("failed to save image.png.");
e.printStackTrace();
}
throw new RuntimeException("Wrong image color!");
} else {
System.out.println("... OK");
}
}
}
}
}

View File

@@ -24,8 +24,7 @@
/*
* @test
* @key headful
* @bug 8162959 8280861
* @requires !display.XWayland
* @bug 8162959
* @summary Validate output of createMultiResolutionScreenCapture
* new API which returns MultiResolutionImage.
* @run main/othervm -Dsun.java2d.uiScale=1 ScreenCaptureTest
@@ -45,7 +44,6 @@ import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Panel;
import java.awt.Point;
import java.awt.Robot;
import java.util.List;
@@ -60,14 +58,7 @@ public class ScreenCaptureTest {
public static void main(String[] args) throws Exception {
frame = new Frame();
// Position the frame on prime number coordinates to avoid
// them being multiple of the desktop scale; this tests Linux
// color picker better.
// Also, the position should be far enough from the top left
// corner of the screen to reduce the chance of being repositioned
// by the system because that area's occupied by the global
// menu bar and such.
frame.setBounds(83, 97, 400, 400);
frame.setBounds(0, 0, 400, 400);
frame.setUndecorated(true);
robot = new Robot();
Panel panel = new Panel(new BorderLayout());
@@ -96,112 +87,97 @@ public class ScreenCaptureTest {
int w = frame.getWidth();
int h = frame.getHeight();
final Point screenLocation = frame.getLocationOnScreen();
final int x = screenLocation.x;
final int y = screenLocation.y;
try {
// getPixelColor() tests
checkRectColor(new Rectangle(x, y, w / 2, h / 2), COLORS[0]);
checkRectColor(new Rectangle(x + w / 2, y, w / 2, h / 2), COLORS[1]);
checkRectColor(new Rectangle(x, y + h / 2, w / 2, h / 2), COLORS[2]);
checkRectColor(new Rectangle(x + w / 2, y + h / 2, w / 2, h / 2), COLORS[3]);
// getPixelColor Test
// Check pixel color in first quardant GREEN; x=100, y=100
if (!robot.getPixelColor(w / 4, h / 4).equals(COLORS[0])) {
throw new RuntimeException("Wrong Pixel Color! Expected GREEN");
}
// Check pixel color in second quardant; BLUE, x=300, y=100
if (!robot.getPixelColor(3 * w / 4, h / 4).equals(COLORS[1])) {
throw new RuntimeException("Wrong Pixel Color! Expected BLUE");
}
// Check pixel color in third quardant; ORANGE, x=100, y=300
if (!robot.getPixelColor(w / 4, 3 * h / 4).equals(COLORS[2])) {
throw new RuntimeException("Wrong Pixel Color! Expected ORANGE");
}
// Check pixel color in fourth quardant; RED, x=300, y=300
if (!robot.getPixelColor(3 * w / 4, 3 * h / 4).equals(COLORS[3])) {
throw new RuntimeException("Wrong Pixel Color! Expected RED");
}
// createScreenCaptureTest
AffineTransform tx = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice().getDefaultConfiguration()
.getDefaultTransform();
// createScreenCaptureTest
AffineTransform tx = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice().getDefaultConfiguration()
.getDefaultTransform();
if (tx.getScaleX() == 1 && tx.getScaleY() == 1) {
isHiDPI = false;
if (tx.getScaleX() == 1 && tx.getScaleY() == 1) {
isHiDPI = false;
}
MultiResolutionImage image
= robot.createMultiResolutionScreenCapture(frame.getBounds());
List<Image> imageList = image.getResolutionVariants();
int size = imageList.size();
BufferedImage lowResImage;
BufferedImage highResImage;
if (!isHiDPI) {
// Check if output is MultiResolutionImage with one variant
if (size != 1) {
throw new RuntimeException(" Invalid variant size");
}
MultiResolutionImage image
= robot.createMultiResolutionScreenCapture(frame.getBounds());
List<Image> imageList = image.getResolutionVariants();
int size = imageList.size();
BufferedImage lowResImage;
BufferedImage highResImage;
if (!isHiDPI) {
// Check if output is MultiResolutionImage with one variant
if (size != 1) {
throw new RuntimeException(" Invalid variant size");
}
lowResImage = (BufferedImage) imageList.get(0);
System.out.println(frame.getBounds());
System.out.println(lowResImage.getWidth() + " " + lowResImage.getHeight());
if (frame.getWidth() != lowResImage.getWidth()
lowResImage = (BufferedImage) imageList.get(0);
System.out.println(frame.getBounds());
System.out.println(lowResImage.getWidth()+" "+lowResImage.getHeight());
if (frame.getWidth() != lowResImage.getWidth()
|| frame.getHeight() != lowResImage.getHeight()) {
throw new RuntimeException(" Invalid Image size");
}
} else {
// Check if output contains two variants.
if (size != 2) {
throw new RuntimeException(" Invalid variant size");
}
// Check if hight resolution image size is scale times low resolution image.
lowResImage = (BufferedImage) imageList.get(0);
highResImage = (BufferedImage) imageList.get(1);
int lW = (int) lowResImage.getWidth();
int lH = (int) lowResImage.getHeight();
int hW = (int) highResImage.getWidth();
int hH = (int) highResImage.getHeight();
if (hW != (tx.getScaleX() * lW) || hH != (tx.getScaleY() * lH)) {
throw new RuntimeException(" Invalid Resolution Variants");
}
// Check if both image colors are same at some location.
if (lowResImage.getRGB(lW / 4, lH / 4)
!= highResImage.getRGB(hW / 4, hH / 4)) {
throw new RuntimeException("Wrong image color!");
}
if (lowResImage.getRGB(3 * lW / 4, lH / 4)
!= highResImage.getRGB(3 * hW / 4, hH / 4)) {
throw new RuntimeException("Wrong image color!");
}
if (lowResImage.getRGB(lW / 4, 3 * lH / 4)
!= highResImage.getRGB(hW / 4, 3 * hH / 4)) {
throw new RuntimeException("Wrong image color!");
}
if (lowResImage.getRGB(3 * lW / 4, 3 * lH / 4)
!= highResImage.getRGB(3 * hW / 4, 3 * hH / 4)) {
throw new RuntimeException("Wrong image color!");
}
throw new RuntimeException(" Invalid Image size");
}
} finally {
frame.dispose();
}
}
} else {
// Check if output contains two variants.
if (size != 2) {
throw new RuntimeException(" Invalid variant size");
}
private static final int OFFSET = 5;
static void checkRectColor(Rectangle rect, Color expectedColor) {
System.out.println("Checking rectangle " + rect + " to have color " + expectedColor);
final Point[] pointsToCheck = new Point[] {
new Point(rect.x + OFFSET, rect.y + OFFSET), // top left corner
new Point(rect.x + rect.width - OFFSET, rect.y + OFFSET), // top right corner
new Point(rect.x + rect.width / 2, rect.y + rect.height / 2), // center
new Point(rect.x + OFFSET, rect.y + rect.height - OFFSET), // bottom left corner
new Point(rect.x + rect.width - OFFSET, rect.y + rect.height - OFFSET) // bottom right corner
};
// Check if hight resolution image size is scale times low resolution image.
lowResImage = (BufferedImage) imageList.get(0);
highResImage = (BufferedImage) imageList.get(1);
for (final var point : pointsToCheck) {
System.out.print("Checking color at " + point + " to be equal to " + expectedColor);
final Color actualColor = robot.getPixelColor(point.x, point.y);
if (!actualColor.equals(expectedColor)) {
System.out.println("... Mismatch: found " + actualColor + " instead");
int lW = (int) lowResImage.getWidth();
int lH = (int) lowResImage.getHeight();
int hW = (int) highResImage.getWidth();
int hH = (int) highResImage.getHeight();
if ( hW != (tx.getScaleX() * lW) || hH != (tx.getScaleY() * lH)) {
throw new RuntimeException(" Invalid Resolution Variants");
}
// Check if both image colors are same at some location.
if (lowResImage.getRGB(lW / 4, lH / 4)
!= highResImage.getRGB(hW / 4, hH / 4)) {
throw new RuntimeException("Wrong image color!");
} else {
System.out.println("... OK");
}
if (lowResImage.getRGB(3 * lW / 4, lH / 4)
!= highResImage.getRGB(3 * hW / 4, hH / 4)) {
throw new RuntimeException("Wrong image color!");
}
if (lowResImage.getRGB(lW / 4, 3 * lH / 4)
!= highResImage.getRGB(hW / 4, 3 * hH / 4)) {
throw new RuntimeException("Wrong image color!");
}
if (lowResImage.getRGB(3 * lW / 4, 3 * lH / 4)
!= highResImage.getRGB(3 * hW / 4, 3 * hH / 4)) {
throw new RuntimeException("Wrong image color!");
}
}
frame.dispose();
}
}

View File

@@ -1,183 +0,0 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8281338
* @summary Test for an element that has more than one Accessibility Action
* @author Artem.Semenov@jetbrains.com
* @run main/manual AccessibleActionsTest
* @requires (os.family == "mac")
*/
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleAction;
import javax.accessibility.AccessibleContext;
import javax.swing.*;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Hashtable;
import java.util.concurrent.CountDownLatch;
public class AccessibleActionsTest extends AccessibleComponentTest {
@Override
public CountDownLatch createCountDownLatch() {
return new CountDownLatch(1);
}
void createTest() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y actions.\n\n"
+ "Turn screen reader on, and Tab to the label.\n\n"
+ "Perform the VO action \"Press\" (VO+space)\n"
+ "Perform the VO action \"Show menu\" (VO+m)\n\n"
+ "If after the first action the text of the label has changed, and after the second action the menu appears tab further and press PASS, otherwise press FAIL.";
exceptionString = "AccessibleAction test failed!";
super.createUI(new AccessibleActionsTestFrame(), "AccessibleActionsTest");
}
void createTree() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y actions.\n\n"
+ "Turn screen reader on, and Tab to the label.\n\n"
+ "Perform the VO action \"Press\" (VO+space) on tree nodes\n\n"
+ "If after press the tree node is expanded tab further and press PASS, otherwise press FAIL.";
String root = "Root";
String[] nodes = new String[] {"One node", "Two node"};
String[][] leafs = new String[][]{{"leaf 1.1", "leaf 1.2", "leaf 1.3", "leaf 1.4"},
{"leaf 2.1", "leaf 2.2", "leaf 2.3", "leaf 2.4"}};
Hashtable<String, String[]> data = new Hashtable<String, String[]>();
for (int i = 0; i < nodes.length; i++) {
data.put(nodes[i], leafs[i]);
}
JTree tree = new JTree(data);
tree.setRootVisible(true);
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
JScrollPane scrollPane = new JScrollPane(tree);
panel.add(scrollPane);
panel.setFocusable(false);
exceptionString = "AccessibleAction test failed!";
super.createUI(panel, "AccessibleActionsTest");
}
public static void main(String[] args) throws Exception {
AccessibleActionsTest test = new AccessibleActionsTest();
countDownLatch = test.createCountDownLatch();
SwingUtilities.invokeLater(test::createTest);
countDownLatch.await();
if (!testResult) {
throw new RuntimeException(a11yTest.exceptionString);
}
countDownLatch = test.createCountDownLatch();
SwingUtilities.invokeLater(test::createTree);
countDownLatch.await();
if (!testResult) {
throw new RuntimeException(a11yTest.exceptionString);
}
}
private class AccessibleActionsTestFrame extends JPanel {
public AccessibleActionsTestFrame() {
MyLabel label = new MyLabel("I'm waiting for the push");
label.setComponentPopupMenu(createPopup());
label.setFocusable(true);
add(label);
setLayout(new FlowLayout());
}
private static class MyLabel extends JLabel {
public MyLabel(String text) {
super(text);
}
@Override
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new MyAccessibleJLabel();
}
return accessibleContext;
}
private class MyAccessibleJLabel extends JLabel.AccessibleJLabel {
@Override
public AccessibleAction getAccessibleAction() {
return new AccessibleAction() {
@Override
public int getAccessibleActionCount() {
return 2;
}
@Override
public String getAccessibleActionDescription(int i) {
if (i == 0) {
return AccessibleAction.CLICK;
}
return AccessibleAction.TOGGLE_POPUP;
}
@Override
public boolean doAccessibleAction(int i) {
if (i == 0) {
changeText(MyLabel.this, "label is pressed");
return true;
}
JPopupMenu popup = createPopup();
popup.show(MyLabel.this, 0, 0);
return true;
}
};
}
}
}
private static JPopupMenu createPopup() {
JPopupMenu popup = new JPopupMenu("MENU");
popup.add("One");
popup.add("Two");
popup.add("Three");
return popup;
}
private static void changeText(JLabel label, String text) {
label.setText(text);
}
}
}

View File

@@ -39,9 +39,7 @@ import java.awt.geom.*;
import java.awt.image.*;
import java.io.File;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
import javax.imageio.ImageIO;
import javax.swing.SwingUtilities;
public class GradientPaints extends Canvas {
@@ -70,8 +68,8 @@ public class GradientPaints extends Canvas {
(int)(TESTW * TESTH * 0.18);
private static final int ALLOWED_MISMATCHES_RADIAL =
(int)(TESTW * TESTH * 0.45);
private static final int ALLOWED_RENDER_ATTEMPTS = 5;
private static boolean done;
private static boolean verbose;
private static final Color[] COLORS = {
@@ -85,8 +83,8 @@ public class GradientPaints extends Canvas {
new Color(128, 128, 128),
};
private enum PaintType {BASIC, LINEAR, RADIAL}
private enum XformType {IDENTITY, TRANSLATE, SCALE, SHEAR, ROTATE}
private static enum PaintType {BASIC, LINEAR, RADIAL};
private static enum XformType {IDENTITY, TRANSLATE, SCALE, SHEAR, ROTATE};
private static final int[] numStopsArray = {2, 4, 7};
private static final Object[] hints = {
RenderingHints.VALUE_ANTIALIAS_OFF,
@@ -94,14 +92,35 @@ public class GradientPaints extends Canvas {
};
public void paint(Graphics g) {
painted.countDown();
synchronized (this) {
if (!done) {
done = true;
notifyAll();
}
}
}
private void testOne(BufferedImage refImg, VolatileImage testImg) {
Graphics2D gref = refImg.createGraphics();
Graphics2D gtest = testImg.createGraphics();
Paint paint =
makePaint(PaintType.RADIAL, CycleMethod.REPEAT,
ColorSpaceType.SRGB, XformType.IDENTITY, 7);
Object aahint = hints[0];
renderTest(gref, paint, aahint);
renderTest(gtest, paint, aahint);
Toolkit.getDefaultToolkit().sync();
compareImages(refImg, testImg.getSnapshot(),
TOLERANCE, 0, "");
gref.dispose();
gtest.dispose();
}
private void testAll(Graphics gscreen,
BufferedImage refImg, VolatileImage testImg, GraphicsConfiguration gc)
BufferedImage refImg, VolatileImage testImg)
{
Graphics2D gref = refImg.createGraphics();
testImg.validate(gc);
Graphics2D gtest = testImg.createGraphics();
for (PaintType paintType : PaintType.values()) {
for (CycleMethod cycleMethod : CycleMethod.values()) {
for (ColorSpaceType colorSpace : ColorSpaceType.values()) {
@@ -119,32 +138,16 @@ public class GradientPaints extends Canvas {
" numStops=" + numStops +
" aa=" + aahint;
renderTest(gref, paint, aahint);
int allowedMismatches = paintType == PaintType.RADIAL ?
ALLOWED_MISMATCHES_RADIAL : ALLOWED_MISMATCHES_LINEAR;
int attempt = 0;
while (true) {
Graphics2D gtest = testImg.createGraphics();
renderTest(gtest, paint, aahint);
gscreen.drawImage(testImg, 0, 0, null);
Toolkit.getDefaultToolkit().sync();
gtest.dispose();
BufferedImage snapshot = testImg.getSnapshot();
if (testImg.contentsLost() &&
testImg.validate(gc) != VolatileImage.IMAGE_OK)
{
if (attempt++ >= ALLOWED_RENDER_ATTEMPTS) {
throw new RuntimeException("Cannot render to VI");
}
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
continue;
}
compareImages(refImg, snapshot, allowedMismatches, msg);
break;
}
renderTest(gtest, paint, aahint);
gscreen.drawImage(testImg, 0, 0, null);
Toolkit.getDefaultToolkit().sync();
int allowedMismatches =
paintType == PaintType.RADIAL ?
ALLOWED_MISMATCHES_RADIAL :
ALLOWED_MISMATCHES_LINEAR;
compareImages(refImg, testImg.getSnapshot(),
TOLERANCE, allowedMismatches,
msg);
}
}
}
@@ -152,6 +155,7 @@ public class GradientPaints extends Canvas {
}
}
gref.dispose();
gtest.dispose();
}
private Paint makePaint(PaintType paintType,
@@ -168,6 +172,7 @@ public class GradientPaints extends Canvas {
int focusX = ctrX + 20;
int focusY = ctrY + 20;
float radius = 100.0f;
Paint paint;
AffineTransform transform;
Color[] colors = Arrays.copyOf(COLORS, numStops);
@@ -176,30 +181,57 @@ public class GradientPaints extends Canvas {
fractions[i] = ((float)i) / (fractions.length-1);
}
transform = switch (xformType) {
case IDENTITY -> new AffineTransform();
case TRANSLATE -> AffineTransform.getTranslateInstance(2, 2);
case SCALE -> AffineTransform.getScaleInstance(1.2, 1.4);
case SHEAR -> AffineTransform.getShearInstance(0.1, 0.1);
case ROTATE -> AffineTransform.getRotateInstance(Math.PI / 4,
getWidth() >> 1, getHeight() >> 1);
};
switch (xformType) {
default:
case IDENTITY:
transform = new AffineTransform();
break;
case TRANSLATE:
transform = AffineTransform.getTranslateInstance(2, 2);
break;
case SCALE:
transform = AffineTransform.getScaleInstance(1.2, 1.4);
break;
case SHEAR:
transform = AffineTransform.getShearInstance(0.1, 0.1);
break;
case ROTATE:
transform = AffineTransform.getRotateInstance(Math.PI / 4,
getWidth()/2,
getHeight()/2);
break;
}
return switch (paintType) {
case BASIC -> new GradientPaint(startX, startY, Color.RED,
endX, endY, Color.BLUE, (cycleMethod != CycleMethod.NO_CYCLE));
case LINEAR -> new LinearGradientPaint(new Point2D.Float(startX, startY),
new Point2D.Float(endX, endY),
fractions, colors,
cycleMethod, colorSpace,
transform);
case RADIAL -> new RadialGradientPaint(new Point2D.Float(ctrX, ctrY),
radius,
new Point2D.Float(focusX, focusY),
fractions, colors,
cycleMethod, colorSpace,
transform);
};
switch (paintType) {
case BASIC:
boolean cyclic = (cycleMethod != CycleMethod.NO_CYCLE);
paint =
new GradientPaint(startX, startY, Color.RED,
endX, endY, Color.BLUE, cyclic);
break;
default:
case LINEAR:
paint =
new LinearGradientPaint(new Point2D.Float(startX, startY),
new Point2D.Float(endX, endY),
fractions, colors,
cycleMethod, colorSpace,
transform);
break;
case RADIAL:
paint =
new RadialGradientPaint(new Point2D.Float(ctrX, ctrY),
radius,
new Point2D.Float(focusX, focusY),
fractions, colors,
cycleMethod, colorSpace,
transform);
break;
}
return paint;
}
private void renderTest(Graphics2D g2d, Paint p, Object aahint) {
@@ -216,7 +248,7 @@ public class GradientPaints extends Canvas {
private static void compareImages(BufferedImage refImg,
BufferedImage testImg,
int allowedMismatches,
int tolerance, int allowedMismatches,
String msg)
{
int numMismatches = 0;
@@ -229,7 +261,7 @@ public class GradientPaints extends Canvas {
for (int x = x1; x < x2; x++) {
Color expected = new Color(refImg.getRGB(x, y));
Color actual = new Color(testImg.getRGB(x, y));
if (!isSameColor(expected, actual)) {
if (!isSameColor(expected, actual, tolerance)) {
numMismatches++;
}
}
@@ -245,7 +277,6 @@ public class GradientPaints extends Canvas {
ImageIO.write(testImg, "png",
new File("GradientPaints.cap.png"));
} catch (Exception e) {
e.printStackTrace();
}
if (!verbose) {
System.err.println(msg);
@@ -254,49 +285,53 @@ public class GradientPaints extends Canvas {
numMismatches +
") exceeds limit (" +
allowedMismatches +
") with tolerance=" + TOLERANCE);
") with tolerance=" +
tolerance);
}
}
private static boolean isSameColor(Color c1, Color c2) {
private static boolean isSameColor(Color c1, Color c2, int e) {
int r1 = c1.getRed();
int g1 = c1.getGreen();
int b1 = c1.getBlue();
int r2 = c2.getRed();
int g2 = c2.getGreen();
int b2 = c2.getBlue();
int rmin = Math.max(r2- TOLERANCE, 0);
int gmin = Math.max(g2- TOLERANCE, 0);
int bmin = Math.max(b2- TOLERANCE, 0);
int rmax = Math.min(r2+ TOLERANCE, 255);
int gmax = Math.min(g2+ TOLERANCE, 255);
int bmax = Math.min(b2+ TOLERANCE, 255);
return r1 >= rmin && r1 <= rmax &&
g1 >= gmin && g1 <= gmax &&
b1 >= bmin && b1 <= bmax;
int rmin = Math.max(r2-e, 0);
int gmin = Math.max(g2-e, 0);
int bmin = Math.max(b2-e, 0);
int rmax = Math.min(r2+e, 255);
int gmax = Math.min(g2+e, 255);
int bmax = Math.min(b2+e, 255);
if (r1 >= rmin && r1 <= rmax &&
g1 >= gmin && g1 <= gmax &&
b1 >= bmin && b1 <= bmax)
{
return true;
}
return false;
}
static CountDownLatch painted = new CountDownLatch(1);
static Frame frame = null;
public static void main(String[] args) {
if (args.length == 1 && args[0].equals("-verbose")) {
verbose = true;
}
GradientPaints test = new GradientPaints();
SwingUtilities.invokeLater(() -> {
frame = new Frame();
frame.add(test);
frame.pack();
frame.setVisible(true);
});
Frame frame = new Frame();
frame.add(test);
frame.pack();
frame.setVisible(true);
// Wait until the component's been painted
try {
painted.await();
} catch (InterruptedException e) {
throw new RuntimeException("Failed: Interrupted");
synchronized (test) {
while (!done) {
try {
test.wait();
} catch (InterruptedException e) {
throw new RuntimeException("Failed: Interrupted");
}
}
}
GraphicsConfiguration gc = frame.getGraphicsConfiguration();
@@ -310,9 +345,10 @@ public class GradientPaints extends Canvas {
BufferedImage refImg =
new BufferedImage(TESTW, TESTH, BufferedImage.TYPE_INT_RGB);
VolatileImage testImg = frame.createVolatileImage(TESTW, TESTH);
testImg.validate(gc);
try {
test.testAll(test.getGraphics(), refImg, testImg, gc);
test.testAll(test.getGraphics(), refImg, testImg);
} finally {
frame.dispose();
}

View File

@@ -24,7 +24,6 @@
/*
* @test
* @requires (os.family == "linux")
* @requires !display.XWayland
* @key headful
* @bug 8214112
* @summary Tests JPasswordField selected Text background color

View File

@@ -24,7 +24,6 @@
/*
* @test
* @requires (os.family == "linux")
* @requires !display.XWayland
* @key headful
* @bug 8218472
* @summary Tests JProgressBar highlight color

View File

@@ -24,7 +24,6 @@
/*
* @test
* @requires (os.family == "linux")
* @requires !display.XWayland
* @key headful
* @bug 8218469
* @summary Tests JSlider is rendered properly with gtk3

View File

@@ -24,7 +24,6 @@
/*
* @test
* @requires (os.family == "linux")
* @requires !display.XWayland
* @key headful
* @bug 8214112
* @summary Tests JSpinner selected Text background color

View File

@@ -24,7 +24,6 @@
/*
* @test
* @requires (os.family == "linux")
* @requires !display.XWayland
* @key headful
* @bug 8218479
* @summary Tests JTextPane background color

View File

@@ -24,7 +24,6 @@
/*
* @test
* @requires (os.family == "linux")
* @requires !display.XWayland
* @key headful
* @bug 8214253
* @summary Tests JToolTip background color

View File

@@ -32,23 +32,22 @@ import java.nio.file.Files;
* @summary Regression test for JBR-3671 Window order changes for a background app on macOS desktop space switch
* @key headful
* @requires (os.family == "mac")
* @compile MacSpacesUtil.java
* @run main BackgroundWindowOrderOnSpaceChange
*/
public class BackgroundWindowOrderOnSpaceChange {
private static Robot robot;
private static JFrame frame1;
private static JFrame frame2;
private static Process otherProcess;
public static void main(String[] args) throws Exception {
MacSpacesUtil.ensureMoreThanOneSpaceExists();
robot = new Robot();
try {
SwingUtilities.invokeAndWait(BackgroundWindowOrderOnSpaceChange::initUI);
launchProcessWithWindow();
MacSpacesUtil.switchToNextSpace();
MacSpacesUtil.switchToPreviousSpace();
Color color = new Robot().getPixelColor(400, 400);
switchToNextSpace();
switchToPreviousSpace();
Color color = robot.getPixelColor(400, 400);
if (!Color.green.equals(color)) {
throw new RuntimeException("Frame 1 isn't shown on top. Found color: " + color);
}
@@ -103,4 +102,20 @@ public class BackgroundWindowOrderOnSpaceChange {
throw new RuntimeException("Error starting process");
}
}
private static void switchToPreviousSpace() {
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.delay(1000); // wait for animation to finish
}
private static void switchToNextSpace() {
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_RIGHT);
robot.keyRelease(KeyEvent.VK_RIGHT);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.delay(1000); // wait for animation to finish
}
}

View File

@@ -42,9 +42,7 @@ import java.util.concurrent.TimeUnit;
* @requires (os.family == "mac")
* @modules java.desktop/com.apple.eawt
* java.desktop/com.apple.eawt.event
* @compile MacSpacesUtil.java
* @run main FullScreenChildWindow
*/
*/
public class FullScreenChildWindow {
private static final CompletableFuture<Boolean> shownAtFullScreen = new CompletableFuture<>();
@@ -57,12 +55,14 @@ public class FullScreenChildWindow {
public static void main(String[] args) throws Exception {
robot = new Robot();
robot.setAutoDelay(50); // without delay between key presses, 'switchToPreviousSpace' doesn't always work
try {
SwingUtilities.invokeAndWait(FullScreenChildWindow::initUI);
shownAtFullScreen.get(5, TimeUnit.SECONDS);
clickAt(button);
dialogShown.get(5, TimeUnit.SECONDS);
MacSpacesUtil.switchToPreviousSpace();
switchToPreviousSpace();
robot.delay(2000);
if (!frame1.isFocused()) {
throw new RuntimeException("Unexpected state");
}
@@ -120,4 +120,11 @@ public class FullScreenChildWindow {
Point location = component.getLocationOnScreen();
clickAt(location.x + component.getWidth() / 2, location.y + component.getHeight() / 2);
}
private static void switchToPreviousSpace() {
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_CONTROL);
}
}

View File

@@ -32,6 +32,7 @@ import java.awt.event.WindowEvent;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
/**
* @test
@@ -40,28 +41,24 @@ import java.util.concurrent.atomic.AtomicBoolean;
* @key headful
* @requires (os.family == "mac")
* @modules java.desktop/com.apple.eawt
* @compile MacSpacesUtil.java
* @run main FullScreenChildWindowShownBefore
*/
public class FullScreenChildWindowShownBefore {
private static final CompletableFuture<Boolean> dialogShown = new CompletableFuture<>();
private static Robot robot;
private static JFrame frame;
private static JDialog dialog;
public static void main(String[] args) throws Exception {
robot = new Robot();
try {
SwingUtilities.invokeAndWait(FullScreenChildWindowShownBefore::initUI);
dialogShown.get(5, TimeUnit.SECONDS);
SwingUtilities.invokeAndWait(() -> Application.getApplication().requestToggleFullScreen(frame));
Thread.sleep(1000); // wait for transition to full screen to finish
ensureVisible(frame, 250, 150);
ensureVisible(dialog, 250, 250);
SwingUtilities.invokeAndWait(() -> Application.getApplication().requestToggleFullScreen(frame));
Thread.sleep(1000); // wait for transition from full screen to finish
ensureVisible(frame, 250, 150);
ensureVisible(dialog, 250, 250);
robot.delay(1000); // wait for transition to full screen to finish
ensureVisible(frame);
ensureVisible(dialog);
} finally {
SwingUtilities.invokeAndWait(FullScreenChildWindowShownBefore::disposeUI);
}
@@ -69,7 +66,8 @@ public class FullScreenChildWindowShownBefore {
private static void initUI() {
frame = new JFrame("FullScreenChildWindowShownBefore");
frame.setBounds(100, 100, 300, 300);
frame.setSize(100, 100);
frame.setLocation(100, 100);
frame.setVisible(true);
dialog = new JDialog(frame, false);
@@ -79,7 +77,8 @@ public class FullScreenChildWindowShownBefore {
dialogShown.complete(true);
}
});
dialog.setBounds(200, 200, 100, 100);
dialog.setSize(100, 100);
dialog.setLocation(100, 300);
dialog.setVisible(true);
}
@@ -87,7 +86,38 @@ public class FullScreenChildWindowShownBefore {
if (frame != null) frame.dispose();
}
private static void ensureVisible(Window window, int x, int y) throws Exception {
if (!MacSpacesUtil.isWindowVisibleAtPoint(window, x, y)) throw new RuntimeException(window + " isn't visible");
private static void ensureVisible(Window window) throws Exception {
AtomicReference<Point> location = new AtomicReference<>();
AtomicBoolean movementDetected = new AtomicBoolean();
SwingUtilities.invokeAndWait(() -> {
if (window.isVisible()) {
Rectangle bounds = window.getBounds();
Insets insets = window.getInsets();
bounds.x += insets.left;
bounds.y += insets.top;
bounds.width -= insets.left + insets.right;
bounds.height -= insets.top + insets.bottom;
if (!bounds.isEmpty()) {
location.set(new Point((int) bounds.getCenterX(), (int) bounds.getCenterY()));
window.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
movementDetected.set(true);
}
});
}
}
});
Point target = location.get();
if (target != null) {
robot.mouseMove(target.x, target.y);
robot.delay(100);
robot.mouseMove(target.x + 1, target.y + 1);
robot.delay(1000);
if (movementDetected.get()) {
return;
}
}
throw new RuntimeException(window + " isn't visible");
}
}

View File

@@ -40,32 +40,32 @@ import java.util.concurrent.atomic.AtomicBoolean;
* @requires (os.family == "mac")
* @modules java.desktop/com.apple.eawt
* java.desktop/com.apple.eawt.event
* @compile MacSpacesUtil.java
* @run main FullScreenInactiveDialog
*/
public class FullScreenInactiveDialog {
private static final CompletableFuture<Boolean> shownAtFullScreen = new CompletableFuture<>();
private static Robot robot;
private static JFrame frame;
private static JDialog dialog;
public static void main(String[] args) throws Exception {
robot = new Robot();
robot.setAutoDelay(50); // without delay between key presses, 'switchToPreviousSpace' doesn't always work
try {
SwingUtilities.invokeAndWait(FullScreenInactiveDialog::initUI);
shownAtFullScreen.get(5, TimeUnit.SECONDS);
MacSpacesUtil.switchToPreviousSpace();
switchToPreviousSpace();
SwingUtilities.invokeLater(FullScreenInactiveDialog::openDialog);
Thread.sleep(1000);
if (MacSpacesUtil.isWindowVisible(dialog)) {
robot.delay(1000);
if (isWindowReallyShowing(dialog)) {
throw new RuntimeException("Dialog is showing earlier than expected");
}
Desktop.getDesktop().requestForeground(false); // simulates clicking on app icon in dock or switch using Cmd+Tab
Thread.sleep(1000); // wait for animation to finish
if (!MacSpacesUtil.isWindowVisible(dialog)) {
activateApp(); // simulates clicking on app icon in dock or switch using Cmd+Tab
if (!isWindowReallyShowing(dialog)) {
throw new RuntimeException("Dialog isn't showing when expected");
}
if (!MacSpacesUtil.isWindowVisible(frame)) {
if (!isWindowReallyShowing(frame)) {
throw new RuntimeException("Frame isn't showing when expected");
}
} finally {
@@ -97,4 +97,50 @@ public class FullScreenInactiveDialog {
private static void disposeUI() {
if (frame != null) frame.dispose();
}
private static void switchToPreviousSpace() {
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.delay(1000); // wait for animation to finish
}
private static void activateApp() {
Desktop.getDesktop().requestForeground(false);
robot.delay(1000); // wait for animation to finish
}
private static boolean isWindowReallyShowing(Window window) throws Exception {
Point[] location = new Point[1];
AtomicBoolean movementDetected = new AtomicBoolean();
SwingUtilities.invokeAndWait(() -> {
if (window.isVisible()) {
Rectangle bounds = window.getBounds();
Insets insets = window.getInsets();
bounds.x += insets.left;
bounds.y += insets.top;
bounds.width -= insets.left + insets.right;
bounds.height -= insets.top + insets.bottom;
if (!bounds.isEmpty()) {
location[0] = new Point(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
window.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
movementDetected.set(true);
}
});
}
}
});
Point target = location[0];
if (target == null) {
return false;
}
robot.mouseMove(target.x, target.y);
robot.delay(100);
robot.mouseMove(target.x + 1, target.y + 1);
robot.delay(1000);
return movementDetected.get();
}
}

View File

@@ -40,28 +40,29 @@ import java.util.concurrent.atomic.AtomicBoolean;
* @requires (os.family == "mac")
* @modules java.desktop/com.apple.eawt
* java.desktop/com.apple.eawt.event
* @compile MacSpacesUtil.java
* @run main FullScreenInactiveModalDialog
*/
public class FullScreenInactiveModalDialog {
private static final CompletableFuture<Boolean> shownAtFullScreen = new CompletableFuture<>();
private static Robot robot;
private static JFrame frame;
private static JDialog dialog;
public static void main(String[] args) throws Exception {
robot = new Robot();
robot.setAutoDelay(50); // without delay between key presses, 'switchToPreviousSpace'/'switchToNextSpace' don't always work
try {
SwingUtilities.invokeAndWait(FullScreenInactiveModalDialog::initUI);
shownAtFullScreen.get(5, TimeUnit.SECONDS);
MacSpacesUtil.switchToPreviousSpace();
switchToPreviousSpace();
SwingUtilities.invokeLater(FullScreenInactiveModalDialog::openDialog);
Thread.sleep(1000);
if (MacSpacesUtil.isWindowVisible(dialog)) {
robot.delay(1000);
if (isWindowReallyShowing(dialog)) {
throw new RuntimeException("Dialog is showing earlier than expected");
}
MacSpacesUtil.switchToNextSpace();
if (!MacSpacesUtil.isWindowVisible(dialog)) {
switchToNextSpace();
if (!isWindowReallyShowing(dialog)) {
throw new RuntimeException("Dialog isn't showing when expected");
}
} finally {
@@ -93,4 +94,53 @@ public class FullScreenInactiveModalDialog {
private static void disposeUI() {
if (frame != null) frame.dispose();
}
private static void switchToPreviousSpace() {
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.delay(1000); // wait for animation to finish
}
private static void switchToNextSpace() {
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_RIGHT);
robot.keyRelease(KeyEvent.VK_RIGHT);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.delay(1000); // wait for animation to finish
}
private static boolean isWindowReallyShowing(Window window) throws Exception {
Point[] location = new Point[1];
AtomicBoolean movementDetected = new AtomicBoolean();
SwingUtilities.invokeAndWait(() -> {
if (window.isVisible()) {
Rectangle bounds = window.getBounds();
Insets insets = window.getInsets();
bounds.x += insets.left;
bounds.y += insets.top;
bounds.width -= insets.left + insets.right;
bounds.height -= insets.top + insets.bottom;
if (!bounds.isEmpty()) {
location[0] = new Point(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
window.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
movementDetected.set(true);
}
});
}
}
});
Point target = location[0];
if (target == null) {
return false;
}
robot.mouseMove(target.x, target.y);
robot.delay(100);
robot.mouseMove(target.x + 1, target.y + 1);
robot.delay(1000);
return movementDetected.get();
}
}

View File

@@ -1,168 +0,0 @@
/*
* Copyright 2022 JetBrains s.r.o.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
public class MacSpacesUtil {
public static boolean hasMoreThanOneSpace() throws Exception {
return Runtime.getRuntime().exec(new String[]{
"plutil",
"-extract",
"SpacesDisplayConfiguration.Space Properties.1",
"json",
"-o",
"-",
System.getProperty("user.home") + "/Library/Preferences/com.apple.spaces.plist"
}).waitFor() == 0;
}
public static void addSpace() throws Exception {
toggleMissionControl();
// press button at top right corner to add a new space
int screenWidth = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
.getDefaultConfiguration().getBounds().width;
Robot robot = new Robot();
robot.setAutoDelay(50);
robot.mouseMove(screenWidth, 0);
robot.mouseMove(screenWidth - 5, 5);
robot.mouseMove(screenWidth - 10, 10);
robot.delay(1000);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(1000);
toggleMissionControl();
}
public static boolean isWindowVisibleAtPoint(Window window, int x, int y) throws Exception {
CountDownLatch movementDetected = new CountDownLatch(1);
MouseMotionListener listener = new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
movementDetected.countDown();
}
};
try {
SwingUtilities.invokeAndWait(() -> window.addMouseMotionListener(listener));
Robot robot = new Robot();
robot.mouseMove(x, y);
robot.delay(50);
robot.mouseMove(x + 1, y + 1);
return movementDetected.await(1, TimeUnit.SECONDS);
} finally {
SwingUtilities.invokeAndWait(() -> window.removeMouseMotionListener(listener));
}
}
public static boolean isWindowVisible(Window window) throws Exception {
Rectangle bounds = window.getBounds();
Insets insets = window.getInsets();
bounds.x += insets.left;
bounds.y += insets.top;
bounds.width -= insets.left + insets.right;
bounds.height -= insets.top + insets.bottom;
return isWindowVisibleAtPoint(window, bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
}
public static void verifyAdditionalSpaceExists() throws Exception {
AtomicReference<JFrame> frameRef = new AtomicReference<>();
try {
SwingUtilities.invokeAndWait(() -> {
JFrame f = new JFrame("Spaces check");
frameRef.set(f);
f.setBounds(100, 100, 200, 200);
f.setVisible(true);
Desktop.getDesktop().requestForeground(true);
});
if (!isWindowVisibleAtPoint(frameRef.get(), 200, 200)) {
throw new RuntimeException("Test frame not visible");
}
switchToNextSpace();
if (isWindowVisibleAtPoint(frameRef.get(), 200, 200)) {
throw new RuntimeException("Extra space isn't available");
}
} finally {
switchToPreviousSpace();
SwingUtilities.invokeAndWait(() -> {
JFrame f = frameRef.get();
if (f != null) f.dispose();
});
}
}
public static void toggleMissionControl() throws Exception {
Robot robot = new Robot();
robot.setAutoDelay(50);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_UP);
robot.keyRelease(KeyEvent.VK_UP);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.delay(1000); // wait for animation to finish
}
public static void switchToPreviousSpace() throws Exception {
Robot robot = new Robot();
robot.setAutoDelay(50);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.delay(1000); // wait for animation to finish
}
public static void switchToNextSpace() throws Exception {
Robot robot = new Robot();
robot.setAutoDelay(50);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_RIGHT);
robot.keyRelease(KeyEvent.VK_RIGHT);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.delay(1000); // wait for animation to finish
}
// press Control+Right while holding mouse pressed over window's header
public static void moveWindowToNextSpace(Window window) throws Exception {
Robot robot = new Robot();
robot.setAutoDelay(50);
Point location = window.getLocationOnScreen();
robot.mouseMove(location.x + window.getWidth() / 2, location.y + window.getInsets().top / 2);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
switchToNextSpace();
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
}
public static void ensureMoreThanOneSpaceExists() throws Exception {
if (hasMoreThanOneSpace()) return;
addSpace();
verifyAdditionalSpaceExists();
}
}

View File

@@ -1,81 +0,0 @@
/*
* Copyright 2022 JetBrains s.r.o.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* @test
* @summary Regression test for JBR-4186 Unexpected desktop switch after moving a window to another desktop
* @key headful
* @requires (os.family == "mac")
* @compile MacSpacesUtil.java
* @run main ParentMovingToAnotherSpace
*/
public class ParentMovingToAnotherSpace {
private static JFrame frame1;
private static JFrame frame2;
public static void main(String[] args) throws Exception {
MacSpacesUtil.ensureMoreThanOneSpaceExists();
try {
SwingUtilities.invokeAndWait(ParentMovingToAnotherSpace::initUI);
Thread.sleep(1000); // wait for windows to appear
MacSpacesUtil.moveWindowToNextSpace(frame2);
if (MacSpacesUtil.isWindowVisible(frame1)) {
throw new RuntimeException("Space switch didn't work");
}
if (!MacSpacesUtil.isWindowVisible(frame2)) {
throw new RuntimeException("Frame isn't showing when expected");
}
} finally {
MacSpacesUtil.switchToPreviousSpace();
SwingUtilities.invokeAndWait(ParentMovingToAnotherSpace::disposeUI);
}
}
private static void initUI() {
frame1 = new JFrame("ParentMovingToAnotherSpace-1");
frame1.setBounds(100, 100, 300, 100);
frame1.setVisible(true);
frame2 = new JFrame("ParentMovingToAnotherSpace-2");
frame2.setBounds(100, 300, 300, 100);
frame2.setVisible(true);
JWindow window = new JWindow(frame2);
window.setBounds(100, 500, 300, 100);
window.setVisible(true);
}
private static void disposeUI() {
if (frame1 != null) frame1.dispose();
if (frame2 != null) frame2.dispose();
}
}

View File

@@ -1,110 +0,0 @@
/*
* Copyright 2000-2022 JetBrains s.r.o.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* @test
* @summary Specific case for JBR-4186 Unexpected desktop switch after moving a window to another desktop
* @key headful
* @requires (os.family == "mac")
* @compile MacSpacesUtil.java
* @run main TwoFramesAndDialogOnDifferentSpaces
*/
public class TwoFramesAndDialogOnDifferentSpaces {
private static Robot robot;
private static JFrame frame1;
private static JFrame frame2;
private static JDialog dialog;
public static void main(String[] args) throws Exception {
MacSpacesUtil.ensureMoreThanOneSpaceExists();
robot = new Robot();
try {
SwingUtilities.invokeAndWait(TwoFramesAndDialogOnDifferentSpaces::initUI);
robot.delay(1000);
ensureVisibility(true, true, true);
MacSpacesUtil.moveWindowToNextSpace(frame1);
ensureVisibility(true, false, false);
MacSpacesUtil.switchToPreviousSpace();
ensureVisibility(false, true, true);
clickOn(frame2);
robot.delay(1000);
MacSpacesUtil.switchToNextSpace();
ensureVisibility(true, false, false);
} finally {
MacSpacesUtil.switchToPreviousSpace();
SwingUtilities.invokeAndWait(TwoFramesAndDialogOnDifferentSpaces::disposeUI);
}
}
private static void initUI() {
frame1 = new JFrame("TFADODS-1");
frame1.setBounds(200, 200, 300, 100);
frame1.setVisible(true);
frame2 = new JFrame("TFADODS-2");
frame2.setBounds(200, 400, 300, 100);
frame2.setVisible(true);
dialog = new JDialog(frame2, "TFADODS");
dialog.setBounds(200, 600, 300, 100);
dialog.setVisible(true);
}
private static void disposeUI() {
if (frame1 != null) frame1.dispose();
if (frame2 != null) frame2.dispose();
}
private static void ensureVisibility(boolean frame1Visible, boolean frame2Visible, boolean dialogVisible)
throws Exception {
if (frame1Visible != MacSpacesUtil.isWindowVisible(frame1)) {
throw new RuntimeException("Frame 1 is " + (frame1Visible ? "not " : "") + " visible");
}
if (frame2Visible != MacSpacesUtil.isWindowVisible(frame2)) {
throw new RuntimeException("Frame 2 is " + (frame2Visible ? "not " : "") + " visible");
}
if (dialogVisible != MacSpacesUtil.isWindowVisible(dialog)) {
throw new RuntimeException("Dialog is " + (dialogVisible ? "not " : "") + " visible");
}
}
private static void clickAt(int x, int y) {
robot.mouseMove(x, y);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
}
private static void clickOn(Component component) {
Point location = component.getLocationOnScreen();
clickAt(location.x + component.getWidth() / 2, location.y + component.getHeight() / 2);
}
}

View File

@@ -24,17 +24,17 @@ import java.util.concurrent.TimeUnit;
/**
* @test
* @summary Regression test for JBR-4207 ensures that pressing each layout-free key + AltGr produces AltGr modifier
* @summary Regression test for JBR-3838 ensures that pressing each layout-free key + AltGr produces AltGr modifier
* @requires (os.family == "windows")
* @key headful
* @run main AltGrMustGenerateAltGrModifierTest4207
* @run main AltGrMustGenerateAltGrModifierTest3838
* @author Nikita Provotorov
*/
public class AltGrMustGenerateAltGrModifierTest4207 extends Frame {
public class AltGrMustGenerateAltGrModifierTest3838 extends Frame {
public static void main(String[] args) throws Exception
{
final AltGrMustGenerateAltGrModifierTest4207 mainWindow = new AltGrMustGenerateAltGrModifierTest4207();
final AltGrMustGenerateAltGrModifierTest3838 mainWindow = new AltGrMustGenerateAltGrModifierTest3838();
try {
mainWindow.setVisible(true);
@@ -63,7 +63,7 @@ public class AltGrMustGenerateAltGrModifierTest4207 extends Frame {
}
private AltGrMustGenerateAltGrModifierTest4207()
private AltGrMustGenerateAltGrModifierTest3838()
{
super("AltGr must generate AltGr modifier");
@@ -178,7 +178,7 @@ public class AltGrMustGenerateAltGrModifierTest4207 extends Frame {
// Sometimes top-level Frame does not get focus when requestFocus is called.
// For example, when this test is launched after test/.../bug6361367.java:
// jtreg test/jdk/javax/swing/text/JTextComponent/6361367/bug6361367.java test/jdk/jb/java/awt/keyboard/AltGrMustGenerateAltGrModifierTest4207.java
// jtreg test/jdk/javax/swing/text/JTextComponent/6361367/bug6361367.java test/jdk/jb/java/awt/keyboard/AltGrMustGenerateAltGrModifierTest3838.java
//
// So this method forces the focus acquiring via mouse clicking to the component.
private static void forceFocusTo(final Component component, final Robot robot) {

View File

@@ -35,20 +35,20 @@ public enum Layout_ABC implements LayoutKey {
// located on the left side of the key 1 on the Apple International English keyboard
// SECTION ('§', '§', '±', '±'),
VK_MINUS ('-', '', '_', '—', '\u001F'),
VK_EQUALS ('=', '≠', '+', '±', '='),
VK_MINUS ('-', '', '_', '—'),
VK_EQUALS ('=', '≠', '+', '±'),
VK_OPEN_BRACKET ('[', '“', '{', '”', '\u001B'),
VK_CLOSE_BRACKET (']', '', '}', '', '\u001D'),
VK_OPEN_BRACKET ('[', '“', '{', '”'),
VK_CLOSE_BRACKET (']', '', '}', ''),
VK_SEMICOLON (';', '…', ':', 'Ú', ';'),
VK_QUOTE ('\'', 'æ', '"', 'Æ', '\''),
VK_BACK_SLASH ('\\', '«', '|', '»', '\u001C'),
VK_SEMICOLON (';', '…', ':', 'Ú'),
VK_QUOTE ('\'', 'æ', '"', 'Æ'),
VK_BACK_SLASH ('\\', '«', '|', '»'),
VK_BACK_QUOTE (KeyChar.ch('`'), KeyChar.dead('`'), KeyChar.ch('~'), KeyChar.ch('`'), KeyChar.ch('`')),
VK_COMMA (',', '≤', '<', '¯', ','),
VK_PERIOD ('.', '≥', '>', '˘', '.'),
VK_SLASH ('/', '÷', '?', '¿', '/'),
VK_BACK_QUOTE (KeyChar.ch('`'), KeyChar.dead('`'), KeyChar.ch('~'), KeyChar.ch('`')),
VK_COMMA (',', '≤', '<', '¯'),
VK_PERIOD ('.', '≥', '>', '˘'),
VK_SLASH ('/', '÷', '?', '¿'),
//VK_1 ('1', '¡', '!', ''),
//VK_2 ('2', '™', '@', '€'),
@@ -99,12 +99,12 @@ public enum Layout_ABC implements LayoutKey {
private final Key key;
Layout_ABC(char no, char alt, char shift, char alt_shift, char control) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift, control));
Layout_ABC(char no, char alt, char shift, char alt_shift) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
}
Layout_ABC(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift, KeyChar control) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift, control));
Layout_ABC(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
}
public Key getKey() {

View File

@@ -30,20 +30,20 @@ public enum Layout_FRENCH_PC implements LayoutKey {
// Enum name must be the same as KeyEvent.VK_ constant name corresponding to the key on US keyboard layout
// Note that '\u0000' may be used if no char is mapped to a key + modifier or if one wants to skip its testing
VK_MINUS (')', ']', '°', ']', '\u001B'),
VK_EQUALS ('=', '}', '+', '≠', '\u001F'),
VK_MINUS (')', ']', '°', ']'),
VK_EQUALS ('=', '}', '+', '≠'),
VK_OPEN_BRACKET (KeyChar.dead('^'), KeyChar.ch('ô'), KeyChar.dead('¨'), KeyChar.ch('Ô'), KeyChar.ch('\u001E')),
VK_CLOSE_BRACKET ('$', '¤', '£', '¥', '\u001D'),
VK_OPEN_BRACKET (KeyChar.dead('^'), KeyChar.ch('ô'), KeyChar.dead('¨'), KeyChar.ch('Ô')),
VK_CLOSE_BRACKET ('$', '¤', '£', '¥'),
VK_SEMICOLON ('m', 'µ', 'M', 'Ó', '\r'),
VK_QUOTE ('ù', 'Ù', '%', '‰', 'ù'),
VK_BACK_SLASH ('*', '@', 'μ', '#', '\u001C'),
VK_SEMICOLON ('m', 'µ', 'M', 'Ó'),
VK_QUOTE ('ù', 'Ù', '%', '‰'),
VK_BACK_SLASH ('*', '@', 'μ', '#'),
VK_BACK_QUOTE ('<', '«', '>', '≥', '<'),
VK_COMMA (';', '…', '.', '•', ';'),
VK_PERIOD (':', '÷', '/', '\\', ':'),
VK_SLASH ('!', '¡', '§', '±', '='),
VK_BACK_QUOTE ('<', '«', '>', '≥'),
VK_COMMA (';', '…', '.', '•'),
VK_PERIOD (':', '÷', '/', '\\'),
VK_SLASH ('!', '¡', '§', '±'),
;
@@ -51,12 +51,12 @@ public enum Layout_FRENCH_PC implements LayoutKey {
private final Key key;
Layout_FRENCH_PC(char no, char alt, char shift, char alt_shift, char control) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift, control));
Layout_FRENCH_PC(char no, char alt, char shift, char alt_shift) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
}
Layout_FRENCH_PC(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift, KeyChar control) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift, control));
Layout_FRENCH_PC(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
}
public Key getKey() {

View File

@@ -31,20 +31,20 @@ public enum Layout_GERMAN implements LayoutKey {
// Note that '\u0000' may be used if no char is mapped to a key + modifier or if one wants to skip its testing
// Eszett
VK_MINUS ('ß', '¿', '?', '˙', 'ß'),
VK_EQUALS (KeyChar.dead('´'), KeyChar.ch('\''), KeyChar.dead('`'), KeyChar.ch('˚'), KeyChar.ch('´')),
VK_MINUS ('ß', '¿', '?', '˙'),
VK_EQUALS (KeyChar.dead('´'), KeyChar.ch('\''), KeyChar.dead('`'), KeyChar.ch('˚')),
VK_OPEN_BRACKET ('ü', '•', 'Ü', '°', '\u001D'),
VK_CLOSE_BRACKET ('+', '±', '*', '', '+'),
VK_OPEN_BRACKET ('ü', '•', 'Ü', '°'),
VK_CLOSE_BRACKET ('+', '±', '*', ''),
VK_SEMICOLON ('ö', 'œ', 'Ö', 'Œ', '\u001C'),
VK_QUOTE ('ä', 'æ', 'Ä', 'Æ', '\u001B'),
VK_BACK_SLASH ('#', '', '\'', '', '#'),
VK_SEMICOLON ('ö', 'œ', 'Ö', 'Œ'),
VK_QUOTE ('ä', 'æ', 'Ä', 'Æ'),
VK_BACK_SLASH ('#', '', '\'', ''),
VK_BACK_QUOTE ('<', '≤', '>', '≥', '<'),
VK_COMMA (',', '∞', ';', '˛', ','),
VK_PERIOD ('.', '…', ':', '÷', '.'),
VK_SLASH ('-', '', '_', '—', '-'),
VK_BACK_QUOTE ('<', '≤', '>', '≥'),
VK_COMMA (',', '∞', ';', '˛'),
VK_PERIOD ('.', '…', ':', '÷'),
VK_SLASH ('-', '', '_', '—'),
;
@@ -52,12 +52,12 @@ public enum Layout_GERMAN implements LayoutKey {
private final Key key;
Layout_GERMAN(char no, char alt, char shift, char alt_shift, char control) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift, control));
Layout_GERMAN(char no, char alt, char shift, char alt_shift) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
}
Layout_GERMAN(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift, KeyChar control) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift, control));
Layout_GERMAN(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
}
public Key getKey() {

View File

@@ -30,20 +30,20 @@ public enum Layout_SPANISH_ISO implements LayoutKey {
// Enum name must be the same as KeyEvent.VK_ constant name corresponding to the key on US keyboard layout
// Note that '\u0000' may be used if no char is mapped to a key + modifier or if one wants to skip its testing
VK_MINUS ('\'', '´', '?', '¸', '\u001F'),
VK_EQUALS ('¡', '', '¿', '˛', '='),
VK_MINUS ('\'', '´', '?', '¸'),
VK_EQUALS ('¡', '', '¿', '˛'),
VK_OPEN_BRACKET (KeyChar.dead('`'), KeyChar.ch('['), KeyChar.dead('^'), KeyChar.ch('ˆ'), KeyChar.ch('\u001B')),
VK_CLOSE_BRACKET ('+', ']', '*', '±', '\u001D'),
VK_OPEN_BRACKET (KeyChar.dead('`'), KeyChar.ch('['), KeyChar.dead('^'), KeyChar.ch('ˆ')),
VK_CLOSE_BRACKET ('+', ']', '*', '±'),
VK_SEMICOLON (KeyChar.ch('ñ'), KeyChar.dead('~'), KeyChar.ch('Ñ'), KeyChar.ch('˜'), KeyChar.ch(':')),
VK_QUOTE (KeyChar.dead('´'), KeyChar.ch('{'), KeyChar.dead('¨'), KeyChar.ch('«'), KeyChar.ch('"')),
VK_BACK_SLASH ('ç', '}', 'Ç', '»', '\u001C'),
VK_SEMICOLON (KeyChar.ch('ñ'), KeyChar.dead('~'), KeyChar.ch('Ñ'), KeyChar.ch('˜')),
VK_QUOTE (KeyChar.dead('´'), KeyChar.ch('{'), KeyChar.dead('¨'), KeyChar.ch('«')),
VK_BACK_SLASH ('ç', '}', 'Ç', '»'),
VK_BACK_QUOTE ('<', '≤', '>', '≥', '`'),
VK_COMMA (',', '„', ';', '\u0000', ','),
VK_PERIOD ('.', '…', ':', '…', '.'),
VK_SLASH ('-', '', '_', '—', '/'),
VK_BACK_QUOTE ('<', '≤', '>', '≥'),
VK_COMMA (',', '„', ';', '\u0000'),
VK_PERIOD ('.', '…', ':', '…'),
VK_SLASH ('-', '', '_', '—'),
;
@@ -51,12 +51,12 @@ public enum Layout_SPANISH_ISO implements LayoutKey {
private final Key key;
Layout_SPANISH_ISO(char no, char alt, char shift, char alt_shift, char control) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift, control));
Layout_SPANISH_ISO(char no, char alt, char shift, char alt_shift) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
}
Layout_SPANISH_ISO(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift, KeyChar control) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift, control));
Layout_SPANISH_ISO(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
}
public Key getKey() {

View File

@@ -30,21 +30,21 @@ public enum Layout_US_INTERNATIONAL_PC implements LayoutKey {
// Enum name must be the same as KeyEvent.VK_ constant name corresponding to the key on US keyboard layout
// Note that '\u0000' may be used if no char is mapped to a key + modifier or if one wants to skip its testing
VK_MINUS ('-', '', '_', '—', '\u001F'),
VK_EQUALS ('=', '≠', '+', '±', '='),
VK_MINUS ('-', '', '_', '—'),
VK_EQUALS ('=', '≠', '+', '±'),
VK_OPEN_BRACKET ('[', '“', '{', '”', '\u001B'),
VK_CLOSE_BRACKET (']', '', '}', '', '\u001D'),
VK_OPEN_BRACKET ('[', '“', '{', '”'),
VK_CLOSE_BRACKET (']', '', '}', ''),
VK_SEMICOLON (';', '…', ':', 'Ú', ';'),
VK_SEMICOLON (';', '…', ':', 'Ú'),
// ' is a special dead symbol, which may add either acute or cedilla to the next key
VK_QUOTE (KeyChar.dead('\''), KeyChar.ch('æ'), KeyChar.dead('\"'), KeyChar.ch('Æ'), KeyChar.ch('\'')),
VK_BACK_SLASH ('\\', '«', '|', '»', '\u001C'),
VK_QUOTE (KeyChar.dead('\''), KeyChar.ch('æ'), KeyChar.dead('\"'), KeyChar.ch('Æ')),
VK_BACK_SLASH ('\\', '«', '|', '»'),
VK_BACK_QUOTE (KeyChar.dead('`'), KeyChar.dead('`'), KeyChar.dead('~'), KeyChar.ch('`'), KeyChar.ch('`')),
VK_COMMA (',', '≤', '<', '¯', ','),
VK_PERIOD ('.', '≥', '>', '˘', '.'),
VK_SLASH ('/', '÷', '?', '¿', '/'),
VK_BACK_QUOTE (KeyChar.dead('`'), KeyChar.dead('`'), KeyChar.dead('~'), KeyChar.ch('`')),
VK_COMMA (',', '≤', '<', '¯'),
VK_PERIOD ('.', '≥', '>', '˘'),
VK_SLASH ('/', '÷', '?', '¿'),
;
@@ -52,12 +52,12 @@ public enum Layout_US_INTERNATIONAL_PC implements LayoutKey {
private final Key key;
Layout_US_INTERNATIONAL_PC(char no, char alt, char shift, char alt_shift, char control) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift, control));
Layout_US_INTERNATIONAL_PC(char no, char alt, char shift, char alt_shift) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
}
Layout_US_INTERNATIONAL_PC(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift, KeyChar control) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift, control));
Layout_US_INTERNATIONAL_PC(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
}
public Key getKey() {

View File

@@ -23,22 +23,20 @@ public class MappedKeyChars {
private final KeyChar alt;
private final KeyChar shift;
private final KeyChar alt_shift;
private final KeyChar control;
MappedKeyChars(char no_modifier, char alt, char shift, char alt_shift, char control) {
MappedKeyChars(char no_modifier, char alt, char shift, char alt_shift) {
this.no_modifier = KeyChar.ch(no_modifier);
this.alt = KeyChar.ch(alt);
this.shift = KeyChar.ch(shift);
this.alt_shift = KeyChar.ch(alt_shift);
this.control = KeyChar.ch(control);
}
MappedKeyChars(KeyChar no_modifier, KeyChar alt, KeyChar shift, KeyChar alt_shift, KeyChar control) {
MappedKeyChars(KeyChar no_modifier, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
this.no_modifier = no_modifier;
this.alt = alt;
this.shift = shift;
this.alt_shift = alt_shift;
this.control = control;
}
/*
@@ -59,9 +57,6 @@ public class MappedKeyChars {
if(modifier.isAltShift()) {
return alt_shift;
}
if(modifier.isControl()) {
return control;
}
return KeyChar.ch(Character.MAX_VALUE);
}

View File

@@ -94,10 +94,6 @@ public enum Modifier {
return ((modifiers.length == 2) && list.contains(KeyEvent.VK_ALT) && list.contains(KeyEvent.VK_SHIFT));
}
boolean isControl() {
return ((modifiers.length == 1) && (modifiers[0] == KeyEvent.VK_CONTROL));
}
@Override
public String toString() {
if (modifiers.length == 0) {

View File

@@ -57,9 +57,7 @@ import java.util.stream.Collectors;
* - No keyTyped event is expected as the result of pressing dead key + key.
* - Pressing "dead key + space" generates corresponding diacritic character,
* which may be obtained using inputMethodTextChanged event.
* - Ctrl can be used to type the "control characters" (0th to 31th character inclusively in the ASCII table),
* so Ctrl + key can generate keyTyped event.
* - Cmd and its combinations with other modifiers are considered as a "shortcut",
* - Cmd, Ctrl and its combinations with other modifiers are considered as a "shortcut",
* no keyTyped event is expected as the result of pressing a shortcut,
* no attempts are made to check inputMethodTextChanged event result for a "shortcut".
*
@@ -184,7 +182,7 @@ public class NationalLayoutTest {
for (Modifier modifier : Modifier.values()) {
if(!testLayout(layout, modifier)) {
failed = true;
}
};
}
}
// Provide the test result
@@ -255,7 +253,7 @@ public class NationalLayoutTest {
// Corresponding latch is released in the typeAreaFocusListener.
if(!typeAreaGainedFocus.await(PAUSE, TimeUnit.MILLISECONDS)) {
throw new RuntimeException("TEST ERROR: Failed to request focus in the text area for typing");
}
};
}
/*
@@ -307,21 +305,9 @@ public class NationalLayoutTest {
// Obtain typed char
char keyChar = e.getKeyChar();
int keyCode = KeyEvent.getExtendedKeyCodeForChar(keyChar);
switch (keyCode) {
case NEXT_MODIFIER:
case NEXT_KEY:
case TERMINATE_KEY:
if ((e.getModifiers() & KeyEvent.CTRL_MASK) == 0) {
// Do not store the typed char only if it is NEXT_MODIFIER, NEXT_KEY, TERMINATE_KEY generated
// without Control modifier: the Control allows to "type" the "control characters"
// (0th to 31th character inclusively in the ASCII table).
break;
}
default:
// Store typed char to the corresponding list
charsTyped.add(keyChar);
break;
if ((keyCode != NEXT_MODIFIER) && (keyCode != NEXT_KEY) && (keyCode != TERMINATE_KEY)) {
// Store typed char to the corresponding list
charsTyped.add(keyChar);
}
}
};
@@ -370,7 +356,7 @@ public class NationalLayoutTest {
}
if(!nextModifierSet.await(PAUSE*10, TimeUnit.MILLISECONDS)) {
throw new RuntimeException("TEST ERROR: User has not proceeded with manual testing");
}
};
// Clean up the test text areas
inputArea.setText("");
@@ -425,7 +411,7 @@ public class NationalLayoutTest {
if(!nextKey.await(PAUSE, TimeUnit.MILLISECONDS)) {
throw new RuntimeException("TEST ERROR: "
+ KeyEvent.getKeyText(NEXT_KEY) + " key pressed event was not received");
}
};
// Define array of key codes expected to be pressed as the result of modifiers + key
int[] keysPattern = Arrays.copyOf(modifiers, modifiers.length + 1);
@@ -440,7 +426,7 @@ public class NationalLayoutTest {
// Check if the pressed key codes are equal to the expected ones
if(!checkResult(keysPattern, keysResult, null,null)) {
result = false;
}
};
} else {
// Define array of chars expected to be typed as the result of modifiers + key
// Do not expect any char typed as the result of shortcut (char is undefined in this case)
@@ -454,7 +440,7 @@ public class NationalLayoutTest {
// Check if pressed key codes and typed chars are equal to the expected ones
if(!checkResult(keysPattern, keysResult, charsPattern, charsResult)) {
result = false;
}
};
}
}
// Provide layout + modifier testing result
@@ -487,7 +473,7 @@ public class NationalLayoutTest {
boolean checkKeys = Arrays.equals(patternKeys, resultKeys);
boolean checkChars = Arrays.equals(patternChars, resultChars);
boolean result = (checkKeys && checkChars);
boolean result = (checkKeys & checkChars);
if(!result) {
String[] patternStr = (patternKeys != null) ? intsToStrings(patternKeys) : null;

View File

@@ -672,7 +672,6 @@ com/sun/nio/sctp/SctpChannel/SocketOptionTests.java 8141694 linux-al
# jdk_security
sun/security/pkcs11/Signature/TestDSAKeyLength.java 8279941 generic-all
sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8161536 generic-all
sun/security/tools/keytool/ListKeychainStore.sh 8156889 macosx-all
@@ -932,10 +931,4 @@ java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.java
java/awt/dnd/FileListBetweenJVMsTest/FileListBetweenJVMsTest.java JBR-1011 macosx-all
com/sun/java/swing/plaf/windows/Test8173145.java JBR-4197 windows-all
com/sun/java/swing/plaf/windows/AltFocusIssueTest.java JBR-4197 windows-all
java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java JBR-4207 windows-all
jb/java/awt/keyboard/AltGrMustGenerateAltGrModifierTest4207.java JBR-4207 windows-all
java/awt/Dialog/NonResizableDialogSysMenuResize/NonResizableDialogSysMenuResize.java TBD windows-all
java/awt/Dialog/NestedDialogs/Modeless/NestedModelessDialogTest.java TBD windows-all
com/sun/java/swing/plaf/windows/AltFocusIssueTest.java JBR-4197 windows-all

View File

@@ -2,4 +2,4 @@
sun/java2d/ClassCastExceptionForInvalidSurface.java JBR-3167 linux-all
java/awt/Frame/HugeFrame/HugeFrame.java JBR-3167 linux-all
java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowBlockingTest.java 8279256 linux-all
java/awt/Frame/FrameSetSizeStressTest/FrameSetSizeStressTest.java JBR-4223 linux-all
sun/security/pkcs11/Signature/TestDSAKeyLength.java 8279941 linux-all

View File

@@ -1 +0,0 @@
javax/imageio/plugins/external_plugin_tests/TestClassPathPlugin.sh nobug generic-all line 59: /opt/teamcity-agent/work/efb45cc305c2e813/jbr/Contents/Home/bin/jar: No such file or directory