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

fixed ability to execute tests with/without isolation between tests #2054

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CodenameOne/src/cn1-version-numbers
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
d87d8cbada83f42fe22ee0a94fb4e3faf06cb86e
2333
e5c43877074c18b4b5c7748d000e5cfac75ab749
2318
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import com.codename1.ui.EncodedImage;
import com.codename1.io.FileSystemStorage;
import com.codename1.io.Log;
import com.codename1.io.Util;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -67,7 +66,7 @@ public byte[] getImageData() {
}
return imageData;
} catch (IOException ex) {
Log.e(ex);
ex.printStackTrace();
return null;
} finally {
Util.cleanup(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.codename1.ui.EncodedImage;
import com.codename1.ui.Image;
import com.codename1.io.FileSystemStorage;
import com.codename1.io.Log;
import com.codename1.io.Util;
import java.io.InputStream;
import java.util.Vector;
Expand Down Expand Up @@ -114,7 +113,7 @@ public void run() {
}
});
} catch (Throwable ex) {
Log.e(ex);
ex.printStackTrace();
} finally {
queued = false;
Util.cleanup(i);
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/components/FileTreeModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
package com.codename1.components;

import com.codename1.io.FileSystemStorage;
import com.codename1.io.Log;
import com.codename1.ui.tree.TreeModel;
import java.util.Vector;

Expand Down Expand Up @@ -117,7 +116,7 @@ public Vector getChildren(Object parent) {
}
}
} catch(Throwable err) {
Log.e(err);
err.printStackTrace();
return new Vector();
}
return response;
Expand Down
5 changes: 2 additions & 3 deletions CodenameOne/src/com/codename1/components/MediaPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/
package com.codename1.components;

import com.codename1.io.Log;
import com.codename1.media.Media;
import com.codename1.media.MediaManager;
import com.codename1.ui.Button;
Expand Down Expand Up @@ -213,7 +212,7 @@ public void run() {
try {
setDataSource(uri, null);
} catch(Throwable t) {
Log.e(t);
t.printStackTrace();
}
}
}, "Media Thread").start();
Expand Down Expand Up @@ -492,7 +491,7 @@ public void run() {
try {
setDataSource(dataSource, this);
} catch(IOException err) {
Log.e(err);
err.printStackTrace();
}
}
}
Expand Down
46 changes: 11 additions & 35 deletions CodenameOne/src/com/codename1/components/SignatureComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.layouts.GridLayout;
import com.codename1.ui.plaf.Style;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.EventDispatcher;


Expand Down Expand Up @@ -86,14 +85,10 @@ public class SignatureComponent extends Container {
public boolean animate() {
if (signatureImage != null && signatureImage.animate()) {
Style s = getStyle();
Image icon = signatureImage;
if (icon.getWidth() > getWidth() - s.getHorizontalPadding() || icon.getHeight() > getHeight() - s.getVerticalPadding()) {
icon = signatureImage.scaledSmallerRatio(
getWidth() - s.getHorizontalPadding(),
getHeight() - s.getVerticalPadding()
);
}
lead.setIcon(icon);
lead.setIcon(signatureImage.scaledSmallerRatio(
getWidth() - s.getHorizontalPadding(),
getHeight() - s.getVerticalPadding()
));
repaint();
return true;
}
Expand Down Expand Up @@ -148,10 +143,6 @@ protected void deinitialize() {
super.deinitialize();
}

private String localize(String key, String defaultVal) {
return UIManager.getInstance().localize(key, defaultVal);
}

/**
* Creates a new signature component.
*/
Expand All @@ -178,11 +169,11 @@ protected void paintBackground(Graphics g) {


};
lead.setText(localize("SignatureComponent.LeadText","Press to sign"));
lead.setText("Press to sign");
lead.setUIID("SignatureButton");
lead.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
final Dialog dialog = new Dialog(localize("SignatureComponent.DialogTitle", "Sign Here"));
final Dialog dialog = new Dialog("Sign Here");
final SignatureDialogBody sigBody = new SignatureDialogBody() {
@Override
protected void onCancel() {
Expand Down Expand Up @@ -231,18 +222,8 @@ public void setSignatureImage(Image img) {
signatureImage = img;
lead.setText("");
if (img != null) {
int maxW = lead.getWidth() - lead.getStyle().getPaddingLeftNoRTL() - lead.getStyle().getPaddingRightNoRTL();
int maxH = lead.getHeight() - lead.getStyle().getPaddingTop()- lead.getStyle().getPaddingBottom();

Image icon = img;
if (icon.getWidth() > maxW || icon.getHeight() > maxH) {
icon = icon.scaledSmallerRatio(maxW, maxH);
}

Image icon = img.scaledSmallerRatio(lead.getWidth() - lead.getStyle().getPaddingLeftNoRTL() - lead.getStyle().getPaddingRightNoRTL(), lead.getHeight() - lead.getStyle().getPaddingTop()- lead.getStyle().getPaddingBottom());
lead.setIcon(icon);
} else {
lead.setText(localize("SignatureComponent.LeadText","Press to sign"));
lead.setIcon(null);
}
}
}
Expand Down Expand Up @@ -272,19 +253,14 @@ public SignatureDialogBody() {
setLayout(new BorderLayout());
signaturePanel = new SignaturePanel();
addComponent(BorderLayout.CENTER, signaturePanel);
doneButton = new Button(localize("SignatureComponent.SaveButtonLabel", "Save"));
resetButton = new Button(localize("SignatureComponent.ResetButtonLabel", "Reset"));
cancelButton = new Button(localize("SignatureComponent.CancelButtonLabel", "Cancel"));
doneButton = new Button("Save");
resetButton = new Button("Reset");
cancelButton = new Button("Cancel");

doneButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (signaturePanel.path.getPointsSize() < 2) {
Dialog.show(
localize("SignatureComponent.ErrorDialog.SignatureRequired.Title", "Signature Required"),
localize("SignatureComponent.ErrorDialog.SignatureRequired.Body", "Please draw your signature in the space provided."),
localize("SignatureComponent.ErrorDialog.OK", "OK"),
null
);
Dialog.show("Signature Required", "Please draw your signature in the space provided.", "OK", null);
return;
}
value = signaturePanel.getImage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/
package com.codename1.components;

import com.codename1.io.Log;
import com.codename1.io.Storage;
import com.codename1.io.Util;
import com.codename1.ui.Display;
Expand Down Expand Up @@ -100,7 +99,7 @@ public void run() {
}
});
} catch (Throwable ex) {
Log.e(ex);
ex.printStackTrace();
} finally {
queued = false;
Util.cleanup(i);
Expand Down
5 changes: 2 additions & 3 deletions CodenameOne/src/com/codename1/components/WebBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
package com.codename1.components;

import com.codename1.io.ConnectionRequest;
import com.codename1.io.Log;
import com.codename1.ui.*;
import com.codename1.ui.animations.Animation;
import com.codename1.ui.events.ActionEvent;
Expand Down Expand Up @@ -105,7 +104,7 @@ public void actionPerformed(ActionEvent evt) {
}
} catch(Throwable t) {
// workaround for issue in the designer related to JavaFX, fallback to lightweight mode...
Log.e(t);
t.printStackTrace();
}

isNative = false;
Expand Down Expand Up @@ -161,7 +160,7 @@ protected void handleErrorResponseCode(int code, String message) {

protected void handleException(Exception err) {
System.out.println("Error occured");
Log.e(err);
err.printStackTrace();
if(loading != null){
loading.unInstall();
}
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/facebook/ui/LikeButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package com.codename1.facebook.ui;

import com.codename1.facebook.FaceBookAccess;
import com.codename1.io.Log;
import com.codename1.ui.Button;
import com.codename1.ui.events.ActionEvent;
import com.codename1.ui.events.ActionListener;
Expand Down Expand Up @@ -84,7 +83,7 @@ public void actionPerformed(ActionEvent evt) {
try {
FaceBookAccess.getInstance().postLike(getPostId());
} catch (IOException ex) {
Log.e(ex);
ex.printStackTrace();
}
}

Expand Down
29 changes: 7 additions & 22 deletions CodenameOne/src/com/codename1/impl/CodenameOneImplementation.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,21 +320,6 @@ public final void editStringImpl(Component cmp, int maxSize, int constraint, Str
}
}

/**
* Sets current editingText value and sets it focused.
* NB! it not call editString, that is it should be called only internally and
* actually the methdo should not be added :)
*/
public void setFocusedEditingText(Component cmp) {
editingText = cmp;
if (cmp != null) {
Form form = cmp.getComponentForm();
if (form != null) {
form.setFocused(cmp);
}
}
}

/**
* Invoked for special cases to stop text editing and clear native editing state
*/
Expand Down Expand Up @@ -3876,7 +3861,7 @@ public void setBrowserURL(PeerComponent browserPeer, String url) {
setBrowserPage(browserPeer, htmlText, baseUrl);
return;
} catch (IOException ex) {
Log.e(ex);
ex.printStackTrace();
}
}

Expand Down Expand Up @@ -4315,7 +4300,7 @@ public void cleanup(Object o) {
}
}
} catch (Throwable ex) {
Log.e(ex);
ex.printStackTrace();
}
}

