Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8264952: [TestBug] Controls unit tests - ControlTest and SpinnerTest fail for non US Locale #476

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, 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
@@ -53,7 +53,9 @@

import javafx.scene.control.skin.DatePickerSkin;

import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.*;
@@ -62,6 +64,7 @@
public class DatePickerTest {
private DatePicker datePicker;
private final LocalDate today = LocalDate.now();
private static Locale defaultLocale;


/*********************************************************************
@@ -82,12 +85,18 @@ public Node getDisplayNode() {
* *
********************************************************************/

@Before public void setup() {
@BeforeClass public static void setupOnce() {
defaultLocale = Locale.getDefault();
Locale.setDefault(Locale.forLanguageTag("en-US"));
datePicker = new DatePicker();
}

@AfterClass public static void tearDownOnce() {
Locale.setDefault(defaultLocale);
}

@Before public void setup() {
datePicker = new DatePicker();
}

/*********************************************************************
* *
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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
@@ -28,13 +28,18 @@

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

import java.time.LocalDate;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;

import java.util.Locale;

import javafx.scene.control.Button;
import javafx.scene.control.skin.SpinnerSkin;
import javafx.scene.control.Spinner;
@@ -82,6 +87,16 @@ public class SpinnerTest {
// used in tests for counting events, reset to zero in setup()
private int eventCount;

private static Locale defaultLocale;

@BeforeClass public static void setupOnce() {
defaultLocale = Locale.getDefault();
Locale.setDefault(Locale.US);
}

@AfterClass public static void tearDownOnce() {
Locale.setDefault(defaultLocale);
}

@Before public void setup() {
eventCount = 0;