提交 27d3f533 编写于 作者: A andrew

8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.

Reviewed-by: alanb, peytoia, naoto, phh
上级 55983072
......@@ -379,12 +379,16 @@ needs_jre = \
java/net/URLConnection/HandleContentTypeWithAttrs.java \
java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh \
java/security/Security/ClassLoaderDeadlock/Deadlock.sh \
java/text/AttributedCharacterIterator/Attribute/ReadResolve.java \
java/text/AttributedString/TestAttributedStringCtor.java \
java/text/AttributedString/getRunStartLimitTest.java \
java/util/jar/Manifest/CreateManifest.java \
java/util/logging/Listeners.java \
java/util/logging/ListenersWithSM.java \
java/util/logging/TestMainAppContext.java \
java/util/logging/TestLoggingWithMainAppContext.java \
java/util/ResourceBundle/Control/Bug6530694.java \
java/util/TimeZone/DefaultTimeZoneTest.java \
java/text/Bidi/BidiConformance.java \
java/text/Bidi/BidiEmbeddingTest.java \
java/text/Bidi/Bug7042148.java \
......@@ -590,6 +594,7 @@ needs_compact2 = \
java/util/Collections/UnmodifiableMapEntrySet.java \
java/util/Comparator/BasicTest.java \
java/util/Comparator/TypeTest.java \
java/util/Date/TimestampTest.java \
java/util/Iterator/IteratorDefaults.java \
java/util/Iterator/PrimitiveIteratorDefaults.java \
java/util/List/ListDefaults.java \
......
/*
* Copyright (c) 1998, 2016, 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
* 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 4108453 4778440 6304780 6396378
* @summary Basic tests for java.awt.ComponentOrientation
* @build TestBundle TestBundle_es TestBundle_iw
* @build TestBundle1 TestBundle1_ar
*
* @run main BasicTest
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation is copyrighted
* and owned by IBM, Inc. These materials are provided under terms of a
* License Agreement between IBM and Sun. This technology is protected by
* multiple US and International patents. This notice and attribution to IBM
* may not be removed.
*/
import java.awt.ComponentOrientation;
import java.util.Locale;
import java.util.ResourceBundle;
public class BasicTest {
public static void main(String args[]) {
System.out.println("BasicTest {");
TestInvariants();
TestLocale();
TestBundle();
System.out.println("} Pass");
}
// TestInvariants
//
// Various no-brainer tests to make sure the constants behave properly
// and so on.
//
static void TestInvariants() {
System.out.println(" TestInvariants {");
Assert(ComponentOrientation.LEFT_TO_RIGHT.isLeftToRight(),
"LEFT_TO_RIGHT.isLeftToRight()");
Assert(ComponentOrientation.UNKNOWN.isLeftToRight(),
"UNKNOWN.isLeftToRight()");
Assert(!ComponentOrientation.RIGHT_TO_LEFT.isLeftToRight(),
"!RIGHT_TO_LEFT.isLeftToRight()");
Assert(ComponentOrientation.LEFT_TO_RIGHT.isHorizontal(),
"LEFT_TO_RIGHT.isHorizontal()");
Assert(ComponentOrientation.UNKNOWN.isHorizontal(),
"UNKNOWN.isHorizontal()");
Assert(ComponentOrientation.RIGHT_TO_LEFT.isHorizontal(),
"RIGHT_TO_LEFT.isHorizontal()");
System.out.println(" } Pass");
}
// TestLocale
//
// Make sure that getOrientation(Locale) works, and that the appropriate
// system locales are RIGHT_TO_LEFT
//
static void TestLocale() {
System.out.println(" TestLocale {");
ComponentOrientation orient = ComponentOrientation.getOrientation(Locale.US);
Assert(orient == ComponentOrientation.LEFT_TO_RIGHT, "US == LEFT_TO_RIGHT");
orient = ComponentOrientation.getOrientation(new Locale("iw", ""));
Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "iw == RIGHT_TO_LEFT");
orient = ComponentOrientation.getOrientation(new Locale("ar", ""));
Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "ar == RIGHT_TO_LEFT");
System.out.println(" } Pass");
}
// TestBundle
//
// Make sure that getOrientation(ResourceBundle) works right, especially
// the fallback mechasm
//
static void TestBundle() {
System.out.println(" TestBundle {");
// This will fall back to the default locale's bundle or root bundle
ResourceBundle rb = ResourceBundle.getBundle("TestBundle",
new Locale("et", ""));
if (rb.getLocale().getLanguage().equals(new Locale("iw").getLanguage())) {
assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "et == RIGHT_TO_LEFT" );
} else if (rb.getLocale().getLanguage() == "es") {
assertEquals(rb, ComponentOrientation.LEFT_TO_RIGHT, "et == LEFT_TO_RIGHT" );
} else {
assertEquals(rb, ComponentOrientation.UNKNOWN, "et == UNKNOWN" );
}
// We have actual bundles for "es" and "iw", so it should just fetch
// the orientation object out of them
rb = ResourceBundle.getBundle("TestBundle",new Locale("es", ""));
assertEquals(rb, ComponentOrientation.LEFT_TO_RIGHT, "es == LEFT_TO_RIGHT" );
rb = ResourceBundle.getBundle("TestBundle", new Locale("iw", "IL"));
assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "iw == RIGHT_TO_LEFT" );
// This bundle has no orientation setting at all, so we should get
// the system's default orientation for Arabic
rb = ResourceBundle.getBundle("TestBundle1", new Locale("ar", ""));
assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "ar == RIGHT_TO_LEFT" );
System.out.println(" } Pass");
}
static void assertEquals(ResourceBundle rb, ComponentOrientation o, String str) {
Assert(ComponentOrientation.getOrientation(rb) == o, str);
}
static void Assert(boolean condition, String str) {
if (!condition) {
System.err.println(" ASSERT FAILED: " + str);
throw new RuntimeException("Assert Failed: " + str);
}
}
}
/*
* Copyright (c) 1998, 2016, 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
* 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 4108453
* @summary Test ComponentOrientation (Bidi) support in BorderLayout
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation is copyrighted
* and owned by IBM, Inc. These materials are provided under terms of a
* License Agreement between IBM and Sun. This technology is protected by
* multiple US and International patents. This notice and attribution to IBM
* may not be removed.
*/
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class BorderTest extends Applet {
Panel panel1;
Panel panel2;
public BorderTest() {
setLayout(new GridLayout(0,2));
// Create a panel with a BorderLayout and a bunch of buttons in it
panel1 = new Panel();
panel1.setLayout(new BorderLayout());
panel1.add("North", new Button("North"));
panel1.add("South", new Button("South"));
panel1.add("East", new Button("East"));
panel1.add("West", new Button("West"));
panel1.add("Center", new Button("Center"));
add(panel1);
// Create a panel with a BorderLayout and a bunch of buttons in it
panel2 = new Panel();
panel2.setLayout(new BorderLayout());
panel2.add(BorderLayout.BEFORE_FIRST_LINE, new Button("FirstLine"));
panel2.add(BorderLayout.AFTER_LAST_LINE, new Button("LastLine"));
panel2.add(BorderLayout.BEFORE_LINE_BEGINS, new Button("FirstItem"));
panel2.add(BorderLayout.AFTER_LINE_ENDS, new Button("LastItem"));
panel2.add("Center", new Button("Center"));
add(panel2);
// Create a popup menu for switching between orientations
{
Choice c = new Choice();
c.addItem("LEFT_TO_RIGHT");
c.addItem("RIGHT_TO_LEFT");
c.addItem("UNKNOWN");
c.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
String item = (String)(e.getItem());
ComponentOrientation o = ComponentOrientation.UNKNOWN;
if (item.equals("LEFT_TO_RIGHT")) {
o = ComponentOrientation.LEFT_TO_RIGHT;
} else if (item.equals("RIGHT_TO_LEFT")) {
o = ComponentOrientation.RIGHT_TO_LEFT;
}
panel1.setComponentOrientation(o);
panel2.setComponentOrientation(o);
panel1.layout();
panel2.layout();
panel1.repaint();
panel2.repaint();
}
} );
add(c);
}
}
public static void main(String args[]) {
Frame f = new Frame("BorderTest");
f.addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e) {
e.getWindow().hide();
e.getWindow().dispose();
System.exit(0);
};
} );
BorderTest BorderTest = new BorderTest();
BorderTest.init();
BorderTest.start();
f.add("Center", BorderTest);
f.setSize(450, 300);
f.show();
}
}
/*
* Copyright (c) 1998, 2016, 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
* 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 4108453
* @summary Test ComponentOrientation (Bidi) support in FlowLayout
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation is copyrighted
* and owned by IBM, Inc. These materials are provided under terms of a
* License Agreement between IBM and Sun. This technology is protected by
* multiple US and International patents. This notice and attribution to IBM
* may not be removed.
*/
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class FlowTest extends Applet {
Panel panel;
public FlowTest() {
setLayout(new BorderLayout());
// Create a panel with a FlowLayout and a bunch of buttons in it
panel = new Panel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT));
panel.add(new Button("one"));
panel.add(new Button("two"));
panel.add(new Button("three"));
panel.add(new Button("four"));
panel.add(new Button("five"));
panel.add(new Button("six"));
panel.add(new Button("seven"));
panel.add(new Button("eight"));
panel.add(new Button("nine"));
panel.add(new Button("ten"));
panel.add(new Button("eleven"));
add("Center", panel);
Panel controls = new Panel();
controls.setLayout(new GridLayout(0, 2));
// Menu for setting the alignment of the main FlowLayout panel
{
Choice c = new Choice();
c.addItem("LEFT");
c.addItem("CENTER");
c.addItem("RIGHT");
c.addItem("LEADING");
c.addItem("TRAILING");
c.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
String item = (String)(e.getItem());
FlowLayout layout = (FlowLayout) panel.getLayout();
if (item.equals("LEFT")) {
layout.setAlignment(FlowLayout.LEFT);
} else if (item.equals("CENTER")) {
layout.setAlignment(FlowLayout.CENTER);
} else if (item.equals("RIGHT")) {
layout.setAlignment(FlowLayout.RIGHT);
} else if (item.equals("LEADING")) {
layout.setAlignment(FlowLayout.LEADING);
} else if (item.equals("TRAILING")) {
layout.setAlignment(FlowLayout.TRAILING);
}
panel.layout();
panel.repaint();
}
} );
controls.add(new Label("FlowLayout Alignment:"));
controls.add(c);
}
// Create a popup menu for switching the Panel between orientations
{
Choice c = new Choice();
c.addItem("LEFT_TO_RIGHT");
c.addItem("RIGHT_TO_LEFT");
c.addItem("UNKNOWN");
c.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
String item = (String)(e.getItem());
if (item.equals("LEFT_TO_RIGHT")) {
panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
} else if (item.equals("RIGHT_TO_LEFT")) {
panel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
} else {
panel.setComponentOrientation(ComponentOrientation.UNKNOWN);
}
panel.layout();
panel.repaint();
}
} );
controls.add(new Label("ComponentOrientation:"));
controls.add(c);
}
add("South", controls);
}
public static void main(String args[]) {
Frame f = new Frame("FlowTest");
f.addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e) {
e.getWindow().hide();
e.getWindow().dispose();
System.exit(0);
};
} );
FlowTest flowTest = new FlowTest();
flowTest.init();
flowTest.start();
f.add("Center", flowTest);
f.setSize(300, 300);
f.show();
}
}
/*
* Copyright (c) 1998, 2016, 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
* 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.
*/
/**
* TestBundle.java -- used by BasicTest
*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation is copyrighted
* and owned by IBM, Inc. These materials are provided under terms of a
* License Agreement between IBM and Sun. This technology is protected by
* multiple US and International patents. This notice and attribution to IBM
* may not be removed.
*/
import java.util.ListResourceBundle;
import java.awt.ComponentOrientation;
public class TestBundle extends ListResourceBundle {
protected Object[][] getContents() {
return new Object[][] {
{ "Orientation", ComponentOrientation.UNKNOWN },
};
}
};
/*
* Copyright (c) 1998, 2016, 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
* 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.
*/
/**
* TestBundle1.java -- used by BasicTest
*
* @bug 4108453
* @summary Basic tests for java.awt.ComponentOrientation
*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation is copyrighted
* and owned by IBM, Inc. These materials are provided under terms of a
* License Agreement between IBM and Sun. This technology is protected by
* multiple US and International patents. This notice and attribution to IBM
* may not be removed.
*/
import java.util.ListResourceBundle;
import java.awt.ComponentOrientation;
public class TestBundle1 extends ListResourceBundle {
protected Object[][] getContents() {
return new Object[][] {
{ },
};
}
};
/*
* Copyright (c) 1998, 2016, 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
* 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.
*/
/**
* TestBundle1_ar.java -- used by BasicTest
*
* @bug 4108453
* @summary Basic tests for java.awt.ComponentOrientation
*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation is copyrighted
* and owned by IBM, Inc. These materials are provided under terms of a
* License Agreement between IBM and Sun. This technology is protected by
* multiple US and International patents. This notice and attribution to IBM
* may not be removed.
*/
import java.util.ListResourceBundle;
import java.awt.ComponentOrientation;
public class TestBundle1_ar extends ListResourceBundle {
protected Object[][] getContents() {
return new Object[][] {
{ },
};
}
};
/*
* Copyright (c) 1998, 2016, 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
* 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.
*/
/**
* TestBundle_es.java -- used by BasicTest
*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation is copyrighted
* and owned by IBM, Inc. These materials are provided under terms of a
* License Agreement between IBM and Sun. This technology is protected by
* multiple US and International patents. This notice and attribution to IBM
* may not be removed.
*/
import java.util.ListResourceBundle;
import java.awt.ComponentOrientation;
public class TestBundle_es extends ListResourceBundle {
protected Object[][] getContents() {
return new Object[][] {
{ "Orientation", ComponentOrientation.LEFT_TO_RIGHT },
};
}
};
/*
* Copyright (c) 1998, 2016, 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
* 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.
*/
/**
*
*
* used by BasicTest
*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation is copyrighted
* and owned by IBM, Inc. These materials are provided under terms of a
* License Agreement between IBM and Sun. This technology is protected by
* multiple US and International patents. This notice and attribution to IBM
* may not be removed.
*/
import java.util.ListResourceBundle;
import java.awt.ComponentOrientation;
public class TestBundle_iw extends ListResourceBundle {
protected Object[][] getContents() {
return new Object[][] {
{ "Orientation", ComponentOrientation.RIGHT_TO_LEFT },
};
}
};
/*
* Copyright (c) 1998, 2016, 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
* 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 4108453 4778440 6304785
* @summary Test Window.applyResourceBundle orientation support
*
* @build TestBundle TestBundle_es TestBundle_iw
* @build TestBundle1 TestBundle1_ar
* @run main WindowTest
*/
import java.awt.*;
import java.applet.*;
import java.util.Locale;
import java.util.ResourceBundle;
public class WindowTest extends Applet {
static Exception failure=null;
static Thread mainThread=null;
public static void main(String args[]) throws Exception {
mainThread = Thread.currentThread();
WindowTest app = new WindowTest();
app.start();
try {
Thread.sleep(300000);
} catch (InterruptedException e) {
if (failure != null) {
throw failure;
}
}
}
public void start() {
try {
doTest();
} catch (Exception e) {
failure = e;
}
mainThread.interrupt();
}
public void doTest() {
System.out.println("WindowTest {");
ResourceBundle rb;
Frame myFrame;
// Create a window containing a hierarchy of components.
System.out.println(" Creating component hierarchy...");
myFrame = new Frame();
myFrame.setLayout(new FlowLayout());
Panel panel1 = new Panel();
panel1.setLayout(new BorderLayout());
panel1.add("North", new Button("North"));
panel1.add("South", new Button("South"));
panel1.add("East", new Button("East"));
panel1.add("West", new Button("West"));
panel1.add("Center", new Button("Center"));
myFrame.add(panel1);
Panel panel2 = new Panel();
panel2.setLayout(new BorderLayout());
panel2.add(BorderLayout.BEFORE_FIRST_LINE, new Button("FirstLine"));
panel2.add(BorderLayout.AFTER_LAST_LINE, new Button("LastLine"));
panel2.add(BorderLayout.BEFORE_LINE_BEGINS, new Button("FirstItem"));
panel2.add(BorderLayout.AFTER_LINE_ENDS, new Button("LastItem"));
panel2.add("Center", new Button("Center"));
myFrame.add(panel2);
// After construction, all of the components' orientations should be
// set to ComponentOrientation.UNKNOWN.
System.out.println(" Verifying orientation is UNKNOWN...");
verifyOrientation(myFrame, ComponentOrientation.UNKNOWN);
// This will load TestBundle1 using the default locale and apply
// it to the component hierarchy. Since the bundle has no Orientation
// specified, this should fall back to the bundle-locale's orientation
System.out.println(" Applying TestBundle1 by name and verifying...");
myFrame.applyResourceBundle("TestBundle1");
verifyOrientation(myFrame,
ComponentOrientation.getOrientation(
ResourceBundle.getBundle("TestBundle1", Locale.getDefault())));
System.out.println(" Applying TestBundle_iw and verifying...");
rb = ResourceBundle.getBundle("TestBundle", new Locale("iw", ""));
myFrame.applyResourceBundle(rb);
verifyOrientation(myFrame, ComponentOrientation.RIGHT_TO_LEFT);
System.out.println(" Applying TestBundle_es and verifying...");
rb = ResourceBundle.getBundle("TestBundle", new Locale("es", ""));
myFrame.applyResourceBundle(rb);
verifyOrientation(myFrame, ComponentOrientation.LEFT_TO_RIGHT);
myFrame.setVisible(false);
myFrame.dispose();
System.out.println("}");
}
static void verifyOrientation(Component c, ComponentOrientation orient) {
ComponentOrientation o = c.getComponentOrientation();
if (o != orient) {
throw new RuntimeException("ERROR: expected " + oString(orient) +
", got " + oString(o) +
" on component " + c);
}
if (c instanceof Container) {
Container cont = (Container) c;
int ncomponents = cont.getComponentCount();
for (int i = 0 ; i < ncomponents ; ++i) {
Component comp = cont.getComponent(i);
verifyOrientation(comp, orient);
}
}
}
static String oString(ComponentOrientation o) {
if (o == ComponentOrientation.LEFT_TO_RIGHT) {
return "LEFT_TO_RIGHT";
}
else if (o == ComponentOrientation.RIGHT_TO_LEFT) {
return "RIGHT_TO_LEFT";
}
else {
return "UNKNOWN";
}
}
}
/*
* Copyright (c) 1998, 2016, 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
* 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 4136620 4144590
@summary Make sure that Attribute & subclasses are serialized and deserialized correctly
@modules java.desktop
*/
import java.text.AttributedCharacterIterator.Attribute;
import java.awt.font.TextAttribute;
import java.io.*;
public class ReadResolve {
public static void main(String[] args) throws Exception {
testSerializationCycle(Attribute.LANGUAGE);
testSerializationCycle(TextAttribute.INPUT_METHOD_HIGHLIGHT);
boolean gotException = false;
Attribute result = null;
try {
result = doSerializationCycle(FakeAttribute.LANGUAGE);
} catch (Throwable e) {
gotException = true;
}
if (!gotException) {
throw new RuntimeException("Attribute should throw an exception when given a fake \"language\" attribute. Deserialized object: " + result);
}
}
static Attribute doSerializationCycle(Attribute attribute) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(attribute);
oos.flush();
byte[] data = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(data);
ObjectInputStream ois = new ObjectInputStream(bais);
Attribute result = (Attribute) ois.readObject();
return result;
}
static void testSerializationCycle(Attribute attribute) throws Exception {
Attribute result = doSerializationCycle(attribute);
if (result != attribute) {
throw new RuntimeException("attribute changed identity during serialization/deserialization");
}
}
private static class FakeAttribute extends Attribute {
// This LANGUAGE attribute should never be confused with the
// Attribute.LANGUAGE attribute. However, we don't override
// readResolve here, so that deserialization goes
// to Attribute. Attribute has to catch this problem and reject
// the fake attribute.
static final FakeAttribute LANGUAGE = new FakeAttribute("language");
FakeAttribute(String name) {
super(name);
}
}
}
/*
* Copyright (c) 1998, 2016, 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
* 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 4139771
* @summary test all aspects of AttributedString class
*/
import java.text.Annotation;
import java.text.AttributedCharacterIterator;
import java.text.AttributedCharacterIterator.Attribute;
import java.text.AttributedString;
import java.text.CharacterIterator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class AttributedStringTest {
private static final String text = "Hello, world!";
private static final Annotation hi = new Annotation("hi");
private static final int[] array5_13 = {5, 13};
private static final int[] array3_9_13 = {3, 9, 13};
private static final int[] array5_9_13 = {5, 9, 13};
private static final int[] array3_5_9_13 = {3, 5, 9, 13};
private static final Attribute[] arrayLanguage = {Attribute.LANGUAGE};
private static final Attribute[] arrayLanguageReading = {Attribute.LANGUAGE, Attribute.READING};
private static final Set setLanguageReading = new HashSet();
static {
setLanguageReading.add(Attribute.LANGUAGE);
setLanguageReading.add(Attribute.READING);
}
public static final void main(String argv[]) throws Exception {
AttributedString string;
AttributedCharacterIterator iterator;
// create a string with text, but no attributes
string = new AttributedString(text);
iterator = string.getIterator();
// make sure the text is there and attributes aren't
checkIteratorText(iterator, text);
if (!iterator.getAllAttributeKeys().isEmpty()) {
throwException(iterator, "iterator provides attributes where none are defined");
}
// add an attribute to a subrange
string.addAttribute(Attribute.LANGUAGE, Locale.ENGLISH, 3, 9);
iterator = string.getIterator();
// make sure the attribute is defined, and it's on the correct subrange
checkIteratorAttributeKeys(iterator, arrayLanguage);
checkIteratorSubranges(iterator, array3_9_13);
checkIteratorAttribute(iterator, 0, Attribute.LANGUAGE, null);
checkIteratorAttribute(iterator, 3, Attribute.LANGUAGE, Locale.ENGLISH);
checkIteratorAttribute(iterator, 9, Attribute.LANGUAGE, null);
// add an attribute to a subrange
string.addAttribute(Attribute.READING, hi, 0, 5);
iterator = string.getIterator();
// make sure the attribute is defined, and it's on the correct subrange
checkIteratorAttributeKeys(iterator, arrayLanguageReading);
checkIteratorSubranges(iterator, array3_5_9_13);
checkIteratorAttribute(iterator, 0, Attribute.READING, hi);
checkIteratorAttribute(iterator, 3, Attribute.READING, hi);
checkIteratorAttribute(iterator, 5, Attribute.READING, null);
checkIteratorAttribute(iterator, 9, Attribute.READING, null);
// make sure the first attribute wasn't adversely affected
// in particular, we shouldn't see separate subranges (3,5) and (5,9).
checkIteratorSubranges(iterator, Attribute.LANGUAGE, array3_9_13);
checkIteratorAttribute(iterator, 0, Attribute.LANGUAGE, null);
checkIteratorAttribute(iterator, 3, Attribute.LANGUAGE, Locale.ENGLISH);
checkIteratorAttribute(iterator, 5, Attribute.LANGUAGE, Locale.ENGLISH);
checkIteratorAttribute(iterator, 9, Attribute.LANGUAGE, null);
// for the entire set of attributes, we expect four subranges
checkIteratorSubranges(iterator, setLanguageReading, array3_5_9_13);
// redefine the language attribute so that both language and reading are continuous from 0 to 5
string.addAttribute(Attribute.LANGUAGE, Locale.US, 0, 5);
iterator = string.getIterator();
// make sure attributes got changed and merged correctly
checkIteratorAttributeKeys(iterator, arrayLanguageReading);
checkIteratorSubranges(iterator, array3_5_9_13);
checkIteratorSubranges(iterator, Attribute.LANGUAGE, array5_9_13);
checkIteratorSubranges(iterator, Attribute.READING, array5_13);
checkIteratorSubranges(iterator, setLanguageReading, array5_9_13);
checkIteratorAttribute(iterator, 0, Attribute.LANGUAGE, Locale.US);
checkIteratorAttribute(iterator, 3, Attribute.LANGUAGE, Locale.US);
checkIteratorAttribute(iterator, 5, Attribute.LANGUAGE, Locale.ENGLISH);
checkIteratorAttribute(iterator, 9, Attribute.LANGUAGE, null);
// make sure an annotation is only returned if its range is contained in the iterator's range
iterator = string.getIterator(null, 3, 5);
checkIteratorAttribute(iterator, 3, Attribute.READING, null);
checkIteratorAttribute(iterator, 5, Attribute.READING, null);
iterator = string.getIterator(null, 0, 4);
checkIteratorAttribute(iterator, 0, Attribute.READING, null);
checkIteratorAttribute(iterator, 3, Attribute.READING, null);
iterator = string.getIterator(null, 0, 5);
checkIteratorAttribute(iterator, 0, Attribute.READING, hi);
checkIteratorAttribute(iterator, 4, Attribute.READING, hi);
checkIteratorAttribute(iterator, 5, Attribute.READING, null);
}
private static final void checkIteratorText(AttributedCharacterIterator iterator, String expectedText) throws Exception {
if (iterator.getEndIndex() - iterator.getBeginIndex() != expectedText.length()) {
throwException(iterator, "text length doesn't match between original text and iterator");
}
char c = iterator.first();
for (int i = 0; i < expectedText.length(); i++) {
if (c != expectedText.charAt(i)) {
throwException(iterator, "text content doesn't match between original text and iterator");
}
c = iterator.next();
}
if (c != CharacterIterator.DONE) {
throwException(iterator, "iterator text doesn't end with DONE");
}
}
private static final void checkIteratorAttributeKeys(AttributedCharacterIterator iterator, Attribute[] expectedKeys) throws Exception {
Set iteratorKeys = iterator.getAllAttributeKeys();
if (iteratorKeys.size() != expectedKeys.length) {
throwException(iterator, "number of keys returned by iterator doesn't match expectation");
}
for (int i = 0; i < expectedKeys.length; i++) {
if (!iteratorKeys.contains(expectedKeys[i])) {
throwException(iterator, "expected key wasn't found in iterator's key set");
}
}
}
private static final void checkIteratorSubranges(AttributedCharacterIterator iterator, int[] expectedLimits) throws Exception {
int previous = 0;
char c = iterator.first();
for (int i = 0; i < expectedLimits.length; i++) {
if (iterator.getRunStart() != previous || iterator.getRunLimit() != expectedLimits[i]) {
throwException(iterator, "run boundaries are not as expected: " + iterator.getRunStart() + ", " + iterator.getRunLimit());
}
previous = expectedLimits[i];
c = iterator.setIndex(previous);
}
if (c != CharacterIterator.DONE) {
throwException(iterator, "iterator's run sequence doesn't end with DONE");
}
}
private static final void checkIteratorSubranges(AttributedCharacterIterator iterator, Attribute key, int[] expectedLimits) throws Exception {
int previous = 0;
char c = iterator.first();
for (int i = 0; i < expectedLimits.length; i++) {
if (iterator.getRunStart(key) != previous || iterator.getRunLimit(key) != expectedLimits[i]) {
throwException(iterator, "run boundaries are not as expected: " + iterator.getRunStart(key) + ", " + iterator.getRunLimit(key) + " for key " + key);
}
previous = expectedLimits[i];
c = iterator.setIndex(previous);
}
if (c != CharacterIterator.DONE) {
throwException(iterator, "iterator's run sequence doesn't end with DONE");
}
}
private static final void checkIteratorSubranges(AttributedCharacterIterator iterator, Set keys, int[] expectedLimits) throws Exception {
int previous = 0;
char c = iterator.first();
for (int i = 0; i < expectedLimits.length; i++) {
if (iterator.getRunStart(keys) != previous || iterator.getRunLimit(keys) != expectedLimits[i]) {
throwException(iterator, "run boundaries are not as expected: " + iterator.getRunStart(keys) + ", " + iterator.getRunLimit(keys) + " for keys " + keys);
}
previous = expectedLimits[i];
c = iterator.setIndex(previous);
}
if (c != CharacterIterator.DONE) {
throwException(iterator, "iterator's run sequence doesn't end with DONE");
}
}
private static final void checkIteratorAttribute(AttributedCharacterIterator iterator, int index, Attribute key, Object expectedValue) throws Exception {
iterator.setIndex(index);
Object value = iterator.getAttribute(key);
if (!((expectedValue == null && value == null) || (expectedValue != null && expectedValue.equals(value)))) {
throwException(iterator, "iterator returns wrong attribute value - " + value + " instead of " + expectedValue);
}
value = iterator.getAttributes().get(key);
if (!((expectedValue == null && value == null) || (expectedValue != null && expectedValue.equals(value)))) {
throwException(iterator, "iterator's map returns wrong attribute value - " + value + " instead of " + expectedValue);
}
}
private static final void throwException(AttributedCharacterIterator iterator, String details) throws Exception {
dumpIterator(iterator);
throw new Exception(details);
}
private static final void dumpIterator(AttributedCharacterIterator iterator) {
Set attributeKeys = iterator.getAllAttributeKeys();
System.out.print("All attributes: ");
Iterator keyIterator = attributeKeys.iterator();
while (keyIterator.hasNext()) {
Attribute key = (Attribute) keyIterator.next();
System.out.print(key);
}
for(char c = iterator.first(); c != CharacterIterator.DONE; c = iterator.next()) {
if (iterator.getIndex() == iterator.getBeginIndex() ||
iterator.getIndex() == iterator.getRunStart()) {
System.out.println();
Map attributes = iterator.getAttributes();
Set entries = attributes.entrySet();
Iterator attributeIterator = entries.iterator();
while (attributeIterator.hasNext()) {
Map.Entry entry = (Map.Entry) attributeIterator.next();
System.out.print("<" + entry.getKey() + ": "
+ entry.getValue() + ">");
}
}
System.out.print(" ");
System.out.print(c);
}
System.out.println();
System.out.println("done");
System.out.println();
}
}
/*
* Copyright (c) 1998, 2016, 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
* 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 4146853
* @summary Make sure we can construct an AttributedString from
* an AttributedCharacterIterator covering only a subrange
* @modules java.desktop
*/
import java.awt.font.TextAttribute;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import java.util.Hashtable;
public class TestAttributedStringCtor {
public static void main(String[] args) {
// Create a new AttributedString with one attribute.
Hashtable attributes = new Hashtable();
attributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
AttributedString origString = new AttributedString("Hello world.", attributes);
// Create an iterator over part of the AttributedString.
AttributedCharacterIterator iter = origString.getIterator(null, 4, 6);
// Attempt to create a new AttributedString from the iterator.
// This will throw IllegalArgumentException.
AttributedString newString = new AttributedString(iter);
// Without the exception this would get executed.
System.out.println("DONE");
}
}
/*
* Copyright (c) 1998, 2016, 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
* 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 4151160
* @summary Make sure to return correct run start and limit values
* when the iterator has been created with begin and end index values.
* @modules java.desktop
*/
import java.awt.font.TextAttribute;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import java.text.Annotation;
public class getRunStartLimitTest {
public static void main(String[] args) throws Exception {
String text = "Hello world";
AttributedString as = new AttributedString(text);
// add non-Annotation attributes
as.addAttribute(TextAttribute.WEIGHT,
TextAttribute.WEIGHT_LIGHT,
0,
3);
as.addAttribute(TextAttribute.WEIGHT,
TextAttribute.WEIGHT_BOLD,
3,
5);
as.addAttribute(TextAttribute.WEIGHT,
TextAttribute.WEIGHT_EXTRABOLD,
5,
text.length());
// add Annotation attributes
as.addAttribute(TextAttribute.WIDTH,
new Annotation(TextAttribute.WIDTH_EXTENDED),
0,
3);
as.addAttribute(TextAttribute.WIDTH,
new Annotation(TextAttribute.WIDTH_CONDENSED),
3,
4);
AttributedCharacterIterator aci = as.getIterator(null, 2, 4);
aci.first();
int runStart = aci.getRunStart();
if (runStart != 2) {
throw new Exception("1st run start is wrong. ("+runStart+" should be 2.)");
}
int runLimit = aci.getRunLimit();
if (runLimit != 3) {
throw new Exception("1st run limit is wrong. ("+runLimit+" should be 3.)");
}
Object value = aci.getAttribute(TextAttribute.WEIGHT);
if (value != TextAttribute.WEIGHT_LIGHT) {
throw new Exception("1st run attribute is wrong. ("
+value+" should be "+TextAttribute.WEIGHT_LIGHT+".)");
}
value = aci.getAttribute(TextAttribute.WIDTH);
if (value != null) {
throw new Exception("1st run annotation is wrong. ("
+value+" should be null.)");
}
aci.setIndex(runLimit);
runStart = aci.getRunStart();
if (runStart != 3) {
throw new Exception("2nd run start is wrong. ("+runStart+" should be 3.)");
}
runLimit = aci.getRunLimit();
if (runLimit != 4) {
throw new Exception("2nd run limit is wrong. ("+runLimit+" should be 4.)");
}
value = aci.getAttribute(TextAttribute.WEIGHT);
if (value != TextAttribute.WEIGHT_BOLD) {
throw new Exception("2nd run attribute is wrong. ("
+value+" should be "+TextAttribute.WEIGHT_BOLD+".)");
}
value = aci.getAttribute(TextAttribute.WIDTH);
if (!(value instanceof Annotation)
|| (((Annotation)value).getValue() != TextAttribute.WIDTH_CONDENSED)) {
throw new Exception("2nd run annotation is wrong. (" + value + " should be "
+ new Annotation(TextAttribute.WIDTH_CONDENSED)+".)");
}
}
}
此差异已折叠。
/*
* Copyright (c) 2003, 2016, 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
* 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 4533872 4640853
* @library /java/text/testlib
* @summary Unit tests for supplementary character support (JSR-204) and Unicode 4.0 support
*/
import java.text.BreakIterator;
import java.util.Locale;
public class Bug4533872 extends IntlTest {
public static void main(String[] args) throws Exception {
new Bug4533872().run(args);
}
static final String[] given = {
/* Lu Nd Lu Ll */
"XYZ12345 ABCDE abcde",
/* Nd Lo Nd Lu Po Lu Ll */
"123\uD800\uDC00345 ABC\uFF61XYZ abc",
/* Nd Lo Nd Lu Po Lu Ll */
"123\uD800\uDC00345 ABC\uD800\uDD00XYZ abc",
/* Lu Ll Cs Ll Cs Lu Lo Lu */
"ABCabc\uDC00xyz\uD800ABC\uD800\uDC00XYZ",
};
// Golden data for TestNext(), TestBoundar() and TestPrintEach*ward()
static final String[][] expected = {
{"XYZ12345", " ", "ABCDE", " ", "abcde"},
{"123\uD800\uDC00345", " ", "ABC", "\uFF61", "XYZ", " ", "abc"},
{"123\uD800\uDC00345", " ", "ABC", "\uD800\uDD00", "XYZ", " ", "abc"},
{"ABCabc", "\uDC00", "xyz", "\uD800", "ABC\uD800\uDC00XYZ"},
};
BreakIterator iter;
int start, end, current;
/*
* Test for next(int n)
*/
void TestNext() {
iter = BreakIterator.getWordInstance(Locale.US);
for (int i = 0; i < given.length; i++) {
iter.setText(given[i]);
start = iter.first();
int j = expected[i].length - 1;
start = iter.next(j);
end = iter.next();
if (!expected[i][j].equals(given[i].substring(start, end))) {
errln("Word break failure: printEachForward() expected:<" +
expected[i][j] + ">, got:<" +
given[i].substring(start, end) +
"> start=" + start + " end=" + end);
}
}
}
/*
* Test for isBoundary(int n)
*/
void TestIsBoundary() {
iter = BreakIterator.getWordInstance(Locale.US);
for (int i = 0; i < given.length; i++) {
iter.setText(given[i]);
start = iter.first();
end = iter.next();
while (end < given[i].length()) {
if (!iter.isBoundary(end)) {
errln("Word break failure: isBoundary() This should be a boundary. Index=" +
end + " for " + given[i]);
}
end = iter.next();
}
}
}
/*
* The followig test cases were made based on examples in BreakIterator's
* API Doc.
*/
/*
* Test mainly for next() and current()
*/
void TestPrintEachForward() {
iter = BreakIterator.getWordInstance(Locale.US);
for (int i = 0; i < given.length; i++) {
iter.setText(given[i]);
start = iter.first();
// Check current()'s return value - should be same as first()'s.
current = iter.current();
if (start != current) {
errln("Word break failure: printEachForward() Unexpected current value: current()=" +
current + ", expected(=first())=" + start);
}
int j = 0;
for (end = iter.next();
end != BreakIterator.DONE;
start = end, end = iter.next(), j++) {
// Check current()'s return value - should be same as next()'s.
current = iter.current();
if (end != current) {
errln("Word break failure: printEachForward() Unexpected current value: current()=" +
current + ", expected(=next())=" + end);
}
if (!expected[i][j].equals(given[i].substring(start, end))) {
errln("Word break failure: printEachForward() expected:<" +
expected[i][j] + ">, got:<" +
given[i].substring(start, end) +
"> start=" + start + " end=" + end);
}
}
}
}
/*
* Test mainly for previous() and current()
*/
void TestPrintEachBackward() {
iter = BreakIterator.getWordInstance(Locale.US);
for (int i = 0; i < given.length; i++) {
iter.setText(given[i]);
end = iter.last();
// Check current()'s return value - should be same as last()'s.
current = iter.current();
if (end != current) {
errln("Word break failure: printEachBackward() Unexpected current value: current()=" +
current + ", expected(=last())=" + end);
}
int j;
for (start = iter.previous(), j = expected[i].length-1;
start != BreakIterator.DONE;
end = start, start = iter.previous(), j--) {
// Check current()'s return value - should be same as previous()'s.
current = iter.current();
if (start != current) {
errln("Word break failure: printEachBackward() Unexpected current value: current()=" +
current + ", expected(=previous())=" + start);
}
if (!expected[i][j].equals(given[i].substring(start, end))) {
errln("Word break failure: printEachBackward() expected:<" +
expected[i][j] + ">, got:<" +
given[i].substring(start, end) +
"> start=" + start + " end=" + end);
}
}
}
}
/*
* Test mainly for following() and previous()
*/
void TestPrintAt_1() {
iter = BreakIterator.getWordInstance(Locale.US);
int[][] index = {
{2, 8, 10, 15, 17},
{1, 8, 10, 12, 15, 17, 20},
{3, 8, 10, 13, 16, 18, 20},
{4, 6, 9, 10, 16},
};
for (int i = 0; i < given.length; i++) {
iter.setText(given[i]);
for (int j = index[i].length-1; j >= 0; j--) {
end = iter.following(index[i][j]);
start = iter.previous();
if (!expected[i][j].equals(given[i].substring(start, end))) {
errln("Word break failure: printAt_1() expected:<" +
expected[i][j] + ">, got:<" +
given[i].substring(start, end) +
"> start=" + start + " end=" + end);
}
}
}
}
/*
* Test mainly for preceding() and next()
*/
void TestPrintAt_2() {
iter = BreakIterator.getWordInstance(Locale.US);
int[][] index = {
{2, 9, 10, 15, 17},
{1, 9, 10, 13, 16, 18, 20},
{4, 9, 10, 13, 16, 18, 20},
{6, 7, 10, 11, 15},
};
for (int i = 0; i < given.length; i++) {
iter.setText(given[i]);
// Check preceding(0)'s return value - should equals BreakIterator.DONE.
if (iter.preceding(0) != BreakIterator.DONE) {
errln("Word break failure: printAt_2() expected:-1(BreakIterator.DONE), got:" +
iter.preceding(0));
}
for (int j = 0; j < index[i].length; j++) {
start = iter.preceding(index[i][j]);
end = iter.next();
if (!expected[i][j].equals(given[i].substring(start, end))) {
errln("Word break failure: printAt_2() expected:<" +
expected[i][j] + ">, got:<" +
given[i].substring(start, end) +
"> start=" + start + " end=" + end);
}
}
// Check next()'s return value - should equals BreakIterator.DONE.
end = iter.last();
start = iter.next();
if (start != BreakIterator.DONE) {
errln("Word break failure: printAt_2() expected:-1(BreakIterator.DONE), got:" + start);
}
}
}
}
/*
* Copyright (c) 2011, 2016, 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
* 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 4740757
* @summary Confirm line-breaking behavior of Hangul
*/
import java.text.*;
import java.util.*;
public class Bug4740757 {
private static boolean err = false;
public static void main(String[] args) {
Locale defaultLocale = Locale.getDefault();
if (defaultLocale.getLanguage().equals("th")) {
Locale.setDefault(Locale.KOREA);
test4740757();
Locale.setDefault(defaultLocale);
} else {
test4740757();
}
if (err) {
throw new RuntimeException("Incorrect Line-breaking");
}
}
private static void test4740757() {
String source = "\uc548\ub155\ud558\uc138\uc694? \uc88b\uc740 \uc544\uce68, \uc5ec\ubcf4\uc138\uc694! \uc548\ub155. End.";
String expected = "\uc548/\ub155/\ud558/\uc138/\uc694? /\uc88b/\uc740 /\uc544/\uce68, /\uc5ec/\ubcf4/\uc138/\uc694! /\uc548/\ub155. /End./";
BreakIterator bi = BreakIterator.getLineInstance(Locale.KOREAN);
bi.setText(source);
int start = bi.first();
int end = bi.next();
StringBuilder sb = new StringBuilder();
for (; end != BreakIterator.DONE; start = end, end = bi.next()) {
sb.append(source.substring(start,end));
sb.append('/');
}
if (!expected.equals(sb.toString())) {
System.err.println("Failed: Hangul line-breaking failed." +
"\n\tExpected: " + expected +
"\n\tGot: " + sb +
"\nin " + Locale.getDefault() + " locale.");
err = true;
}
}
}
/*
* Copyright (c) 2003, 2016, 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
* 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 4912404
* @summary Confirm that BreakIterator.equals(null) return false.
*/
import java.text.BreakIterator;
public class Bug4912404 {
public static void main(String[] args) {
BreakIterator b = BreakIterator.getWordInstance();
b.setText("abc");
if (b.equals(null)) {
throw new RuntimeException("BreakIterator.equals(null) should return false.");
}
}
}
/*
* Copyright (c) 2003, 2016, 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
* 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
* @run main/timeout=60 Bug4932583
* @bug 4932583
* @summary Confirm that BreakIterator doesn't get caught in an infinite loop.
*/
import java.text.*;
import java.util.*;
import java.io.*;
public class Bug4932583 {
public static void main(String[] args) {
BreakIterator iterator = BreakIterator.getCharacterInstance();
iterator.setText("\uDB40\uDFFF");
int boundary = iterator.next();
}
}
/*
* Copyright (c) 2011, 2016, 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
* 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 6513074
* @summary Confirm that JIS X 0213 characters are processed in line-breaking properly.
*/
import java.text.*;
import java.util.*;
public class Bug6513074 {
private static final String[][] source = {
{"\ufa30\ufa31 \ufa69\ufa6a",
"JIS X 0213 compatibility additions (\\uFA30-\\uFA6A)"},
};
private static final String[] expected_line = {
"\ufa30/\ufa31 /\ufa69/\ufa6a/",
};
private static final String[] expected_word = {
"\ufa30\ufa31/ /\ufa69\ufa6a/",
};
private static final String[] expected_char = {
"\ufa30/\ufa31/ /\ufa69/\ufa6a/",
};
private static boolean err = false;
public static void main(String[] args) {
Locale defaultLocale = Locale.getDefault();
if (defaultLocale.getLanguage().equals("th")) {
Locale.setDefault(Locale.JAPAN);
test6513074();
Locale.setDefault(defaultLocale);
} else {
test6513074();
}
if (err) {
throw new RuntimeException("Failed: Incorrect Text-breaking.");
}
}
private static void test6513074() {
BreakIterator bi = BreakIterator.getLineInstance(Locale.JAPAN);
for (int i = 0; i < source.length; i++) {
testBreakIterator(bi, "Line", source[i][0], expected_line[i], source[i][1]);
}
bi = BreakIterator.getWordInstance(Locale.JAPAN);
for (int i = 0; i < source.length; i++) {
testBreakIterator(bi, "Word", source[i][0], expected_word[i], source[i][1]);
}
bi = BreakIterator.getCharacterInstance(Locale.JAPAN);
for (int i = 0; i < source.length; i++) {
testBreakIterator(bi, "Character", source[i][0], expected_char[i], source[i][1]);
}
}
private static void testBreakIterator(BreakIterator bi,
String type,
String source,
String expected,
String description) {
bi.setText(source);
int start = bi.first();
int end = bi.next();
StringBuilder sb = new StringBuilder();
for (; end != BreakIterator.DONE; start = end, end = bi.next()) {
sb.append(source.substring(start,end));
sb.append('/');
}
if (!expected.equals(sb.toString())) {
System.err.println("Failed: Incorrect " + type + "-breaking for " +
description +
"\n\tExpected: " + toString(expected) +
"\n\tGot: " + toString(sb.toString()));
err = true;
}
}
private static String toString(String s) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
sb.append(" 0x" + Integer.toHexString(s.charAt(i)));
}
return sb.toString();
}
}
/*
* Copyright (c) 2000, 2016, 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
* 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
@summary test Comparison of New Collators against Old Collators in the en_US locale
*/
import java.io.*;
import java.util.Enumeration;
import java.util.Vector;
import java.util.Locale;
import java.text.BreakIterator;
import java.lang.Math;
public class NewVSOld_th_TH {
public static void main(String args[]) throws FileNotFoundException,
UnsupportedEncodingException,
IOException {
final String ENCODING = "UTF-8";
final Locale THAI_LOCALE = new Locale("th", "TH");
String rawFileName = "test_th_TH.txt";
String oldFileName = "broken_th_TH.txt";
StringBuilder rawText = new StringBuilder();
StringBuilder oldText = new StringBuilder();
StringBuilder cookedText = new StringBuilder();
File f;
f = new File(System.getProperty("test.src", "."), rawFileName);
try (InputStreamReader rawReader =
new InputStreamReader(new FileInputStream(f), ENCODING)) {
int c;
while ((c = rawReader.read()) != -1) {
rawText.append((char) c);
}
}
f = new File(System.getProperty("test.src", "."), oldFileName);
try (InputStreamReader oldReader =
new InputStreamReader(new FileInputStream(f), ENCODING)) {
int c;
while ((c = oldReader.read()) != -1) {
oldText.append((char) c);
}
}
BreakIterator breakIterator = BreakIterator.getWordInstance(THAI_LOCALE);
breakIterator.setText(rawText.toString());
int start = breakIterator.first();
for (int end = breakIterator.next();
end != BreakIterator.DONE;
start = end, end = breakIterator.next()) {
cookedText.append(rawText.substring(start, end));
cookedText.append("\n");
}
String cooked = cookedText.toString();
String old = oldText.toString();
if (cooked.compareTo(old) != 0) {
throw new RuntimeException("Text not broken the same as with the old BreakIterators");
}
}
}
การ
เก็บ
ภาษีประเทศ
ไทยและ
ประเทศ
เดนมาร์ค
อนุสัญญา
ระหว่าง
รัฐบาล
แห่ง
ประเทศ
ไทย
กับ
การเก็บภาษีประเทศไทยและประเทศเดนมาร์คอนุสัญญาระหว่างรัฐบาลแห่งประเทศไทยกับ
\ No newline at end of file
/*
* Copyright (c) 1997, 2016, 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
* 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
* @library /java/text/testlib
* @summary test for Character Iterator
*/
/*
*
*
* (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
* (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
*
* Portions copyright (c) 2007 Sun Microsystems, Inc.
* All Rights Reserved.
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
* Permission to use, copy, modify, and distribute this software
* and its documentation for NON-COMMERCIAL purposes and without
* fee is hereby granted provided that this copyright notice
* appears in all copies. Please refer to the file "copyright.html"
* for further important copyright and licensing information.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
* THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
*
*/
import java.text.*;
public class CharacterIteratorTest extends IntlTest {
public static void main(String[] args) throws Exception {
new CharacterIteratorTest().run(args);
}
public CharacterIteratorTest() {
}
public void TestConstructionAndEquality() {
String testText = "Now is the time for all good men to come to the aid of their country.";
String testText2 = "Don't bother using this string.";
CharacterIterator test1 = new StringCharacterIterator(testText);
CharacterIterator test2 = new StringCharacterIterator(testText, 5);
CharacterIterator test3 = new StringCharacterIterator(testText, 2, 20, 5);
CharacterIterator test4 = new StringCharacterIterator(testText2);
CharacterIterator test5 = (CharacterIterator)test1.clone();
if (test1.equals(test2) || test1.equals(test3) || test1.equals(test4))
errln("Construation or equals() failed: Two unequal iterators tested equal");
if (!test1.equals(test5))
errln("clone() or equals() failed: Two clones tested unequal");
if (test1.hashCode() == test2.hashCode() || test1.hashCode() == test3.hashCode()
|| test1.hashCode() == test4.hashCode())
errln("hash() failed: different objects have same hash code");
if (test1.hashCode() != test5.hashCode())
errln("hash() failed: identical objects have different hash codes");
test1.setIndex(5);
if (!test1.equals(test2) || test1.equals(test5))
errln("setIndex() failed");
}
public void TestIteration() {
String text = "Now is the time for all good men to come to the aid of their country.";
CharacterIterator iter = new StringCharacterIterator(text, 5);
if (iter.current() != text.charAt(5))
errln("Iterator didn't start out in the right place.");
char c = iter.first();
int i = 0;
if (iter.getBeginIndex() != 0 || iter.getEndIndex() != text.length())
errln("getBeginIndex() or getEndIndex() failed");
logln("Testing forward iteration...");
do {
if (c == CharacterIterator.DONE && i != text.length())
errln("Iterator reached end prematurely");
else if (c != text.charAt(i))
errln("Character mismatch at position " + i + ", iterator has " + c +
", string has " + text.charAt(c));
if (iter.current() != c)
errln("current() isn't working right");
if (iter.getIndex() != i)
errln("getIndex() isn't working right");
if (c != CharacterIterator.DONE) {
c = iter.next();
i++;
}
} while (c != CharacterIterator.DONE);
c = iter.last();
i = text.length() - 1;
logln("Testing backward iteration...");
do {
if (c == CharacterIterator.DONE && i >= 0)
errln("Iterator reached end prematurely");
else if (c != text.charAt(i))
errln("Character mismatch at position " + i + ", iterator has " + c +
", string has " + text.charAt(c));
if (iter.current() != c)
errln("current() isn't working right");
if (iter.getIndex() != i)
errln("getIndex() isn't working right");
if (c != CharacterIterator.DONE) {
c = iter.previous();
i--;
}
} while (c != CharacterIterator.DONE);
iter = new StringCharacterIterator(text, 5, 15, 10);
if (iter.getBeginIndex() != 5 || iter.getEndIndex() != 15)
errln("creation of a restricted-range iterator failed");
if (iter.getIndex() != 10 || iter.current() != text.charAt(10))
errln("starting the iterator in the middle didn't work");
c = iter.first();
i = 5;
logln("Testing forward iteration over a range...");
do {
if (c == CharacterIterator.DONE && i != 15)
errln("Iterator reached end prematurely");
else if (c != text.charAt(i))
errln("Character mismatch at position " + i + ", iterator has " + c +
", string has " + text.charAt(c));
if (iter.current() != c)
errln("current() isn't working right");
if (iter.getIndex() != i)
errln("getIndex() isn't working right");
if (c != CharacterIterator.DONE) {
c = iter.next();
i++;
}
} while (c != CharacterIterator.DONE);
c = iter.last();
i = 14;
logln("Testing backward iteration over a range...");
do {
if (c == CharacterIterator.DONE && i >= 5)
errln("Iterator reached end prematurely");
else if (c != text.charAt(i))
errln("Character mismatch at position " + i + ", iterator has " + c +
", string has " + text.charAt(c));
if (iter.current() != c)
errln("current() isn't working right");
if (iter.getIndex() != i)
errln("getIndex() isn't working right");
if (c != CharacterIterator.DONE) {
c = iter.previous();
i--;
}
} while (c != CharacterIterator.DONE);
}
/**
* @bug 4082050 4078261 4078255
*/
public void TestPathologicalCases() {
String text = "This is only a test.";
/*
This test is commented out until API-change approval for bug #4082050 goes through.
// test for bug #4082050 (don't get an error if begin == end, even though all
// operations on the iterator will cause exceptions)
// [I actually fixed this so that you CAN create an iterator with begin == end,
// but all operations on it return DONE.]
CharacterIterator iter = new StringCharacterIterator(text, 5, 5, 5);
if (iter.first() != CharacterIterator.DONE
|| iter.next() != CharacterIterator.DONE
|| iter.last() != CharacterIterator.DONE
|| iter.previous() != CharacterIterator.DONE
|| iter.current() != CharacterIterator.DONE
|| iter.getIndex() != 5)
errln("Got something other than DONE when performing operations on an empty StringCharacterIterator");
*/
CharacterIterator iter = null;
// if we try to construct a StringCharacterIterator with an endIndex that's off
// the end of the String under iterator, we're supposed to get an
// IllegalArgumentException
boolean gotException = false;
try {
iter = new StringCharacterIterator(text, 5, 100, 5);
}
catch (IllegalArgumentException e) {
gotException = true;
}
if (!gotException)
errln("StringCharacterIterator didn't throw an exception when given an invalid substring range.");
// test for bug #4078255 (getting wrong value from next() when we're at the end
// of the string)
iter = new StringCharacterIterator(text);
int expectedIndex = iter.getEndIndex();
int actualIndex;
iter.last();
actualIndex = iter.getIndex();
if (actualIndex != expectedIndex - 1)
errln("last() failed: expected " + (expectedIndex - 1) + ", got " + actualIndex);
iter.next();
actualIndex = iter.getIndex();
if (actualIndex != expectedIndex)
errln("next() after last() failed: expected " + expectedIndex + ", got " + actualIndex);
iter.next();
actualIndex = iter.getIndex();
if (actualIndex != expectedIndex)
errln("second next() after last() failed: expected " + expectedIndex + ", got " + actualIndex);
}
/*
* @bug 4123771 4051073
* #4123771 is actually a duplicate of bug #4051073, which was fixed some time ago, but
* no one ever added a regression test for it.
*/
public void TestBug4123771() {
String text = "Some string for testing";
StringCharacterIterator iter = new StringCharacterIterator(text);
int index = iter.getEndIndex();
try {
char c = iter.setIndex(index);
}
catch (Exception e) {
System.out.println("method setIndex(int position) throws unexpected exception " + e);
System.out.println(" position: " + index);
System.out.println(" getEndIndex(): " + iter.getEndIndex());
System.out.println(" text.length(): " + text.length());
errln(""); // re-throw the exception through our test framework
}
}
}
/*
* Copyright (c) 1997, 2016, 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
* 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
* @library /java/text/testlib
* @summary test Collation API
*/
/*
(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
(C) Copyright IBM Corp. 1996 - All Rights Reserved
The original version of this source code and documentation is copyrighted and
owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
provided under terms of a License Agreement between Taligent and Sun. This
technology is protected by multiple US and International patents. This notice and
attribution to Taligent may not be removed.
Taligent is a registered trademark of Taligent, Inc.
*/
import java.util.Locale;
import java.text.Collator;
import java.text.RuleBasedCollator;
import java.text.CollationKey;
import java.text.CollationElementIterator;
public class APITest extends CollatorTest {
public static void main(String[] args) throws Exception {
new APITest().run(args);
}
final void doAssert(boolean condition, String message)
{
if (!condition) {
err("ERROR: ");
errln(message);
}
}
public final void TestProperty( )
{
Collator col = null;
try {
col = Collator.getInstance(Locale.ROOT);
logln("The property tests begin : ");
logln("Test ctors : ");
doAssert(col.compare("ab", "abc") < 0, "ab < abc comparison failed");
doAssert(col.compare("ab", "AB") < 0, "ab < AB comparison failed");
doAssert(col.compare("black-bird", "blackbird") > 0, "black-bird > blackbird comparison failed");
doAssert(col.compare("black bird", "black-bird") < 0, "black bird < black-bird comparison failed");
doAssert(col.compare("Hello", "hello") > 0, "Hello > hello comparison failed");
logln("Test ctors ends.");
logln("testing Collator.getStrength() method ...");
doAssert(col.getStrength() == Collator.TERTIARY, "collation object has the wrong strength");
doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
logln("testing Collator.setStrength() method ...");
col.setStrength(Collator.SECONDARY);
doAssert(col.getStrength() != Collator.TERTIARY, "collation object's strength is secondary difference");
doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
doAssert(col.getStrength() == Collator.SECONDARY, "collation object has the wrong strength");
logln("testing Collator.setDecomposition() method ...");
col.setDecomposition(Collator.NO_DECOMPOSITION);
doAssert(col.getDecomposition() != Collator.FULL_DECOMPOSITION, "collation object's strength is secondary difference");
doAssert(col.getDecomposition() != Collator.CANONICAL_DECOMPOSITION, "collation object's strength is primary difference");
doAssert(col.getDecomposition() == Collator.NO_DECOMPOSITION, "collation object has the wrong strength");
} catch (Exception foo) {
errln("Error : " + foo.getMessage());
errln("Default Collator creation failed.");
}
logln("Default collation property test ended.");
logln("Collator.getRules() testing ...");
doAssert(((RuleBasedCollator)col).getRules().length() != 0, "getRules() result incorrect" );
logln("getRules tests end.");
try {
col = Collator.getInstance(Locale.FRENCH);
col.setStrength(Collator.PRIMARY);
logln("testing Collator.getStrength() method again ...");
doAssert(col.getStrength() != Collator.TERTIARY, "collation object has the wrong strength");
doAssert(col.getStrength() == Collator.PRIMARY, "collation object's strength is not primary difference");
logln("testing French Collator.setStrength() method ...");
col.setStrength(Collator.TERTIARY);
doAssert(col.getStrength() == Collator.TERTIARY, "collation object's strength is not tertiary difference");
doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
doAssert(col.getStrength() != Collator.SECONDARY, "collation object's strength is secondary difference");
} catch (Exception bar) {
errln("Error : " + bar.getMessage());
errln("Creating French collation failed.");
}
logln("Create junk collation: ");
Locale abcd = new Locale("ab", "CD", "");
Collator junk = null;
try {
junk = Collator.getInstance(abcd);
} catch (Exception err) {
errln("Error : " + err.getMessage());
errln("Junk collation creation failed, should at least return the collator for the base bundle.");
}
try {
col = Collator.getInstance(Locale.ROOT);
doAssert(col.equals(junk), "The base bundle's collation should be returned.");
} catch (Exception exc) {
errln("Error : " + exc.getMessage());
errln("Default collation comparison, caching not working.");
}
logln("Collator property test ended.");
}
public final void TestHashCode( )
{
logln("hashCode tests begin.");
Collator col1 = null;
try {
col1 = Collator.getInstance(Locale.ROOT);
} catch (Exception foo) {
errln("Error : " + foo.getMessage());
errln("Default collation creation failed.");
}
Collator col2 = null;
Locale dk = new Locale("da", "DK", "");
try {
col2 = Collator.getInstance(dk);
} catch (Exception bar) {
errln("Error : " + bar.getMessage());
errln("Danish collation creation failed.");
return;
}
Collator col3 = null;
try {
col3 = Collator.getInstance(Locale.ROOT);
} catch (Exception err) {
errln("Error : " + err.getMessage());
errln("2nd default collation creation failed.");
}
logln("Collator.hashCode() testing ...");
if (col1 != null) {
doAssert(col1.hashCode() != col2.hashCode(), "Hash test1 result incorrect");
if (col3 != null) {
doAssert(col1.hashCode() == col3.hashCode(), "Hash result not equal");
}
}
logln("hashCode tests end.");
}
//----------------------------------------------------------------------------
// ctor -- Tests the constructor methods
//
public final void TestCollationKey( )
{
logln("testing CollationKey begins...");
Collator col = null;
try {
col = Collator.getInstance(Locale.ROOT);
} catch (Exception foo) {
errln("Error : " + foo.getMessage());
errln("Default collation creation failed.");
}
if (col == null) {
return;
}
String test1 = "Abcda", test2 = "abcda";
logln("Use tertiary comparison level testing ....");
CollationKey sortk1 = col.getCollationKey(test1);
CollationKey sortk2 = col.getCollationKey(test2);
doAssert(sortk1.compareTo(sortk2) > 0,
"Result should be \"Abcda\" >>> \"abcda\"");
CollationKey sortk3 = sortk2;
CollationKey sortkNew = sortk1;
doAssert(sortk1 != sortk2, "The sort keys should be different");
doAssert(sortk1.hashCode() != sortk2.hashCode(), "sort key hashCode() failed");
doAssert(sortk2.compareTo(sortk3) == 0, "The sort keys should be the same");
doAssert(sortk1 == sortkNew, "The sort keys assignment failed");
doAssert(sortk1.hashCode() == sortkNew.hashCode(), "sort key hashCode() failed");
doAssert(sortkNew != sortk3, "The sort keys should be different");
doAssert(sortk1.compareTo(sortk3) > 0, "Result should be \"Abcda\" >>> \"abcda\"");
doAssert(sortk2.compareTo(sortk3) == 0, "Result should be \"abcda\" == \"abcda\"");
long cnt1, cnt2;
byte byteArray1[] = sortk1.toByteArray();
byte byteArray2[] = sortk2.toByteArray();
doAssert(byteArray1 != null && byteArray2 != null, "CollationKey.toByteArray failed.");
logln("testing sortkey ends...");
}
//----------------------------------------------------------------------------
// ctor -- Tests the constructor methods
//
public final void TestElemIter( )
{
logln("testing sortkey begins...");
Collator col = null;
try {
col = Collator.getInstance();
} catch (Exception foo) {
errln("Error : " + foo.getMessage());
errln("Default collation creation failed.");
}
RuleBasedCollator rbCol;
if (col instanceof RuleBasedCollator) {
rbCol = (RuleBasedCollator) col;
} else {
return;
}
String testString1 = "XFILE What subset of all possible test cases has the highest probability of detecting the most errors?";
String testString2 = "Xf ile What subset of all possible test cases has the lowest probability of detecting the least errors?";
logln("Constructors and comparison testing....");
CollationElementIterator iterator1 = rbCol.getCollationElementIterator(testString1);
CollationElementIterator iterator2 = rbCol.getCollationElementIterator(testString1);
CollationElementIterator iterator3 = rbCol.getCollationElementIterator(testString2);
int order1, order2, order3;
order1 = iterator1.next();
order2 = iterator2.next();
doAssert(order1 == order2, "The order result should be the same");
order3 = iterator3.next();
doAssert(CollationElementIterator.primaryOrder(order1)
== CollationElementIterator.primaryOrder(order3),
"The primary orders should be the same");
doAssert(CollationElementIterator.secondaryOrder(order1)
== CollationElementIterator.secondaryOrder(order3),
"The secondary orders should be the same");
doAssert(CollationElementIterator.tertiaryOrder(order1)
== CollationElementIterator.tertiaryOrder(order3),
"The tertiary orders should be the same");
order1 = iterator1.next();
order3 = iterator3.next();
doAssert(CollationElementIterator.primaryOrder(order1)
== CollationElementIterator.primaryOrder(order3),
"The primary orders should be identical");
doAssert(CollationElementIterator.tertiaryOrder(order1)
!= CollationElementIterator.tertiaryOrder(order3),
"The tertiary orders should be different");
order1 = iterator1.next();
order3 = iterator3.next();
doAssert(CollationElementIterator.secondaryOrder(order1)
!= CollationElementIterator.secondaryOrder(order3),
"The secondary orders should be different");
doAssert(order1 != CollationElementIterator.NULLORDER,
"Unexpected end of iterator reached");
iterator1.reset();
iterator2.reset();
iterator3.reset();
order1 = iterator1.next();
order2 = iterator2.next();
doAssert(order1 == order2, "The order result should be the same");
order3 = iterator3.next();
doAssert(CollationElementIterator.primaryOrder(order1)
== CollationElementIterator.primaryOrder(order3),
"The orders should be the same");
doAssert(CollationElementIterator.secondaryOrder(order1)
== CollationElementIterator.secondaryOrder(order3),
"The orders should be the same");
doAssert(CollationElementIterator.tertiaryOrder(order1)
== CollationElementIterator.tertiaryOrder(order3),
"The orders should be the same");
order1 = iterator1.next();
order2 = iterator2.next();
order3 = iterator3.next();
doAssert(CollationElementIterator.primaryOrder(order1)
== CollationElementIterator.primaryOrder(order3),
"The primary orders should be identical");
doAssert(CollationElementIterator.tertiaryOrder(order1)
!= CollationElementIterator.tertiaryOrder(order3),
"The tertiary orders should be different");
order1 = iterator1.next();
order3 = iterator3.next();
doAssert(CollationElementIterator.secondaryOrder(order1)
!= CollationElementIterator.secondaryOrder(order3),
"The secondary orders should be different");
doAssert(order1 != CollationElementIterator.NULLORDER, "Unexpected end of iterator reached");
logln("testing CollationElementIterator ends...");
}
public final void TestGetAll()
{
Locale[] list = Collator.getAvailableLocales();
for (int i = 0; i < list.length; ++i) {
log("Locale name: ");
log(list[i].toString());
log(" , the display name is : ");
logln(list[i].getDisplayName());
}
}
}
/*
* Copyright (c) 2005, 2016, 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
* 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 6271411
* @library /java/text/testlib
* @summary Confirm that three JCK testcases for CollationElementIterator pass.
*/
import java.text.*;
/*
* Based on JCK-runtime-15/tests/api/java_text/CollationElementIterator/ColltnElmtIterTests.java.
*/
public class Bug6271411 extends IntlTest {
public static void main(String argv[]) throws Exception {
Bug6271411 test = new Bug6271411();
test.run(argv);
}
/*
* Rule for RuleBasedCollator
*/
static final String rule = "< c, C < d; D";
/*
* Textdata
*/
static final String[] values = {
"", "c", "cH522Yd", "Hi, high school", "abcchCHidD"
};
/*
* Confirm that setOffset() throws IllegalArgumentException
* (not IndexOutOfBoundsException) if the given offset is invalid.
* Use CollationElementIterator.setText(String).
*/
public void Test_CollationElementIterator0007() throws Exception {
int[] offsets = {
Integer.MIN_VALUE, Integer.MIN_VALUE + 1, -10000, -2, -1,
100, 101, // These two are customized for every test data later.
12345, Integer.MAX_VALUE - 1, Integer.MAX_VALUE
};
boolean err = false;
RuleBasedCollator rbc = new RuleBasedCollator(rule);
CollationElementIterator iterator = rbc.getCollationElementIterator("");
for (int i = 0; i < values.length; i++) {
String source = values[i];
iterator.setText(source);
int len = source.length();
offsets[5] = len + 1;
offsets[6] = len + 2;
for (int j = 0; j < offsets.length; j++) {
try {
iterator.setOffset(offsets[j]);
System.out.println("IllegalArgumentException should be thrown for setOffset(" +
offsets[j] + ") for <" + source + ">.");
err = true;
}
catch (IllegalArgumentException e) {
}
}
}
if (err) {
errln("CollationElementIterator.setOffset() didn't throw an expected IllegalArguemntException.");
}
}
/*
* Confirm that setText() doesn't throw an exception and setOffset() throws
* IllegalArgumentException if the given offset is invalid.
* Use CollationElementIterator.setText(CharacterIterator).
*/
public void Test_CollationElementIterator0010() throws Exception {
String prefix = "xyz abc";
String suffix = "1234567890";
int begin = prefix.length();
int[] offsets = {
Integer.MIN_VALUE, Integer.MIN_VALUE + 1, -10000,
-2, -1, 0, 1, begin - 2, begin - 1, 9, 10, 11, 12, 13, 14,
15, 12345, Integer.MAX_VALUE - 1, Integer.MAX_VALUE
};
boolean err = false;
RuleBasedCollator rbc = new RuleBasedCollator(rule);
CollationElementIterator iterator = rbc.getCollationElementIterator("");
for (int i = 0; i < values.length; i++) {
String str = prefix + values[i] + suffix;
int len = str.length();
int end = len - suffix.length();
CharacterIterator source =
new StringCharacterIterator(str, begin, end, begin);
iterator.setText(source);
offsets[9] = end + 1;
offsets[10] = end + 2;
offsets[11] = (end + len) / 2;
offsets[12] = len - 1;
offsets[13] = len;
offsets[14] = len + 1;
offsets[15] = len + 2;
for (int j = 0; j < offsets.length; j++) {
try {
iterator.setOffset(offsets[j]);
System.out.println("IllegalArgumentException should be thrown for setOffset(" +
offsets[j] + ") for <" + str + ">.");
err = true;
}
catch (IllegalArgumentException e) {
}
}
}
if (err) {
errln("CollationElementIterator.setOffset() didn't throw an expected IllegalArguemntException.");
}
}
/*
* Confirm that setText() doesn't throw an exception and setOffset() sets
* an offset as expected.
* Use CollationElementIterator.setText(CharacterIterator).
*/
public void Test_CollationElementIterator0011() throws Exception {
String prefix = "xyz abc";
String suffix = "1234567890";
int begin = prefix.length();
int[] offsets = { begin, begin + 1, 2, 3, 4 };
RuleBasedCollator rbc = new RuleBasedCollator(rule);
CollationElementIterator iterator = rbc.getCollationElementIterator("");
for (int i = 0; i < values.length; i++) {
String str = prefix + values[i] + suffix;
int len = str.length();
int end = len - suffix.length();
CharacterIterator source =
new StringCharacterIterator(str, begin, end, begin);
iterator.setText(source);
offsets[2] = (end + len) / 2;
offsets[3] = len - 1;
offsets[4] = len;
for (int j = 0; j < offsets.length; j++) {
int offset = offsets[j];
if (offset < begin || offset > end) {
break;
}
iterator.setOffset(offset);
int newOffset = iterator.getOffset();
if (newOffset != offset) {
throw new RuntimeException("setOffset() didn't set a correct offset. Got: " +
newOffset + " Expected: " + offset + " for <" + str + ">.");
}
}
}
}
}
/*
* Copyright (c) 1997, 2016, 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
* 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 4106263
* @summary Tests on the bug 4106263 - CollationKey became non-final extendable class.
* The implementation of CollationKey is moved to the new private class,
* RuleBasedCollationKey. This test basically tests on the two features:
* 1. Existing code using CollationKey works (backward compatiblility)
* 2. CollationKey can be extended by its subclass.
*/
public class CollationKeyTest {
public static void main(String[] args) {
CollationKeyTestImpl ck = new CollationKeyTestImpl("Testing the CollationKey");
ck.run();
}
}
/*
* Copyright (c) 1997, 2016, 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
* 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.
*/
/*
*
* A part of tests on the bug 4106263. CollationKey became non-final extendable class.
* The implementation of CollationKey is moved to the new private class,
* RuleBasedCollationKey. This test basically tests on the two features:
* 1. Existing code using CollationKey works (backward compatiblility)
* 2. CollationKey can be extended by its subclass.
*/
import java.util.Locale;
import java.text.Collator;
import java.text.CollationKey;
import java.io.*;
import java.text.*;
public class CollationKeyTestImpl extends CollationKey {
private static String[] sourceData_ja = {
"\u3042\u3044\u3046\u3048\u3048",
"\u3041\u3043\u3045\u3047\u3049",
"\u3052\u3054\u3056\u3058\u3058",
"\u3051\u3053\u3055\u3057\u3059",
"\u3062\u3064\u3066\u3068\u3068",
"\u3061\u3063\u3065\u3067\u3069",
"\u3072\u3074\u3075\u3078\u3078",
"\u3071\u3073\u3075\u3077\u3079",
"\u3082\u3084\u3085\u3088\u3088",
"\u3081\u3083\u3085\u3087\u3089",
"\u30a2\u30a4\u30a6\u30a8\u30aa",
"\u30a1\u30a3\u30a5\u30a7\u30a9",
"\u30c2\u30c4\u30c6\u30c8\u30ca",
"\u30c1\u30c3\u30c5\u30c7\u30c9",
"\u30b2\u30b4\u30b6\u30b8\u30ba",
"\u30b1\u30b3\u30b5\u30b7\u30b9",
"\u30d2\u30d4\u30d6\u30d8\u30da",
"\u30d1\u30d3\u30d5\u30d7\u30d9",
"\u30e2\u30e4\u30e6\u30e8\u30ea",
"\u30e1\u30e3\u30e5\u30e7\u30e9"
};
private static final String[] targetData_ja = {
"\u3042\u3044\u3046\u3048\u3048",
"\u3041\u3043\u3045\u3047\u3049",
"\u30a2\u30a4\u30a6\u30a8\u30aa",
"\u30a1\u30a3\u30a5\u30a7\u30a9",
"\u3052\u3054\u3056\u3058\u3058",
"\u3051\u3053\u3055\u3057\u3059",
"\u30b1\u30b3\u30b5\u30b7\u30b9",
"\u30b2\u30b4\u30b6\u30b8\u30ba",
"\u3061\u3063\u3065\u3067\u3069",
"\u30c1\u30c3\u30c5\u30c7\u30c9",
"\u3062\u3064\u3066\u3068\u3068",
"\u30c2\u30c4\u30c6\u30c8\u30ca",
"\u3071\u3073\u3075\u3077\u3079",
"\u30d1\u30d3\u30d5\u30d7\u30d9",
"\u3072\u3074\u3075\u3078\u3078",
"\u30d2\u30d4\u30d6\u30d8\u30da",
"\u3081\u3083\u3085\u3087\u3089",
"\u30e1\u30e3\u30e5\u30e7\u30e9",
"\u3082\u3084\u3085\u3088\u3088",
"\u30e2\u30e4\u30e6\u30e8\u30ea"
};
public void run() {
/** debug: printout the test data
for (int i=0; i<sourceData_ja.length; i++){
System.out.println(i+": "+sourceData_ja[i]);
}
**/
/*
* 1. Test the backward compatibility
* note: targetData_ja.length is equal to sourceData_ja.length
*/
Collator myCollator = Collator.getInstance(Locale.JAPAN);
CollationKey[] keys = new CollationKey[sourceData_ja.length];
CollationKey[] target_keys = new CollationKey[targetData_ja.length];
for (int i=0; i<sourceData_ja.length; i++){
keys[i] = myCollator.getCollationKey(sourceData_ja[i]);
target_keys[i] = myCollator.getCollationKey(targetData_ja[i]); //used later
}
/* Sort the string using CollationKey */
InsertionSort(keys);
/** debug: printout the result after sort
System.out.println("--- After Sorting ---");
for (int i=0; i<sourceData_ja.length; i++){
System.out.println(i+" :"+keys[i].getSourceString());
}
**/
/*
* Compare the result using equals method and getSourceString method.
*/
boolean pass = true;
for (int i=0; i<sourceData_ja.length; i++){
/* Comparing using String.equals: in order to use getStringSource() */
if (! targetData_ja[i].equals(keys[i].getSourceString())){
throw new RuntimeException("FAILED: CollationKeyTest backward compatibility "
+"while comparing" +targetData_ja[i]+" vs "
+keys[i].getSourceString());
}
/* Comparing using CollaionKey.equals: in order to use equals() */
if (! target_keys[i].equals(keys[i])){
throw new RuntimeException("FAILED: CollationKeyTest backward compatibility."
+" Using CollationKey.equals " +targetData_ja[i]
+" vs " +keys[i].getSourceString());
}
/* Comparing using CollaionKey.hashCode(): in order to use hashCode() */
if (target_keys[i].hashCode() != keys[i].hashCode()){
throw new RuntimeException("FAILED: CollationKeyTest backward compatibility."
+" Using CollationKey.hashCode " +targetData_ja[i]
+" vs " +keys[i].getSourceString());
}
/* Comparing using CollaionKey.toByteArray(): in order to use toByteArray() */
byte[] target_bytes = target_keys[i].toByteArray();
byte[] source_bytes = keys[i].toByteArray();
for (int j=0; j<target_bytes.length; j++){
Byte targetByte = new Byte(target_bytes[j]);
Byte sourceByte = new Byte(source_bytes[j]);
if (targetByte.compareTo(sourceByte)!=0){
throw new RuntimeException("FAILED: CollationKeyTest backward "
+"compatibility. Using Byte.compareTo from CollationKey.toByteArray "
+targetData_ja[i]
+" vs " +keys[i].getSourceString());
}
}
}
testSubclassMethods();
testConstructor();
}
/*
* Sort the array of CollationKey using compareTo method in insertion sort.
*/
private void InsertionSort(CollationKey[] keys){
int f, i;
CollationKey tmp;
for (f=1; f < keys.length; f++){
if(keys[f].compareTo( keys[f-1]) > 0){
continue;
}
tmp = keys[f];
i = f-1;
while ( (i>=0) && (keys[i].compareTo(tmp) > 0) ) {
keys[i+1] = keys[i];
i--;
}
keys[i+1]=tmp;
}
}
/*
* From here is the bogus methods to test the subclass of
* the CollationKey class.
*/
public CollationKeyTestImpl(String str){
super (str);
// debug: System.out.println("CollationKeyTest extends CollationKey class: "+str);
}
/* abstract method: needs to be implemented */
public byte[] toByteArray(){
String foo= "Hello";
return foo.getBytes();
}
/* abstract method: needs to be implemented */
public int compareTo(CollationKey target){
return 0;
}
public boolean equals(Object target){
return true;
}
public String getSourceString(){
return "CollationKeyTestImpl";
}
/*
* This method tests the collection of bugus methods from the extended
* subclass of CollationKey class.
*/
private void testSubclassMethods() {
CollationKeyTestImpl clt1 = new CollationKeyTestImpl("testSubclassMethods-1");
CollationKeyTestImpl clt2 = new CollationKeyTestImpl("testSubclassMethods-2");
// extended method, equals always returns true
if (!clt1.equals(clt2)){
throw new RuntimeException("Failed: equals(CollationKeySubClass)");
}
// extended method, compareTo always returns 0
if (clt1.compareTo(clt2)!=0){
throw new RuntimeException("Failed: compareTo(CollationKeySubClass)");
}
// overriding extended method, getSourceString always returns "CollationKeyTestImpl"
if (! clt1.getSourceString().equals("CollationKeyTestImpl")){
throw new RuntimeException("Failed: CollationKey subclass overriding getSourceString()");
}
// extended method, toByteArray always returns bytes from "Hello"
String str2 = new String( clt2.toByteArray());
if (! clt2.equals("Hello")){
throw new RuntimeException("Failed: CollationKey subclass toByteArray()");
}
}
/*
* This method tests CollationKey constructor with null source string.
* It should throw NPE.
*/
private void testConstructor() {
boolean npe=false;
try{
CollationKeyTestImpl cltNull = new CollationKeyTestImpl(null);
} catch (NullPointerException npException){
npe=true;
// debug: System.out.println("--- NPE is thrown with NULL arguement: PASS ---");
}
if(!npe){
throw new RuntimeException("Failed: CollationKey Constructor with null source"+
" didn't throw NPE!");
}
}
}
/*
* Copyright (c) 1998, 2016, 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
* 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 java.lang.reflect.*;
import java.util.Hashtable;
import java.util.Enumeration;
import java.util.Vector;
import java.io.*;
import java.text.*;
/**
* CollatorTest is a base class for tests that can be run conveniently from
* the command line as well as under the Java test harness.
* <p>
* Sub-classes implement a set of methods named Test<something>. Each
* of these methods performs some test. Test methods should indicate
* errors by calling either err or errln. This will increment the
* errorCount field and may optionally print a message to the log.
* Debugging information may also be added to the log via the log
* and logln methods. These methods will add their arguments to the
* log only if the test is being run in verbose mode.
*/
public abstract class CollatorTest extends IntlTest {
//------------------------------------------------------------------------
// These methods are utilities specific to the Collation tests..
//------------------------------------------------------------------------
protected void assertEqual(CollationElementIterator i1, CollationElementIterator i2) {
int c1, c2, count = 0;
do {
c1 = i1.next();
c2 = i2.next();
if (c1 != c2) {
errln(" " + count + ": " + c1 + " != " + c2);
break;
}
count++;
} while (c1 != CollationElementIterator.NULLORDER);
}
// Replace nonprintable characters with unicode escapes
static protected String prettify(String str) {
StringBuffer result = new StringBuffer();
String zero = "0000";
for (int i = 0; i < str.length(); i++) {
char ch = str.charAt(i);
if (ch < 0x09 || (ch > 0x0A && ch < 0x20)|| (ch > 0x7E && ch < 0xA0) || ch > 0x100) {
String hex = Integer.toString((int)ch,16);
result.append("\\u" + zero.substring(0, 4 - hex.length()) + hex);
} else {
result.append(ch);
}
}
return result.toString();
}
// Produce a printable representation of a CollationKey
static protected String prettify(CollationKey key) {
StringBuffer result = new StringBuffer();
byte[] bytes = key.toByteArray();
for (int i = 0; i < bytes.length; i += 2) {
int val = (bytes[i] << 8) + bytes[i+1];
result.append(Integer.toString(val, 16) + " ");
}
return result.toString();
}
//------------------------------------------------------------------------
// Everything below here is boilerplate code that makes it possible
// to add a new test by simply adding a function to an existing class
//------------------------------------------------------------------------
protected void doTest(Collator col, int strength,
String[] source, String[] target, int[] result) {
if (source.length != target.length) {
errln("Data size mismatch: source = " +
source.length + ", target = " + target.length);
return; // Return if "-nothrow" is specified.
}
if (source.length != result.length) {
errln("Data size mismatch: source & target = " +
source.length + ", result = " + result.length);
return; // Return if "-nothrow" is specified.
}
col.setStrength(strength);
for (int i = 0; i < source.length ; i++) {
doTest(col, source[i], target[i], result[i]);
}
}
protected void doTest(Collator col,
String source, String target, int result) {
char relation = '=';
if (result <= -1) {
relation = '<';
} else if (result >= 1) {
relation = '>';
}
int compareResult = col.compare(source, target);
CollationKey sortKey1 = col.getCollationKey(source);
CollationKey sortKey2 = col.getCollationKey(target);
int keyResult = sortKey1.compareTo(sortKey2);
if (compareResult != keyResult) {
errln("Compare and Collation Key results are different! Source = " +
source + " Target = " + target);
}
if (keyResult != result) {
errln("Collation Test failed! Source = " + source + " Target = " +
target + " result should be " + relation);
}
}
}
/*
* Copyright (c) 1997, 2016, 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
* 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 4114080 4150807
* @summary Test currency collation. For bug 4114080, make sure the collation
* of the euro sign behaves properly. For bug 4150807, make sure the collation
* order of ALL the current symbols is correct. This means they sort
* in English alphabetical order of their English names. This test can be
* easily extended to do simple spot checking. See other collation tests for
* more sophisticated testing.
*/
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Locale;
import java.text.Collator;
import java.text.RuleBasedCollator;
import java.text.CollationKey;
/* Author: Alan Liu
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*/
public class CurrencyCollate {
static Collator myCollation = Collator.getInstance(Locale.US);
public static void main(String[] args) {
String[] DATA = {
"\u20AC", ">", "$", // euro > dollar
"\u20AC", "<", "\u00A3", // euro < pound
// additional tests for general currency sort order (bug #4150807)
"\u00a4", "<", "\u0e3f", // generic currency < baht
"\u0e3f", "<", "\u00a2", // baht < cent
"\u00a2", "<", "\u20a1", // cent < colon
"\u20a1", "<", "\u20a2", // colon < cruzeiro
"\u20a2", "<", "\u0024", // cruzeiro < dollar
"\u0024", "<", "\u20ab", // dollar < dong
"\u20ab", "<", "\u20a3", // dong < franc
"\u20a3", "<", "\u20a4", // franc < lira
"\u20a4", "<", "\u20a5", // lira < mill
"\u20a5", "<", "\u20a6", // mill < naira
"\u20a6", "<", "\u20a7", // naira < peseta
"\u20a7", "<", "\u00a3", // peseta < pound
"\u00a3", "<", "\u20a8", // pound < rupee
"\u20a8", "<", "\u20aa", // rupee < shekel
"\u20aa", "<", "\u20a9", // shekel < won
"\u20a9", "<", "\u00a5" // won < yen
};
for (int i=0; i<DATA.length; i+=3) {
int expected = DATA[i+1].equals(">") ? 1 : (DATA[i+1].equals("<") ? -1 : 0);
int actual = myCollation.compare(DATA[i], DATA[i+2]);
if (actual != expected) {
throw new RuntimeException("Collation of " +
DATA[i] + " vs. " +
DATA[i+2] + " yields " + actual +
"; expected " + expected);
}
}
System.out.println("Ok");
}
}
//eof
/*
* Copyright (c) 1997, 2016, 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
* 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 4930708 4174436 5008498
* @library /java/text/testlib
* @summary test Danish Collation
*/
/*
(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
(C) Copyright IBM Corp. 1996 - All Rights Reserved
The original version of this source code and documentation is copyrighted and
owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
provided under terms of a License Agreement between Taligent and Sun. This
technology is protected by multiple US and International patents. This notice and
attribution to Taligent may not be removed.
Taligent is a registered trademark of Taligent, Inc.
*/
import java.util.Locale;
import java.text.Collator;
// Quick dummy program for printing out test results
public class DanishTest extends CollatorTest {
public static void main(String[] args) throws Exception {
new DanishTest().run(args);
}
/*
* Data for TestPrimary()
*/
private static final String[] primarySourceData = {
"Lvi",
"L\u00E4vi",
"L\u00FCbeck",
"ANDR\u00C9",
"ANDRE",
"ANNONCERER"
};
private static final String[] primaryTargetData = {
"Lwi",
"L\u00F6wi",
"Lybeck",
"ANDR\u00E9",
"ANDR\u00C9",
"ANN\u00D3NCERER"
};
private static final int[] primaryResults = {
-1, -1, 0, 0, 0, 0
};
/*
* Data for TestTertiary()
*/
private static final String[] tertiarySourceData = {
"Luc",
"luck",
"L\u00FCbeck",
"L\u00E4vi",
"L\u00F6ww"
};
private static final String[] tertiaryTargetData = {
"luck",
"L\u00FCbeck",
"lybeck",
"L\u00F6we",
"mast"
};
private static final int[] tertiaryResults = {
-1, -1, 1, -1, -1
};
/*
* Data for TestExtra()
*/
private static final String[] testData = {
"A/S",
"ANDRE",
"ANDR\u00C9", // E-acute
"ANDR\u00C8", // E-grave
"ANDR\u00E9", // e-acute
"ANDR\u00EA", // e-circ
"Andre",
"Andr\u00E9", // e-acute
"\u00C1NDRE", // A-acute
"\u00C0NDRE", // A-grave
"andre",
"\u00E1ndre", // a-acute
"\u00E0ndre", // a-grave
"ANDREAS",
"ANNONCERER",
"ANN\u00D3NCERER", // O-acute
"annoncerer",
"ann\u00F3ncerer", // o-acute
"AS",
"A\u00e6RO", // ae-ligature
"CA",
"\u00C7A", // C-cedilla
"CB",
"\u00C7C", // C-cedilla
"D.S.B.",
"DA",
"DB",
"\u00D0ORA", // capital eth
"DSB",
"\u00D0SB", // capital eth
"DSC",
"EKSTRA_ARBEJDE",
"EKSTRABUD",
"H\u00D8ST", // could the 0x00D8 be 0x2205?
"HAAG",
"H\u00C5NDBOG", // A-ring
"HAANDV\u00C6RKSBANKEN", // AE-ligature
"INTERNETFORBINDELSE",
"Internetforbindelse",
"\u00CDNTERNETFORBINDELSE", // I-acute
"internetforbindelse",
"\u00EDnternetforbindelse", // i-acute
"Karl",
"karl",
"NIELSEN",
"NIELS J\u00D8RGEN", // O-slash
"NIELS-J\u00D8RGEN", // O-slash
"OERVAL",
"\u0152RVAL", // OE-ligature
"\u0153RVAL", // oe-ligature
"R\u00C9E, A", // E-acute
"REE, B",
"R\u00C9E, L", // E-acute
"REE, V",
"SCHYTT, B",
"SCHYTT, H",
"SCH\u00DCTT, H", // U-diaeresis
"SCHYTT, L",
"SCH\u00DCTT, M", // U-diaeresis
"SS",
"ss",
"\u00DF", // sharp S
"SSA",
"\u00DFA", // sharp S
"STOREK\u00C6R", // AE-ligature
"STORE VILDMOSE",
"STORMLY",
"STORM PETERSEN",
"THORVALD",
"THORVARDUR",
"\u00DEORVAR\u0110UR", // capital thorn, capital d-stroke(like eth) (sami)
"THYGESEN",
"VESTERG\u00C5RD, A",
"VESTERGAARD, A",
"VESTERG\u00C5RD, B", // 50
"Westmalle",
"YALLE",
"Yderligere",
"\u00DDderligere", // Y-acute
"\u00DCderligere", // U-diaeresis
"\u00FDderligere", // y-acute
"\u00FCderligere", // u-diaeresis
"U\u0308ruk-hai",
"ZORO",
"\u00C6BLE", // AE-ligature
"\u00E6BLE", // ae-ligature
"\u00C4BLE", // A-diaeresis
"\u00E4BLE", // a-diaeresis
"\u00D8BERG", // O-stroke
"\u00F8BERG", // o-stroke
"\u00D6BERG", // O-diaeresis
"\u00F6BERG" // o-diaeresis
};
public void TestPrimary() {
doTest(myCollation, Collator.PRIMARY,
primarySourceData, primaryTargetData, primaryResults);
}
public void TestTertiary() {
doTest(myCollation, Collator.TERTIARY,
tertiarySourceData, tertiaryTargetData, tertiaryResults);
for (int i = 0; i < testData.length-1; i++) {
for (int j = i+1; j < testData.length; j++) {
doTest(myCollation, testData[i], testData[j], -1);
}
}
}
private final Collator myCollation = Collator.getInstance(new Locale("da", "", ""));
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
#
# Copyright (c) 1999, 2016, 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
# 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.
#
# Hex dump of a serialized ChiceFormat for Bug4185732Test.
aced0005737200166a6176612e746578742e43686f696365466f726d617418e9
c6bee365b6040200025b000d63686f696365466f726d6174737400135b4c6a61
76612f6c616e672f537472696e673b5b000c63686f6963654c696d6974737400
025b44787200166a6176612e746578742e4e756d626572466f726d6174dff6b3
bf137d07e803000b5a000c67726f7570696e67557365644200116d6178467261
6374696f6e4469676974734200106d6178496e74656765724469676974734900
156d6178696d756d4672616374696f6e4469676974734900146d6178696d756d
496e74656765724469676974734200116d696e4672616374696f6e4469676974
734200106d696e496e74656765724469676974734900156d696e696d756d4672
616374696f6e4469676974734900146d696e696d756d496e7465676572446967
6974735a00107061727365496e74656765724f6e6c7949001573657269616c56
657273696f6e4f6e53747265616d787200106a6176612e746578742e466f726d
6174fbd8bc12e90f184302000078700103280000000300000028000100000000
00000001000000000178757200135b4c6a6176612e6c616e672e537472696e67
3badd256e7e91d7b470200007870000000067400034d6f6e7400035475657400
0357656474000454687572740003467269740003536174757200025b443ea68c
14ab635a1e0200007870000000073ff000000000000040000000000000004008
000000000000401000000000000040140000000000004018000000000000401c
000000000000
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册