fix myHorizontalInfo visibility

GitOrigin-RevId: c5a93e04cb424409eb216267467274fcec2c66b4
This commit is contained in:
Vladimir Krivosheev
2025-02-11 07:23:20 +01:00
committed by intellij-monorepo-bot
parent 2c97cabc27
commit a54c03c136
4 changed files with 15 additions and 70 deletions

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.uiDesigner.core;
import junit.framework.TestCase;
@@ -21,8 +7,6 @@ import javax.swing.*;
import java.awt.*;
public final class Layout5Test extends TestCase{
public void test1() {
final JPanel panel = new JPanel(new GridLayoutManager(2,3, new Insets(0,0,0,0), 0, 0));
@@ -79,7 +63,7 @@ public final class Layout5Test extends TestCase{
final Dimension preferredSize = panel.getPreferredSize();
// after getPreferredSize() invocation, the field should be not null
final DimensionInfo horizontalInfo = layoutManager.myHorizontalInfo;
final DimensionInfo horizontalInfo = layoutManager.getHorizontalInfo();
assertEquals(3, horizontalInfo.getCellCount());
assertEquals(GridConstraints.SIZEPOLICY_CAN_SHRINK, horizontalInfo.getCellSizePolicy(0));
assertEquals(GridConstraints.SIZEPOLICY_WANT_GROW, horizontalInfo.getCellSizePolicy(1));
@@ -130,7 +114,7 @@ public final class Layout5Test extends TestCase{
final Dimension preferredSize = panel.getPreferredSize();
// after getPreferredSize() invocation, the field should be not null
final DimensionInfo horizontalInfo = layoutManager.myHorizontalInfo;
final DimensionInfo horizontalInfo = layoutManager.getHorizontalInfo();
assertEquals(GridConstraints.SIZEPOLICY_FIXED, horizontalInfo.getCellSizePolicy(0));
assertEquals(GridConstraints.SIZEPOLICY_WANT_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK, horizontalInfo.getCellSizePolicy(1));
assertEquals(GridConstraints.SIZEPOLICY_FIXED, horizontalInfo.getCellSizePolicy(2));

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.uiDesigner.core;
import junit.framework.TestCase;
@@ -174,7 +160,7 @@ public final class SpansTest extends TestCase {
final Dimension preferredSize = panel.getPreferredSize();
// field will be not null after getPreferredSize()
final DimensionInfo horizontalInfo = layoutManager.myHorizontalInfo;
final DimensionInfo horizontalInfo = layoutManager.getHorizontalInfo();
assertEquals(GridConstraints.SIZEPOLICY_WANT_GROW | GridConstraints.SIZEPOLICY_CAN_GROW, horizontalInfo.getCellSizePolicy(0));
assertEquals(GridConstraints.SIZEPOLICY_CAN_SHRINK, horizontalInfo.getCellSizePolicy(1));
assertEquals(GridConstraints.SIZEPOLICY_WANT_GROW, horizontalInfo.getCellSizePolicy(2));

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.uiDesigner.core;
import javax.swing.*;
@@ -56,10 +42,8 @@ public final class GridLayoutManager extends AbstractLayout {
private final int[] myWidths;
private LayoutState myLayoutState;
/**
* package-private because is used in tests
*/
DimensionInfo myHorizontalInfo;
private DimensionInfo myHorizontalInfo;
/**
* package-private because is used in tests
*/
@@ -101,6 +85,11 @@ public final class GridLayoutManager extends AbstractLayout {
myHeights = new int[rowCount];
}
//@VisibleForTesting
public DimensionInfo getHorizontalInfo() {
return myHorizontalInfo;
}
/**
* don't delete this constructor! don't use this constructor!!! should be used ONLY in generated code or in tests
*/

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.uiDesigner.core;
final class HorizontalInfo extends DimensionInfo{
@@ -47,7 +33,7 @@ final class HorizontalInfo extends DimensionInfo{
@Override
public DimensionInfo getDimensionInfo(GridLayoutManager grid) {
return grid.myHorizontalInfo;
return grid.getHorizontalInfo();
}
@Override