Expand Down Expand Up @@ -4550,7 +4535,7 @@ public int getStorageEntrySize(String name) {
}
Util.cleanup(i);
} catch(IOException err) {
Log.e(err);
err.printStackTrace();
}
return (int)size;
}
Expand Down Expand Up @@ -4983,7 +4968,7 @@ public void run() {
thumbs.put(node, data);
Storage.getInstance().writeObject("thumbnails", thumbs);
} catch (IOException ex) {
Log.e(ex);
ex.printStackTrace();
}
}
Image im = Image.createImage(data, 0, data.length);
Expand Down Expand Up @@ -5082,7 +5067,7 @@ public Image getApplicationIconImage() {
try {
return EncodedImage.create(i);
} catch (IOException ex) {
Log.e(ex);
ex.printStackTrace();
}
}
return null;
Expand Down Expand Up @@ -5956,14 +5941,14 @@ public void run() {
}
}
} catch (IOException ex) {
Log.e(ex);
ex.printStackTrace();
}
try {
synchronized(callback) {
callback.wait(pollingMillis);
}
} catch(Throwable t) {
Log.e(t);
t.printStackTrace();
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions CodenameOne/src/com/codename1/io/ConnectionRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,7 @@ protected void readResponse(InputStream input) throws IOException {
if(destinationFile != null) {
OutputStream o = FileSystemStorage.getInstance().openOutputStream(destinationFile);
Util.copy(input, o);
Util.cleanup(o);

// was the download killed while we downloaded
if(isKilled()) {
Expand All @@ -1087,6 +1088,7 @@ protected void readResponse(InputStream input) throws IOException {
if(destinationStorage != null) {
OutputStream o = Storage.getInstance().createOutputStream(destinationStorage);
Util.copy(input, o);
Util.cleanup(o);

// was the download killed while we downloaded
if(isKilled()) {
Expand Down
23 changes: 3 additions & 20 deletions CodenameOne/src/com/codename1/io/JSONParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,6 @@ public static void setUseLongs(boolean aUseLongsDefault) {
useLongsDefault = aUseLongsDefault;
}

/**
* Indicates that the parser will include null values in the parsed output
* @return the includeNullsDefault
*/
public static boolean isIncludeNulls() {
return includeNullsDefault;
}

/**
* Indicates that the parser will include null values in the parsed output
* @param aIncludeNullsDefault the includeNullsDefault to set
*/
public static void setIncludeNulls(boolean aIncludeNullsDefault) {
includeNullsDefault = aIncludeNullsDefault;
}

static class ReaderClass {
char[] buffer;
int buffOffset;
Expand All @@ -118,7 +102,6 @@ int read(Reader is) throws IOException {
}

private static boolean useLongsDefault;
private static boolean includeNullsDefault;
private boolean modern;
private Map<String, Object> state;
private java.util.List<Object> parseStack;
Expand Down Expand Up @@ -196,7 +179,7 @@ public static void parse(Reader i, JSONParseCallback callback) throws IOExceptio
c = (char) Integer.parseInt(unicode, 16);
} catch (NumberFormatException err) {
// problem in parsing the u notation!
Log.e(err);
err.printStackTrace();
System.out.println("Error in parsing \\u" + unicode);
}
} else {
Expand Down Expand Up @@ -309,7 +292,7 @@ public static void parse(Reader i, JSONParseCallback callback) throws IOExceptio
}

} catch (NumberFormatException err) {
Log.e(err);
err.printStackTrace();
// this isn't a number!
}
}
Expand Down Expand Up @@ -545,7 +528,7 @@ public void stringToken(String tok) {
if (currentKey == null) {
currentKey = tok;
} else {
if (tok != null || isIncludeNulls()) {
if (tok != null) {
getStackHash().put(currentKey, tok);
}
currentKey = null;
Expand Down
Loading