-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Image type SWT.ICON loses its type during re-scale #1805
Image initialized as SWT.ICON in Image(Device, ImageData, ImageData) loses its "Icon" properties, i.e. type, mask etc., when a handle for a different zoom level is requested and "SMOOTH" scaling is used. This change adapts the initialization of the image when the handle is requested for image type SWT.ICON to preserve the properties. Fixes #1805
- Loading branch information
1 parent
e2ae17b
commit 920fe85
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...es/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/graphics/ImagesWin32Tests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Yatta Solutions | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Yatta Solutions - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.graphics; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.eclipse.swt.*; | ||
import org.eclipse.swt.internal.*; | ||
import org.eclipse.swt.widgets.*; | ||
import org.junit.jupiter.api.*; | ||
import org.junit.jupiter.api.extension.*; | ||
|
||
@ExtendWith(PlatformSpecificExecutionExtension.class) | ||
@ExtendWith(WithMonitorSpecificScalingExtension.class) | ||
class ImagesWin32Tests { | ||
|
||
@Test | ||
public void testImageIconTypeShouldNotChangeAfterCallingGetHandleForDifferentZoom() { | ||
Image icon = Display.getDefault().getSystemImage(SWT.ICON_ERROR); | ||
try { | ||
Image.win32_getHandle(icon, 200); | ||
assertEquals("Image type should stay to SWT.ICON", SWT.ICON, icon.type); | ||
} finally { | ||
icon.dispose(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters