I have problem when I try to run unit test when I embed an Image
[Embed(source="assets/Pen.png")]
[Bindable]
private var PenImageClass:Class;
private var penCursor:Bitmap= (new PenImageClass());
the error message is :
unable to resolve 'assets/Pen.png' for transcoding
but when I commented the [Embed(source="assets/Pen.png")] It works correctly.
>
How can I resolve this.
try to add the assets folder directly beside the as file, the Flex Unit should understand that.
Related
I'm using the Box SDK for .NET and just trying to get started authenticating using the Java Web Token workflow. I'm using code that's pretty much the same as the code sample that's included in the SDK's code examples.
var jwtPrivateKey = File.ReadAllText("private_key.pem");
var boxConfig = new BoxConfig(ClientId, ClientSecret, EnterpriseId, jwtPrivateKey, JwtPrivateKeyPassword, JwtPublicKeyId);
var boxJwt = new BoxJWTAuth(boxConfig);
But at that last line I'm getting an exception that says "pad block corrupted". The stack trace seems to indicate that it involves reading the private key, but I don't see what I could be doing wrong considering this is basically the same as the code sample (https://github.com/box/box-windows-sdk-v2/blob/master/Box.V2.Samples.JWTAuth/Program.cs).
Any ideas?
After re-generating the private key with Cygwin, things are working for me.
I believe what happened was I opened the private key in Notepad or something, then saved it in some format it didn't like (maybe changed encoding to UTF-8, or saved it with Windows-style line breaks).
I am working on a prototype in which I'm adding a texture to movieClip.
Here is my code :
[Embed(source = "/../assets/demo_img.png")]
protected var asset01:Class;
[Embed(source="/../assets/demo_img.xml",mimeType="application/octet-stream")]
protected var data01:Class;
and my movieClip code is :
var myTexture:Texture = Texture.fromBitmap(new asset01());
var atlas:TextureAtlas = new TextureAtlas(myTexture, XML(new data01()));
var mc:MovieClip = new MovieClip(atlas.getTextures("demo_img_"), 10);
but it gives me error :
Error: exception during transcoding: Failed to grab pixels for image \..\PP143Starling\assets\demo_img.png
If anyone have any idea about it, please share.
I faced similar issue and the weird part was it started coming without any change in the code. Initially i faced an issue with windows memory and then eclipse memory and then this error surfaced:
exception during transcoding failed to grab pixels for image
Embed was also not recognized by compiler anymore.
The fix is very simple. I just cleaned my project in eclipse and the error was cleared.
I'm trying to mock FileReference in a flex project I'm working on.
Stubbing out some properties, such as name and size works fine, but data just refuses to work.
Here is code that illustrates the problem:
[Test]
public function FileReferenceMockTest():void {
var frMock:FileReference = nice(FileReference);
var bytes:ByteArray = new ByteArray();
stub(frMock).getter("data").returns(bytes);
stub(frMock).getter("name").returns("filename");
assertThat(frMock.name, equalTo("filename")); // works
assertThat(frMock.data, sameInstance(bytes)); // Fails and says that frMock.data is null
}
If I set a breakpoint and check frMock in the debugger it looks like this:
frMock
[inherited]
data = null
creationDate = null
creator = null
modificationDate = null
name = "filename"
__proxy__ = InterceptorProxyListener
...
As you can see, data is treated differently by the mock.
I've been banging my head against this problem for several hours now and could really really use some help figuring this out.
Update:
The code works when run either as a Flex Library Project or a Flex Project (Air). It's when the code is run in a browser plugin that it fails.
A check in the debugger in the library project also shows that the data property is not nested inside [Inherited], but on the same level as the other properties.
Update:
I encountered the same problem with URLLoader, but this time the other way around. Mocking of the URLLoader only works when running the tests in a browser plugin.
Since I'm creating a class to handle local and remote file loading, using either FileReference or URLLoader, depending on input, I'm effectively prevented from unit testing this class completely. :(
I have a .swf file that uses the following code:
private function onClick(e:MouseEvent):void {
var popUpClass:Class = getDefinitionByName(e.currentTarget.popUp) as Class;
popUpContent = new popUpClass();
}
However when I load that swf into another "container" swf I am getting a Reference Error #1065. I have been reading several posts on stack overflow (for example, this one and this one) but I am still confused as to what to do.
For example, do I change the code in my "loaded swf" to reference it's own application domain (not the domain of the container swf?) and if so, how do I do this exactly?
OR do I load the swf file and assign it it's own application domain in the code of the container? (not the code for the loaded swf?)
Also, my "e.currentTarget.popUp" just has a short name "PopUpWhateverName" should I be giving it a full package name like "com.MyLoadedSwf.Assets.PopUpWhateverName"?
Yes , full package name : getDefinitionByName("com.MyLoadedSwf.Assets.PopUpWhateverName")
but You can also try :
var popUpClass:Class = e.currentTarget.popUp.constructor;
popUpContent = new popUpClass();
I'm trying to run a test in Google Chrome 9.0.597.98 beta using Selenium Grid. I'm firing the test off from C# using the default *googlechrome target that ships with Selenium Grid. When I try to open a site, I'm greeted with a "Cannot call method 'indexOf' of undefined" error.
I've found a post from someone who suggests that the solution is to drop security on Chrome a bit by passing in some parameters. This post suggest using something like this:
DefaultSelenium selenium = new DefaultSelenium(location, port, browser, targetPath);
BrowserConfigurationOptions bco = new BrowserConfigurationOptions();
selenium.start(bco.setCommandLineFlags("--disable-web-security"));
For some reason I don't see the BrowserConfigurationOptions anywhere. Is this something that ships with the Selenium dll? Is it something that's not available in the .NET version, but is in others? What options do I have to setting this "--disable-web-security" option and is there a better way of doing this?
Try this
[TestInitialize]
public void PreTest()
{
selenium = new DefaultSelenium("localhost",4444,"googlechrome","http://www.ryanhayes.net")
}
[TestMethod]
public void TestRyanHayesDotNet()
{
selenium.Open("/")
}
removing the / after the ryanhayes.net fixes the problem
Thanks a lot for this, I was looking this information and I got it here!
Now I'm able to run my test in googlechrome, earlier I was getting the same problem.
Following code is working for me:
BrowserConfigurationOptions webSec = new BrowserConfigurationOptions();
selenium.start(webSec.setCommandLineFlags("--disable-web-security"));
You're correct in assuming .Net doesn't have BrowserConfigurationOptions object, but fortunately you don't need it (it's only a thin wrapper). DefaultSelenium has two overrides for the Start() method. One of them takes no parameters and starts the browser normally, but the other takes a string specifying browser options. try selenium.Start("--disable-web-security")